-
Notifications
You must be signed in to change notification settings - Fork 10
Fix panic in p_block when all control-point live values are globals #2167
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
Open
Pavel-Durov
wants to merge
7
commits into
ykjit:master
Choose a base branch
from
Pavel-Durov:fix-no-arg-trace-when-all-globals
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
1b987e8
Fix panic in p_block when all control-point live values are globals
Pavel-Durov 0699fb1
Update test.
Pavel-Durov 092ed86
Update ykllvm.
Pavel-Durov da43f7e
Merge branch 'fix-no-arg-trace-when-all-globals' of github.com:Pavel-…
Pavel-Durov 6d82a46
Merge branch 'opt-indirect-fn-notrace-fastpath' into fix-no-arg-trace…
Pavel-Durov 947dc7b
Add assert on load const in trace.
Pavel-Durov 1bd60c7
Merge branch 'master' into fix-no-arg-trace-when-all-globals
Pavel-Durov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| // Run-time: | ||
| // env-var: YKD_LOG=4 | ||
| // env-var: YKD_SERIALISE_COMPILATION=1 | ||
| // stderr: | ||
| // yk-tracing: start-tracing | ||
| // ... | ||
| // yk-tracing: stop-tracing | ||
| // ... | ||
| // yk-execution: enter-jit-code | ||
| // ... | ||
|
|
||
| // Testing that when all interpreter state is in globals the JIT produces | ||
| // a trace block with no Arg instructions. | ||
| // Previously this caused an unconditional panic in p_block. | ||
|
|
||
| #include <stdlib.h> | ||
| #include <yk.h> | ||
| #include <yk_testing.h> | ||
|
|
||
| long g_pc = 0; | ||
| YkMT *g_mt = NULL; | ||
| YkLocation i; | ||
|
|
||
| __attribute__((yk_outline)) static void debug_fn(void) {} | ||
|
|
||
| int main(void) { | ||
| g_mt = yk_mt_new(NULL); | ||
| yk_mt_hot_threshold_set(g_mt, 0); | ||
| yk_mt_sidetrace_threshold_set(g_mt, 4); | ||
| i = yk_location_new(); | ||
|
|
||
| for (; g_pc < 20; g_pc++) { | ||
| yk_mt_control_point(g_mt, &i); | ||
| debug_fn(); | ||
| if (g_pc > 15) { | ||
| break; | ||
| } | ||
| } | ||
|
|
||
| yk_location_drop(i); | ||
| yk_mt_shutdown(g_mt); | ||
| return EXIT_SUCCESS; | ||
| } | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
AFAICS this test doesn't prove it's testing what it claims. I think we would need to have IR in here and check that there are no
arginstructions.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test triggers that panic in a trace https://github.com/ykjit/yk/blob/master/ykrt/src/compile/j2/hir_to_asm.rs#L866
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current test all interpreter state (
g_pc,g_mt,i) are set as globals, so the control point safepoint records no live locals:In Contrast, if
g_pcis moved from a global to a local declared insidemainit assigns it a shadow stack slot and it appears as a live variable:Produced IR:
%0_6is live at the control point and yk emits anArginstruction.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What I mean is: the C code might show this but the lang_tester test doesn't prove this. We'd need
YKD_LOG_IR=jitand then guarantee that has noargs in it.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok got it!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated 0699fb1