Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.

Commit b18ea9c

Browse files
authored
Keep tokenScope consistent during devirtualization (#26453)
Previously, when we were constructing the CORINFO_RESOLVED_TOKEN to represent a devirtualized method, we reused the previous tokenScope so that the tokenScope effectively went out of sync with the token value. Based on Andy's advice I have changed this logic to update the tokenScope by calling the JIT interface method getMethodModule for the resolved virtual method. I have verified locally that (with a bit of counterpart CPAOT changes) this logic fixes the bug I was previously hitting due to this inconsistency. Thanks Tomas
1 parent 8727b61 commit b18ea9c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/jit/importer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20460,7 +20460,7 @@ void Compiler::impDevirtualizeCall(GenTreeCall* call,
2046020460
// First, cons up a suitable resolved token.
2046120461
CORINFO_RESOLVED_TOKEN derivedResolvedToken = {};
2046220462

20463-
derivedResolvedToken.tokenScope = info.compScopeHnd;
20463+
derivedResolvedToken.tokenScope = info.compCompHnd->getMethodModule(derivedMethod);
2046420464
derivedResolvedToken.tokenContext = *contextHandle;
2046520465
derivedResolvedToken.token = info.compCompHnd->getMethodDefFromMethod(derivedMethod);
2046620466
derivedResolvedToken.tokenType = CORINFO_TOKENKIND_Method;

0 commit comments

Comments
 (0)