[Ikvm-commit] ikvm/runtime compiler.cs, 1.88, 1.89 intrinsics.cs, 1.1, 1.2
Brought to you by:
jfrijters
From: Jeroen F. <jfr...@us...> - 2008-05-31 10:22:36
|
Update of /cvsroot/ikvm/ikvm/runtime In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv12949 Modified Files: compiler.cs intrinsics.cs Log Message: Pass caller method instead of type to intrinsic infrastructure. Index: intrinsics.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/intrinsics.cs,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** intrinsics.cs 9 May 2008 05:58:04 -0000 1.1 --- intrinsics.cs 31 May 2008 10:22:39 -0000 1.2 *************** *** 33,37 **** static class Intrinsics { ! private delegate bool Emitter(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code); private struct IntrinsicKey : IEquatable<IntrinsicKey> { --- 33,37 ---- static class Intrinsics { ! private delegate bool Emitter(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code); private struct IntrinsicKey : IEquatable<IntrinsicKey> { *************** *** 99,103 **** } ! internal static bool Emit(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { // note that intrinsics can always refuse to emit code and the code generator will fall back to a normal method call --- 99,103 ---- } ! internal static bool Emit(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { // note that intrinsics can always refuse to emit code and the code generator will fall back to a normal method call *************** *** 105,109 **** } ! private static bool Float_floatToRawIntBits(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofFloatConverter, "ToInt"); --- 105,109 ---- } ! private static bool Float_floatToRawIntBits(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofFloatConverter, "ToInt"); *************** *** 111,115 **** } ! private static bool Float_intBitsToFloat(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofFloatConverter, "ToFloat"); --- 111,115 ---- } ! private static bool Float_intBitsToFloat(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofFloatConverter, "ToFloat"); *************** *** 117,121 **** } ! private static bool Double_doubleToRawLongBits(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofDoubleConverter, "ToLong"); --- 117,121 ---- } ! private static bool Double_doubleToRawLongBits(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofDoubleConverter, "ToLong"); *************** *** 123,127 **** } ! private static bool Double_longBitsToDouble(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofDoubleConverter, "ToDouble"); --- 123,127 ---- } ! private static bool Double_longBitsToDouble(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { EmitConversion(ilgen, typeofDoubleConverter, "ToDouble"); *************** *** 136,140 **** } ! private static bool System_arraycopy(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { // if the array arguments on the stack are of a known array type, we can redirect to an optimized version of arraycopy. --- 136,140 ---- } ! private static bool System_arraycopy(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { // if the array arguments on the stack are of a known array type, we can redirect to an optimized version of arraycopy. *************** *** 189,198 **** } ! private static bool AtomicReferenceFieldUpdater_newUpdater(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { ! return AtomicReferenceFieldUpdaterEmitter.Emit(caller, ilgen, classFile, opcodeIndex, code); } ! private static bool String_toCharArray(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, TypeWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { string str = ilgen.PopLazyLdstr(); --- 189,198 ---- } ! private static bool AtomicReferenceFieldUpdater_newUpdater(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { ! return AtomicReferenceFieldUpdaterEmitter.Emit(caller.DeclaringType, ilgen, classFile, opcodeIndex, code); } ! private static bool String_toCharArray(CountingILGenerator ilgen, MethodWrapper method, MethodAnalyzer ma, int opcodeIndex, MethodWrapper caller, ClassFile classFile, ClassFile.Method.Instruction[] code) { string str = ilgen.PopLazyLdstr(); *************** *** 202,206 **** if (str.Length > 128) { ! EmitLoadCharArrayLiteral(ilgen, str, caller); return true; } --- 202,206 ---- if (str.Length > 128) { ! EmitLoadCharArrayLiteral(ilgen, str, caller.DeclaringType); return true; } Index: compiler.cs =================================================================== RCS file: /cvsroot/ikvm/ikvm/runtime/compiler.cs,v retrieving revision 1.88 retrieving revision 1.89 diff -C2 -d -r1.88 -r1.89 *** compiler.cs 9 May 2008 05:58:03 -0000 1.88 --- compiler.cs 31 May 2008 10:22:37 -0000 1.89 *************** *** 1720,1724 **** ClassFile.ConstantPoolItemMI cpi = classFile.GetMethodref(instr.Arg1); MethodWrapper method = GetMethodCallEmitter(cpi, instr.NormalizedOpCode); ! if(method.IsIntrinsic && Intrinsics.Emit(ilGenerator, method, ma, i, clazz, classFile, code)) { break; --- 1720,1724 ---- ClassFile.ConstantPoolItemMI cpi = classFile.GetMethodref(instr.Arg1); MethodWrapper method = GetMethodCallEmitter(cpi, instr.NormalizedOpCode); ! if(method.IsIntrinsic && Intrinsics.Emit(ilGenerator, method, ma, i, mw, classFile, code)) { break; *************** *** 1760,1764 **** MethodWrapper method = GetMethodCallEmitter(cpi, instr.NormalizedOpCode); ! if(method.IsIntrinsic && Intrinsics.Emit(ilGenerator, method, ma, i, clazz, classFile, code)) { break; --- 1760,1764 ---- MethodWrapper method = GetMethodCallEmitter(cpi, instr.NormalizedOpCode); ! if(method.IsIntrinsic && Intrinsics.Emit(ilGenerator, method, ma, i, mw, classFile, code)) { break; |