protected override void EmitCode(NodeFactory factory, ref X86Emitter instructionEncoder, bool relocsOnly) { switch (_thunkKind) { case Kind.Eager: break; case Kind.DelayLoadHelper: case Kind.VirtualStubDispatch: instructionEncoder.EmitXOR(Register.EAX, Register.EAX); if (!relocsOnly) { // push table index instructionEncoder.EmitPUSH((sbyte)_containingImportSection.IndexFromBeginningOfArray); } // push [module] instructionEncoder.EmitPUSH(factory.ModuleImport); break; case Kind.Lazy: // mov edx, [module] instructionEncoder.EmitMOV(Register.EDX, factory.ModuleImport); break; default: throw new NotSupportedException(_thunkKind.ToString() + " is not supported"); } instructionEncoder.EmitJMP(_helperCell); }
protected override void EmitCode(NodeFactory factory, ref X86Emitter instructionEncoder, bool relocsOnly) { switch (_thunkKind) { case Kind.Eager: break; case Kind.DelayLoadHelper: case Kind.VirtualStubDispatch: instructionEncoder.EmitXOR(Register.EAX, Register.EAX); if (!relocsOnly) { // push table index instructionEncoder.EmitPUSH((sbyte)_instanceCell.Table.IndexFromBeginningOfArray); } // push [module] instructionEncoder.EmitPUSH(_moduleImport); break; case Kind.Lazy: // mov edx, [module] instructionEncoder.EmitMOV(Register.EDX, _moduleImport); break; } instructionEncoder.EmitJMP(_helperCell); }