39 |
#define V_INLINE_FIELD_STORE (2) |
#define V_INLINE_FIELD_STORE (2) |
40 |
#define V_INLINE_CONST_LOAD (3) |
#define V_INLINE_CONST_LOAD (3) |
41 |
|
|
42 |
static int TryInlineLoad(ILMethod *method, int numParams, |
static int TryInlineLoad(ILExecProcess *process, ILMethod *method, int numParams, |
43 |
ILMethodCode *code, unsigned *inlineOpcode, |
ILMethodCode *code, unsigned *inlineOpcode, |
44 |
unsigned char **inlinePc, ILField **field) |
unsigned char **inlinePc, ILField **field) |
45 |
{ |
{ |
133 |
|
|
134 |
retval = V_INLINE_FIELD_LOAD; |
retval = V_INLINE_FIELD_LOAD; |
135 |
|
|
136 |
*field = GetFieldToken(method, pc); |
*field = GetFieldToken(process, method, pc); |
137 |
|
|
138 |
if (*field == 0) |
if (*field == 0) |
139 |
{ |
{ |
206 |
return retval; |
return retval; |
207 |
} |
} |
208 |
|
|
209 |
static int TryInlineStore(ILMethod *method, int numParams, |
static int TryInlineStore(ILExecProcess *process, ILMethod *method, int numParams, |
210 |
ILMethodCode *code, unsigned int *inlineOpcode, |
ILMethodCode *code, unsigned int *inlineOpcode, |
211 |
unsigned char **inlinePc, ILField **field) |
unsigned char **inlinePc, ILField **field) |
212 |
{ |
{ |
296 |
*inlinePc = pc; |
*inlinePc = pc; |
297 |
*inlineOpcode = opcode; |
*inlineOpcode = opcode; |
298 |
|
|
299 |
*field = GetFieldToken(method, pc); |
*field = GetFieldToken(process, method, pc); |
300 |
|
|
301 |
if (*field == 0) |
if (*field == 0) |
302 |
{ |
{ |
329 |
return V_INLINE_FIELD_STORE; |
return V_INLINE_FIELD_STORE; |
330 |
} |
} |
331 |
|
|
332 |
static int TryInlineMethod(ILMethod *method, |
static int TryInlineMethod(ILExecProcess *process, ILMethod *method, |
333 |
int numParams, unsigned int *inlineOpcode, |
int numParams, unsigned int *inlineOpcode, |
334 |
unsigned char **inlinePc, ILField **field) |
unsigned char **inlinePc, ILField **field) |
335 |
{ |
{ |
346 |
return 0; |
return 0; |
347 |
} |
} |
348 |
|
|
349 |
if ((retval = TryInlineLoad(method, numParams, &code, inlineOpcode, inlinePc, field))) |
if ((retval = TryInlineLoad(process, method, numParams, &code, inlineOpcode, inlinePc, field))) |
350 |
{ |
{ |
351 |
return retval; |
return retval; |
352 |
} |
} |
353 |
|
|
354 |
if ((retval = TryInlineStore(method, numParams, &code, inlineOpcode, inlinePc, field))) |
if ((retval = TryInlineStore(process, method, numParams, &code, inlineOpcode, inlinePc, field))) |
355 |
{ |
{ |
356 |
return retval; |
return retval; |
357 |
} |
} |
364 |
* is not NULL, then write the call site signature to it. If it is |
* is not NULL, then write the call site signature to it. If it is |
365 |
* NULL, then vararg method calls are disallowed. |
* NULL, then vararg method calls are disallowed. |
366 |
*/ |
*/ |
367 |
static ILMethod *GetMethodToken(ILMethod *method, unsigned char *pc, |
static ILMethod *GetMethodToken(ILExecProcess *process, ILMethod *method, |
368 |
ILType **callSiteSig) |
unsigned char *pc, ILType **callSiteSig) |
369 |
{ |
{ |
370 |
ILUInt32 token; |
ILUInt32 token; |
371 |
ILMethod *methodInfo; |
ILMethod *methodInfo; |
390 |
methodInfo = (ILMethod *)ILMemberResolve((ILMember *)methodInfo); |
methodInfo = (ILMethod *)ILMemberResolve((ILMember *)methodInfo); |
391 |
|
|
392 |
/* Make sure that the method's class has been laid out */ |
/* Make sure that the method's class has been laid out */ |
393 |
if(!_ILLayoutClass(ILMethod_Owner(methodInfo))) |
if(!_ILLayoutClass(process, ILMethod_Owner(methodInfo))) |
394 |
{ |
{ |
395 |
return 0; |
return 0; |
396 |
} |
} |
416 |
* is not NULL, then write the call site signature to it. If it is |
* is not NULL, then write the call site signature to it. If it is |
417 |
* NULL, then vararg method calls are disallowed. |
* NULL, then vararg method calls are disallowed. |
418 |
*/ |
*/ |
419 |
static ILMethod *GetConstructorToken(ILMethod *method, unsigned char *pc, |
static ILMethod *GetConstructorToken(ILExecProcess *process, ILMethod *method, |
420 |
ILType **callSiteSig) |
unsigned char *pc,ILType **callSiteSig) |
421 |
{ |
{ |
422 |
ILMethod *methodInfo = GetMethodToken(method, pc, callSiteSig); |
ILMethod *methodInfo = GetMethodToken(process, method, pc, callSiteSig); |
423 |
|
|
424 |
/* Bail out if no method found */ |
/* Bail out if no method found */ |
425 |
if(!methodInfo) |
if(!methodInfo) |
1382 |
/* Jump to another method with exactly the same set of arguments */ |
/* Jump to another method with exactly the same set of arguments */ |
1383 |
if(unsafeAllowed) |
if(unsafeAllowed) |
1384 |
{ |
{ |
1385 |
methodInfo = GetMethodToken(method, pc, (ILType **)0); |
methodInfo = GetMethodToken(_ILExecThreadProcess(thread), method, pc, (ILType **)0); |
1386 |
if(methodInfo && !ILMethod_IsAbstract(methodInfo)) |
if(methodInfo && !ILMethod_IsAbstract(methodInfo)) |
1387 |
{ |
{ |
1388 |
if(ILMemberAccessible((ILMember *)methodInfo, |
if(ILMemberAccessible((ILMember *)methodInfo, |
1419 |
case IL_OP_CALL: |
case IL_OP_CALL: |
1420 |
{ |
{ |
1421 |
/* Call a particular method directly */ |
/* Call a particular method directly */ |
1422 |
methodInfo = GetMethodToken(method, pc, &methodSignature); |
methodInfo = GetMethodToken(_ILExecThreadProcess(thread), method, pc, |
1423 |
|
&methodSignature); |
1424 |
if(methodInfo && !ILMethod_IsAbstract(methodInfo)) |
if(methodInfo && !ILMethod_IsAbstract(methodInfo)) |
1425 |
{ |
{ |
1426 |
if(ILMemberAccessible((ILMember *)methodInfo, ILMethod_Owner(method))) |
if(ILMemberAccessible((ILMember *)methodInfo, ILMethod_Owner(method))) |
1468 |
#endif |
#endif |
1469 |
/* Inlineable method code generated by ILCoderCallInlineable */ |
/* Inlineable method code generated by ILCoderCallInlineable */ |
1470 |
} |
} |
1471 |
else if ((tryInlineType = TryInlineMethod(methodInfo, numParams, |
else if ((tryInlineType = TryInlineMethod(_ILExecThreadProcess(thread), methodInfo, |
1472 |
&tryInlineOpcode, &tryInlinePc, &fieldInfo)) != 0) |
numParams, &tryInlineOpcode, &tryInlinePc, &fieldInfo)) != 0) |
1473 |
{ |
{ |
1474 |
#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) |
#if !defined(IL_CONFIG_REDUCE_CODE) && !defined(IL_WITHOUT_TOOLS) |
1475 |
if (coderFlags & IL_CODER_FLAG_STATS) |
if (coderFlags & IL_CODER_FLAG_STATS) |
1976 |
case IL_OP_CALLVIRT: |
case IL_OP_CALLVIRT: |
1977 |
{ |
{ |
1978 |
/* Call a virtual or interface method */ |
/* Call a virtual or interface method */ |
1979 |
methodInfo = GetMethodToken(method, pc, &methodSignature); |
methodInfo = GetMethodToken(_ILExecThreadProcess(thread), method, pc, &methodSignature); |
1980 |
if(methodInfo) |
if(methodInfo) |
1981 |
{ |
{ |
1982 |
classInfo = ILMethod_Owner(method); |
classInfo = ILMethod_Owner(method); |
2047 |
case IL_OP_NEWOBJ: |
case IL_OP_NEWOBJ: |
2048 |
{ |
{ |
2049 |
/* Create a new object and call its constructor */ |
/* Create a new object and call its constructor */ |
2050 |
methodInfo = GetConstructorToken(method, pc, &methodSignature); |
methodInfo = GetConstructorToken(_ILExecThreadProcess(thread), method, pc, |
2051 |
|
&methodSignature); |
2052 |
if(methodInfo) |
if(methodInfo) |
2053 |
{ |
{ |
2054 |
/* The construction sequence is different for objects and values */ |
/* The construction sequence is different for objects and values */ |
2151 |
case IL_OP_PREFIX + IL_PREFIX_OP_LDFTN: |
case IL_OP_PREFIX + IL_PREFIX_OP_LDFTN: |
2152 |
{ |
{ |
2153 |
/* Load the address of a function onto the stack as "I" */ |
/* Load the address of a function onto the stack as "I" */ |
2154 |
methodInfo = GetMethodToken(method, pc, (ILType **)0); |
methodInfo = GetMethodToken(_ILExecThreadProcess(thread), method, pc, |
2155 |
|
(ILType **)0); |
2156 |
if(methodInfo && !ILMethod_IsAbstract(methodInfo)) |
if(methodInfo && !ILMethod_IsAbstract(methodInfo)) |
2157 |
{ |
{ |
2158 |
if(ILMemberAccessible((ILMember *)methodInfo, ILMethod_Owner(method))) |
if(ILMemberAccessible((ILMember *)methodInfo, ILMethod_Owner(method))) |
2182 |
case IL_OP_PREFIX + IL_PREFIX_OP_LDVIRTFTN: |
case IL_OP_PREFIX + IL_PREFIX_OP_LDVIRTFTN: |
2183 |
{ |
{ |
2184 |
/* Load the address of a virtual function onto the stack as "I" */ |
/* Load the address of a virtual function onto the stack as "I" */ |
2185 |
methodInfo = GetMethodToken(method, pc, (ILType **)0); |
methodInfo = GetMethodToken(_ILExecThreadProcess(thread), method, pc, |
2186 |
|
(ILType **)0); |
2187 |
if(methodInfo && STK_UNARY == ILEngineType_O) |
if(methodInfo && STK_UNARY == ILEngineType_O) |
2188 |
{ |
{ |
2189 |
classInfo = ILMethod_Owner(methodInfo); |
classInfo = ILMethod_Owner(methodInfo); |