private void BeginEmitPopLocal(LocalAddress address) { var builder = mLocalBuilders[address.index]; if (builder is ParameterBuilder) { // } else { LocalBuilder localBuilder = builder as LocalBuilder; if (localBuilder.LocalType == typeof(object)) { // } else { JITInterpreter_DS2.EmitLoadLocal(mILGenerator, localBuilder); } } }
private void EmitLoadLocal(LocalAddress address) { var builder = mLocalBuilders[address.index]; if (builder is ParameterBuilder) { JITInterpreter_DS2.EmitLoadArg(mILGenerator, HasThisArgument(), builder as ParameterBuilder); } else { LocalBuilder localBuilder = builder as LocalBuilder; if (localBuilder.LocalType == typeof(object)) { JITInterpreter_DS2.EmitLoadLocal(mILGenerator, localBuilder); } else { JITInterpreter_DS2.EmitLoadLocal(mILGenerator, localBuilder); mILGenerator.Emit(OpCodes.Ldfld, typeof(SharedValue).GetField("value")); } } }
public void Visit(ASTNode_Lambda node) { var childCompiler = new ASTNodeVisitor_JITCompiler(TypeBuilder, node); if (childCompiler.MethodBuilder.IsStatic) { mILGenerator.Emit(OpCodes.Ldnull); mILGenerator.Emit(OpCodes.Ldftn, childCompiler.MethodBuilder); mILGenerator.Emit(OpCodes.Newobj, JITInterpreter_DS2.Instance().GetDelegateType(node.formalCount). GetConstructor(new Type[] { typeof(object), typeof(IntPtr) })); } else { mILGenerator.Emit(OpCodes.Newobj, childCompiler.ConstructorBuilder); foreach (var address in node.GetFreeAddresses()) { mILGenerator.Emit(OpCodes.Dup); if (address.envIndex == 1) { JITInterpreter_DS2.EmitLoadLocal(mILGenerator, (LocalBuilder)mLocalBuilders[address.index]); } else { JITInterpreter_DS2.EmitLoadThis(mILGenerator); mILGenerator.Emit(OpCodes.Ldfld, FieldBuilders[address.GetOuterAddress()]); } mILGenerator.Emit(OpCodes.Stfld, childCompiler.FieldBuilders[address]); } mILGenerator.Emit(OpCodes.Ldftn, childCompiler.MethodBuilder); mILGenerator.Emit(OpCodes.Newobj, JITInterpreter_DS2.Instance().GetDelegateType(node.formalCount) .GetConstructor(new Type[] { typeof(object), typeof(IntPtr) })); } }