Fix incorrect OtherContextException wrapper when the exception comes back to its creator context#13454
Open
eregon wants to merge 3 commits intooracle:masterfrom
Open
Fix incorrect OtherContextException wrapper when the exception comes back to its creator context#13454eregon wants to merge 3 commits intooracle:masterfrom
eregon wants to merge 3 commits intooracle:masterfrom
Conversation
…back to its creator context
eregon
commented
May 1, 2026
Comment on lines
+193
to
194
| // TODO: Should the last arg be valueContext like in migrateValue? | ||
| throw new OtherContextException(receiverContext, other.delegate, other.delegateContext); |
Contributor
Author
There was a problem hiding this comment.
migrateValue() does:
(in migrateValue(), this == receiverContext)
Which is correct?
I'm not sure what the receiverContext is for, wouldn't only tracking the delegateContext be enough?
Is it because the OtherContextGuestObject/OtherContextException objects need to belong to one context and not many? (if so, is that needed?)
Member
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #13453
Testing
I tried to write a test for this in
truffle/src/com.oracle.truffle.api.instrumentation.test/src/com/oracle/truffle/api/instrumentation/test/TruffleContextTest.javabut didn't find a way to pass the outer exception in a lambda to the inner context and call it from there.The existing tests look confusing to me, lines like
result = InteropLibrary.getUncached().execute(result, outerObject);seem rather obscure.I would appreciate if you can write the test or help me find out how to pass the exception between the different contexts.
I do have tests in TruffleRuby for this: https://github.com/truffleruby/truffleruby/pull/4235/changes
I confirm this PR fixes #13453, as in those tests fail without and pass with this PR.
Documentation
No documentation updates are needed.
Contributor Checklist