protected sealed override void EmitCode(NodeFactory factory, ref ARMEmitter encoder, bool relocsOnly) { // First load the generic context into the context register. EmitLoadGenericContext(factory, ref encoder, relocsOnly); Register contextRegister = GetContextRegister(ref encoder); switch (_id) { case ReadyToRunHelperId.GetNonGCStaticBase: { ARMDebug.EmitNYIAssert(factory, ref encoder, "GetNonGCStaticBase EmitCode is not implemented"); /* *** ***NOT TESTED!!! *** ***Debug.Assert(contextRegister == encoder.TargetRegister.Arg0); *** ***MetadataType target = (MetadataType)_target; *** ***if (!factory.TypeSystemContext.HasLazyStaticConstructor(target)) ***{ ***EmitDictionaryLookup(factory, ref encoder, encoder.TargetRegister.Arg0, encoder.TargetRegister.Result, _lookupSignature, relocsOnly); ***encoder.EmitRET(); ***} ***else ***{ ***EmitDictionaryLookup(factory, ref encoder, encoder.TargetRegister.Arg0, encoder.TargetRegister.Arg0, _lookupSignature, relocsOnly); ***encoder.EmitMOV(encoder.TargetRegister.Result, encoder.TargetRegister.Arg0); *** ***// We need to trigger the cctor before returning the base. It is stored at the beginning of the non-GC statics region. ***int cctorContextSize = NonGCStaticsNode.GetClassConstructorContextStorageSize(factory.Target, target); ***encoder.EmitSUB(encoder.TargetRegister.Arg0, ((byte)(cctorContextSize))); ***// If we get the required state it will be necessary to restore the original value before returning ***encoder.EmitPUSH(encoder.TargetRegister.Arg0); *** ***// cmp [r0 + ptrSize], 1 ***encoder.EmitLDR(encoder.TargetRegister.Arg0, encoder.TargetRegister.Arg0, ((short)factory.Target.PointerSize)); ***encoder.EmitCMP(encoder.TargetRegister.Arg0, ((byte)1)); ***// return with restoring register ***encoder.EmitRETIfEqualPOP(encoder.TargetRegister.Arg0); *** ***// just restore after cmp ***encoder.EmitPOP(encoder.TargetRegister.Arg0); *** ***encoder.EmitLDR(encoder.TargetRegister.Arg0, encoder.TargetRegister.Arg0); ***encoder.EmitMOV(encoder.TargetRegister.Arg1, encoder.TargetRegister.Result); ***encoder.EmitJMP(factory.HelperEntrypoint(HelperEntrypoint.EnsureClassConstructorRunAndReturnNonGCStaticBase)); ***}
protected override void EmitCode(NodeFactory factory, ref ARMEmitter instructionEncoder, bool relocsOnly) { instructionEncoder.EmitPUSH(ARM.Register.R12); instructionEncoder.EmitMOV(ARM.Register.R12, factory.ExternSymbol("RhpInitialInterfaceDispatch")); instructionEncoder.EmitMOV(ARM.Register.R15, ARM.Register.R12); }