public override LocalVariableDefinition[] GetLocals() { LocalVariableDefinition[] locals = _methodIL.GetLocals(); LocalVariableDefinition[] clone = null; for (int i = 0; i < locals.Length; i++) { TypeDesc uninst = locals[i].Type; TypeDesc inst = uninst.InstantiateSignature(_typeInstantiation, _methodInstantiation); if (uninst != inst) { if (clone == null) { clone = new LocalVariableDefinition[locals.Length]; for (int j = 0; j < clone.Length; j++) { clone[j] = locals[j]; } } clone[i] = new LocalVariableDefinition(inst, locals[i].IsPinned); } } return (clone == null) ? locals : clone; }
private void Get_CORINFO_SIG_INFO(LocalVariableDefinition[] locals, out CORINFO_SIG_INFO sig) { sig.callConv = CorInfoCallConv.CORINFO_CALLCONV_DEFAULT; sig._retType = (byte)CorInfoType.CORINFO_TYPE_VOID; sig.retTypeClass = null; sig.retTypeSigClass = null; sig.flags = (byte)CorInfoSigInfoFlags.CORINFO_SIGFLAG_IS_LOCAL_SIG; sig.numArgs = (ushort)locals.Length; sig.sigInst.classInst = null; sig.sigInst.classInstCount = 0; sig.sigInst.methInst = null; sig.sigInst.methInstCount = 0; sig.args = (CORINFO_ARG_LIST_STRUCT_*)0; // CORINFO_ARG_LIST_STRUCT_ is argument index sig.pSig = (byte*)ObjectToHandle(locals); sig.cbSig = 0; // Not used by the JIT sig.scope = null; // Not used by the JIT sig.token = 0; // Not used by the JIT }
public ILStubMethodIL(byte[] ilBytes, LocalVariableDefinition[] locals, Object[] tokens) { _ilBytes = ilBytes; _locals = locals; _tokens = tokens; }
public LocalVariableDefinition[] ParseLocalsSignature() { if (_reader.ReadSignatureHeader().Kind != SignatureKind.LocalVariables) throw new BadImageFormatException(); int count = _reader.ReadCompressedInteger(); LocalVariableDefinition[] locals; if (count > 0) { locals = new LocalVariableDefinition[count]; for (int i = 0; i < count; i++) { bool isPinned = false; SignatureTypeCode typeCode = ParseTypeCode(); if (typeCode == SignatureTypeCode.Pinned) { isPinned = true; typeCode = ParseTypeCode(); } locals[i] = new LocalVariableDefinition(ParseType(typeCode), isPinned); } } else { locals = Array.Empty<LocalVariableDefinition>(); } return locals; }
public ILStubMethodIL(MethodDesc owningMethod, byte[] ilBytes, LocalVariableDefinition[] locals, Object[] tokens) { _ilBytes = ilBytes; _locals = locals; _tokens = tokens; _method = owningMethod; }
public LocalVariableDefinition[] ParseLocalsSignature() { if ((_reader.ReadByte() & 0xF) != 7) // IMAGE_CEE_CS_CALLCONV_LOCAL_SIG - add it to SignatureCallingConvention? throw new BadImageFormatException(); int count = _reader.ReadCompressedInteger(); LocalVariableDefinition[] locals; if (count > 0) { locals = new LocalVariableDefinition[count]; for (int i = 0; i < count; i++) { bool isPinned = false; SignatureTypeCode typeCode = ParseTypeCode(); if (typeCode == SignatureTypeCode.Pinned) { isPinned = true; typeCode = ParseTypeCode(); } locals[i] = new LocalVariableDefinition(ParseType(typeCode), isPinned); } } else { locals = Array.Empty<LocalVariableDefinition>(); } return locals; }