protected override void PreBuild() { var cg = CurrentContainer.GainGenerator(); Builder = cg.CreateLocal(DataType); if (!string.IsNullOrWhiteSpace(Name)) { Builder.SetLocalSymInfo(Name); } }
/// <summary> /// Creates local variable declarations. /// </summary> /// <param name="il">The IL generator to use.</param> /// <param name="method">The method to proxy.</param> protected override void DeclareLocals(ILGenerator il, MethodInfo method) { base.DeclareLocals(il, method); target = il.DeclareLocal(typeof(object)); #if DEBUG target.SetLocalSymInfo("target"); #endif }
internal override void SetLocalName(LocalBuilder localBuilder, string name) { localBuilder.SetLocalSymInfo(name); }
internal void Declare(ILGenerator ilgen) { local = ilgen.DeclareLocal(type); if (name != null) { local.SetLocalSymInfo(name); } }
/// <summary> /// Creates local variable declarations. /// </summary> /// <param name="il">The IL generator to use.</param> /// <param name="method">The method to proxy.</param> protected virtual void DeclareLocals(ILGenerator il, MethodInfo method) { interceptors = il.DeclareLocal(typeof(IList)); targetType = il.DeclareLocal(typeof(Type)); arguments = il.DeclareLocal(typeof(Object[])); #if NET_2_0 if (method.IsGenericMethodDefinition) { genericTargetMethod = il.DeclareLocal(typeof(MethodInfo)); genericOnProxyTargetMethod = il.DeclareLocal(typeof(MethodInfo)); } #endif if (methodReturnsValue) { returnValue = il.DeclareLocal(method.ReturnType); } #if DEBUG interceptors.SetLocalSymInfo("interceptors"); targetType.SetLocalSymInfo("targetType"); arguments.SetLocalSymInfo("arguments"); #if NET_2_0 if (method.IsGenericMethodDefinition) { genericTargetMethod.SetLocalSymInfo("genericTargetMethod"); genericOnProxyTargetMethod.SetLocalSymInfo("genericOnProxyTargetMethod"); } #endif if (methodReturnsValue) { returnValue.SetLocalSymInfo("returnValue"); } #endif }
public void MaybSetLocalName(LocalBuilder lb, string name) { if (_isDebuggable) lb.SetLocalSymInfo(name); }
/// <summary> /// Creates local variable declarations. /// </summary> /// <param name="il">The IL generator to use.</param> /// <param name="method">The method to proxy.</param> protected override void DeclareLocals(ILGenerator il, MethodInfo method) { base.DeclareLocals(il, method); targetSource = il.DeclareLocal(typeof(ITargetSourceWrapper)); #if DEBUG targetSource.SetLocalSymInfo("targetSource"); #endif }
public virtual void Declare(ILGenerator il) { if (_local != null) { throw new InvalidOperationException("Variable " + Name + " is already declared!"); } _local = il.DeclareLocal(this.Type); _local.SetLocalSymInfo(Name); }
private void EmitInitHeapEnv() { if (!HasHeapEnv()) return; mHeapEnvBuilder = mILGenerator.DeclareLocal(mHeapEnvTypeBuilder); if (JITInterpreter_DS.Instance().HasSymbolInfo()) { mHeapEnvBuilder.SetLocalSymInfo(HEAP_ENV_LOCAL_NAME); } var constructor = mHeapEnvTypeBuilder.DefineDefaultConstructor(MethodAttributes.Public); mILGenerator.Emit(OpCodes.Newobj, constructor); EmitStoreLocal(mILGenerator, mHeapEnvBuilder); if (mLambdaNode.childrenFreeAddresses.Where(v => v.envIndex > 0).GetEnumerator().MoveNext()) { var fieldBuilder = mHeapEnvTypeBuilder.DefineField(PREV_ENV_FIELD_NAME, mEnvTypeBuilder, FieldAttributes.Public); mHeapEnvFieldBuilders[PREV_ENV_FIELD_NAME] = fieldBuilder; JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder); JITInterpreter_DS.EmitLoadThis(mILGenerator); mILGenerator.Emit(OpCodes.Stfld, fieldBuilder); } var heapLocals = mLambdaNode.childrenFreeAddresses.Where(a=>a.envIndex == 0).Select(a=>a.index).OrderBy(a=>a).ToList(); foreach (var index in heapLocals) { var fieldBuilder = mHeapEnvTypeBuilder.DefineField(mLambdaNode.locals[index], typeof(object), FieldAttributes.Public); mHeapEnvFieldBuilders[mLambdaNode.locals[index]] = fieldBuilder; if (index < mLambdaNode.formalCount) { JITInterpreter_DS.EmitLoadLocal(mILGenerator, mHeapEnvBuilder); JITInterpreter_DS.EmitLoadArg(mILGenerator, HasThisArgument(), mArgBuilders[index]); mILGenerator.Emit(OpCodes.Stfld, fieldBuilder); } } }