Skip to content

[GR-64701] Re-parse graphs in OptimizeLongJumpsTest. #11132

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

Merged
merged 1 commit into from
May 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ private void testOptimizeLongJumps(String method, OptionValues opts, Object... p
* Why using a loop: The optimization is considered successful, if there are fewer
* jmp/jcc instructions compared to the unoptimized code. To assert this condition,
* checkCode counts long jump / jcc opcodes in the raw code byte arrays. Thus, under
* rare circumstances, bytes from constants, displacements, etc can "look" like the
* rare circumstances, bytes from constants, displacements, etc. can "look" like the
* opcodes we are searching for which can lead to false counts. If the success condition
* does not hold, we redo the code emits trying to rule out false positives and only
* fail if the success condition does not hold repeatedly.
Expand All @@ -111,10 +111,13 @@ private void testOptimizeLongJumps(String method, OptionValues opts, Object... p
codeOptimized = getCode(graphOptimized.method(), graphOptimized, true, true, optionsOptimized);
Object resultOptimized = codeOptimized.executeVarargs(params);

assertTrue(String.format("Optimized code should behave identically! Result (default): %d | Result (optimized): %d", resultDefault, resultOptimized), resultDefault.equals(resultOptimized));
assertTrue(String.format("Optimized code should behave identically! Result (default): %s | Result (optimized): %s", resultDefault, resultOptimized), resultDefault.equals(resultOptimized));
if (checkCode(codeDefault, codeOptimized)) {
return;
}

graphDefault = parseEager(method, AllowAssumptions.NO, optionsDefault);
graphOptimized = parseEager(method, AllowAssumptions.NO, optionsOptimized);
}
fail(String.format("Optimized code should have fewer long jumps!\n\tDefault code: %s\n\tOptimized code: %s", byteArrayToHexArray(codeDefault.getCode()),
byteArrayToHexArray(codeOptimized.getCode())));
Expand Down
Loading