-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[Wasm RyuJIT] Wire up GC info encoding/decoding for Wasm #126932
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
f321cad
bca4138
128513c
80ea3c7
620f655
c6ecb28
822a005
02ce8d6
2446960
e46009f
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 |
|---|---|---|
|
|
@@ -854,7 +854,9 @@ bool CodeGen::genIsSameLocalVar(GenTree* op1, GenTree* op2) | |
| // inline | ||
| void CodeGenInterface::genUpdateRegLife(const LclVarDsc* varDsc, bool isBorn, bool isDying DEBUGARG(GenTree* tree)) | ||
| { | ||
| #if EMIT_GENERATE_GCINFO // The regset being updated here is only needed for codegen-level GCness tracking | ||
| #if EMIT_GENERATE_GCINFO && !defined(TARGET_WASM) | ||
| // The regset being updated here is only needed for codegen-level GCness tracking, | ||
| // and Wasm does not have registers | ||
| regMaskTP regMask = genGetRegMask(varDsc); | ||
|
|
||
| #ifdef DEBUG | ||
|
|
@@ -884,7 +886,7 @@ void CodeGenInterface::genUpdateRegLife(const LclVarDsc* varDsc, bool isBorn, bo | |
| assert(varDsc->IsAlwaysAliveInMemory() || ((regSet.GetMaskVars() & regMask) == 0)); | ||
| regSet.AddMaskVars(regMask); | ||
| } | ||
| #endif // EMIT_GENERATE_GCINFO | ||
| #endif // EMIT_GENERATE_GCINFO && !TARGET_WASM | ||
| } | ||
|
|
||
| #ifndef TARGET_WASM | ||
|
|
@@ -1032,6 +1034,7 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife) | |
| bool isByRef = varDsc->TypeIs(TYP_BYREF); | ||
| bool isInReg = varDsc->lvIsInReg(); | ||
| bool isInMemory = !isInReg || varDsc->IsAlwaysAliveInMemory(); | ||
| #ifndef TARGET_WASM | ||
| if (isInReg) | ||
| { | ||
| // TODO-Cleanup: Move the code from compUpdateLifeVar to genUpdateRegLife that updates the | ||
|
|
@@ -1047,7 +1050,8 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife) | |
| } | ||
| codeGen->genUpdateRegLife(varDsc, false /*isBorn*/, true /*isDying*/ DEBUGARG(nullptr)); | ||
| } | ||
| // Update the gcVarPtrSetCur if it is in memory. | ||
| #endif // !TARGET_WASM | ||
| // Update the gcVarPtrSetCur if it is in memory. | ||
| if (isInMemory && (isGCRef || isByRef)) | ||
| { | ||
| VarSetOps::RemoveElemD(this, codeGen->gcInfo.gcVarPtrSetCur, deadVarIndex); | ||
|
Comment on lines
+1053
to
1057
|
||
|
|
@@ -1070,6 +1074,7 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife) | |
| bool isByRef = varDsc->TypeIs(TYP_BYREF); | ||
| if (varDsc->lvIsInReg()) | ||
| { | ||
| #ifndef TARGET_WASM | ||
| // If this variable is going live in a register, it is no longer live on the stack, | ||
| // unless it is an EH/"spill at single-def" var, which always remains live on the stack. | ||
| if (!varDsc->IsAlwaysAliveInMemory()) | ||
|
|
@@ -1092,6 +1097,7 @@ void Compiler::compChangeLife(VARSET_VALARG_TP newLife) | |
| { | ||
| codeGen->gcInfo.gcRegByrefSetCur |= regMask; | ||
| } | ||
| #endif // !TARGET_WASM | ||
| } | ||
| else if (lvaIsGCTracked(varDsc)) | ||
| { | ||
|
|
@@ -1769,7 +1775,7 @@ void CodeGen::genExitCode(BasicBlock* block) | |
|
|
||
| genIPmappingAdd(IPmappingDscKind::Epilog, DebugInfo(), true); | ||
|
|
||
| #if EMIT_GENERATE_GCINFO && defined(DEBUG) | ||
| #if EMIT_GENERATE_GCINFO && defined(DEBUG) && !defined(TARGET_WASM) | ||
| // For returnining epilogs do some validation that the GC info looks right. | ||
| if (!block->HasFlag(BBF_HAS_JMP)) | ||
| { | ||
|
|
@@ -1791,7 +1797,7 @@ void CodeGen::genExitCode(BasicBlock* block) | |
| } | ||
| } | ||
| } | ||
| #endif // EMIT_GENERATE_GCINFO && defined(DEBUG) | ||
| #endif // EMIT_GENERATE_GCINFO && defined(DEBUG) && !defined(TARGET_WASM) | ||
|
|
||
| if (m_compiler->getNeedsGSSecurityCookie()) | ||
| { | ||
|
|
@@ -2418,11 +2424,6 @@ void CodeGen::genEmitMachineCode() | |
| // | ||
| void CodeGen::genEmitUnwindDebugGCandEH() | ||
| { | ||
| #ifdef TARGET_WASM | ||
| // TODO-WASM: Fix this phase causing an assertion failure even for methods with no GC locals or EH clauses | ||
| return; | ||
| #endif | ||
|
|
||
| /* Now that the code is issued, we can finalize and emit the unwind data */ | ||
|
|
||
| m_compiler->unwindEmit(*codePtr, coldCodePtr); | ||
|
|
@@ -7245,7 +7246,7 @@ void CodeGen::genReturn(GenTree* treeNode) | |
| } | ||
| } | ||
|
|
||
| #if EMIT_GENERATE_GCINFO | ||
| #if EMIT_GENERATE_GCINFO && !defined(TARGET_WASM) | ||
| if (treeNode->OperIs(GT_RETURN, GT_SWIFT_ERROR_RET)) | ||
| { | ||
| genMarkReturnGCInfo(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.