Skip to content
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

Clear lower half of two-slot value when upper half is not live #157

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 @@ -659,14 +659,25 @@ public void clearNonLiveLocals(BciBlock block, LocalLiveness liveness, boolean l
if (liveIn) {
for (int i = 0; i < locals.length; i++) {
if (!liveness.localIsLiveIn(block, i)) {
assert locals[i] != TWO_SLOT_MARKER || locals[i - 1] == null : "Clearing of second slot must have cleared the first slot too";
if (locals[i] == TWO_SLOT_MARKER) {
/*
* Clearing a slot is equivalent to a storeLocal() of that slot: if the old
* value is the upper half of a two-slot value, both slots need to be
* cleared. The liveness analysis cannot detect these cases and also mark
* the previous slot as non-live because at the beginning / end of the block
* the slot at index i - 1 can be occupied by a live single-slot value.
*/
locals[i - 1] = null;
}
locals[i] = null;
}
}
} else {
for (int i = 0; i < locals.length; i++) {
if (!liveness.localIsLiveOut(block, i)) {
assert locals[i] != TWO_SLOT_MARKER || locals[i - 1] == null : "Clearing of second slot must have cleared the first slot too";
if (locals[i] == TWO_SLOT_MARKER) {
locals[i - 1] = null;
}
locals[i] = null;
}
}
Expand Down