-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Fix / disable several coreclr tests with interpreter #121492
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
951dfdd
40e30a4
7ee21e4
a1adeff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1002,6 +1002,10 @@ void ValidateEmittedSequenceTermination(InterpInst *lastIns) | |
|
|
||
| if (InterpOpIsUncondBranch(lastIns->opcode) || | ||
| (lastIns->opcode == INTOP_RET) || | ||
| (lastIns->opcode == INTOP_RET_I1) || | ||
| (lastIns->opcode == INTOP_RET_U1) || | ||
| (lastIns->opcode == INTOP_RET_I2) || | ||
| (lastIns->opcode == INTOP_RET_U2) || | ||
| (lastIns->opcode == INTOP_RET_VOID) || | ||
| (lastIns->opcode == INTOP_RET_VT) || | ||
| (lastIns->opcode == INTOP_THROW) || | ||
|
|
@@ -2654,7 +2658,7 @@ void InterpCompiler::EmitBinaryArithmeticOp(int32_t opBase) | |
| } | ||
| } | ||
| } | ||
| else if (opBase == INTOP_SUB_I4 && type1 == StackTypeByRef) | ||
| else if (opBase == INTOP_SUB_I4 && ((type1 == StackTypeByRef) || (type2 == StackTypeByRef))) | ||
| { | ||
| if (type2 == StackTypeI4) | ||
| { | ||
|
|
@@ -2864,6 +2868,18 @@ static int32_t GetLdindForType(InterpType interpType) | |
| return -1; | ||
| } | ||
|
|
||
| static int32_t GetRetForType(InterpType interpType) | ||
| { | ||
| switch (interpType) | ||
| { | ||
| case InterpTypeI1: return INTOP_RET_I1; | ||
| case InterpTypeU1: return INTOP_RET_U1; | ||
| case InterpTypeI2: return INTOP_RET_I2; | ||
| case InterpTypeU2: return INTOP_RET_U2; | ||
| default: return INTOP_RET; | ||
| } | ||
| } | ||
|
|
||
| static bool DoesValueTypeContainGCRefs(COMP_HANDLE compHnd, CORINFO_CLASS_HANDLE clsHnd) | ||
| { | ||
| unsigned size = compHnd->getClassSize(clsHnd); | ||
|
|
@@ -4573,7 +4589,8 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re | |
| if (injectRet) | ||
| { | ||
| // Jmp to PInvoke was converted to normal pinvoke, so we need to inject a ret after the call | ||
| switch (GetInterpType(callInfo.sig.retType)) | ||
| InterpType retType = GetInterpType(m_methodInfo->args.retType); | ||
| switch (retType) | ||
| { | ||
| case InterpTypeVT: | ||
| { | ||
|
|
@@ -4586,7 +4603,7 @@ void InterpCompiler::EmitCall(CORINFO_RESOLVED_TOKEN* pConstrainedToken, bool re | |
| AddIns(INTOP_RET_VOID); | ||
| break; | ||
| default: | ||
| AddIns(INTOP_RET); | ||
| AddIns(GetRetForType(retType)); | ||
| m_pLastNewIns->SetSVar(dVar); | ||
| break; | ||
| } | ||
|
|
@@ -4710,8 +4727,24 @@ void InterpCompiler::EmitStind(InterpType interpType, CORINFO_CLASS_HANDLE clsHn | |
| m_pStackPointer -= 2; | ||
| } | ||
|
|
||
| void InterpCompiler::EmitNintIndexCheck(StackInfo *spArray, StackInfo *spIndex) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Related comment #120981 (comment)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should fix it too, but for that one, I think we can create new versions of the INTOP_NEWARR / INTOP_NEWARR_GENERIC, there is no opcode explosion issue like with the array accesses. I'll create an issue for it.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Created #121507 |
||
| { | ||
| // In the rare case when array is indexed by nint instead of int, we emit an extra check | ||
| // to ensure the nint value fits in int32_t | ||
| AddIns(INTOP_CONV_NI); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If the array is itself NULL, we need to be throwing NullReferenceException instead of IndexOutOfRangeException. This needs both the array and the index to pull that off.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I assumed this would be handled by the actual array access, wouldn't it?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, got it, the NullReferenceException would need to have precedence. |
||
| m_pLastNewIns->SetSVars2(spArray->var, spIndex->var); | ||
| int32_t var = CreateVarExplicit(g_interpTypeFromStackType[StackTypeI4], NULL, INTERP_STACK_SLOT_SIZE); | ||
| new (spIndex) StackInfo(StackTypeI4, NULL, var); | ||
| m_pLastNewIns->SetDVar(var); | ||
| } | ||
|
|
||
| void InterpCompiler::EmitLdelem(int32_t opcode, InterpType interpType) | ||
| { | ||
| // handle nint index case | ||
| if (m_pStackPointer[1].GetStackType() == StackTypeI8) | ||
| { | ||
| EmitNintIndexCheck(m_pStackPointer - 2, m_pStackPointer - 1); | ||
| } | ||
| m_pStackPointer -= 2; | ||
| AddIns(opcode); | ||
| m_pLastNewIns->SetSVars2(m_pStackPointer[0].var, m_pStackPointer[1].var); | ||
|
|
@@ -4721,6 +4754,12 @@ void InterpCompiler::EmitLdelem(int32_t opcode, InterpType interpType) | |
|
|
||
| void InterpCompiler::EmitStelem(InterpType interpType) | ||
| { | ||
| // handle nint index case | ||
| if (m_pStackPointer[-2].GetStackType() == StackTypeI8) | ||
| { | ||
| EmitNintIndexCheck(m_pStackPointer - 3, m_pStackPointer - 2); | ||
| } | ||
|
|
||
| m_pStackPointer[-1].BashStackTypeToI_ForLocalVariableAddress(); | ||
| #ifdef TARGET_64BIT | ||
| // nint and int32 can be used interchangeably. Add implicit conversions. | ||
|
|
@@ -6121,7 +6160,7 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo) | |
| } | ||
| } | ||
|
|
||
| AddIns(INTOP_RET); | ||
| AddIns(GetRetForType(retType)); | ||
| m_pStackPointer--; | ||
| m_pLastNewIns->SetSVar(m_pStackPointer[0].var); | ||
| } | ||
|
|
@@ -8346,6 +8385,13 @@ void InterpCompiler::GenerateCode(CORINFO_METHOD_INFO* methodInfo) | |
| CorInfoType elemCorType = m_compHnd->asCorInfoType(elemClsHnd); | ||
|
|
||
| m_pStackPointer -= 2; | ||
|
|
||
| // handle nint index | ||
| if (m_pStackPointer[1].GetStackType() == StackTypeI8) | ||
| { | ||
| EmitNintIndexCheck(m_pStackPointer, m_pStackPointer + 1); | ||
| } | ||
|
|
||
| if ((elemCorType == CORINFO_TYPE_CLASS) && !readonly) | ||
| { | ||
| CORINFO_GENERICHANDLE_RESULT embedInfo; | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.