Skip to content

Commit

Permalink
[GR-40742] Fix for DebuggerSession clearFrame with static slots.
Browse files Browse the repository at this point in the history
PullRequest: graal/12602
  • Loading branch information
flohuemer committed Sep 27, 2022
2 parents c587ba0 + e71473e commit 90b3dd0
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
Expand Up @@ -1140,7 +1140,11 @@ private static void clearFrame(RootNode root, MaterializedFrame frame) {
// Clear only those frames that correspond to the current root
Object value = descriptor.getDefaultValue();
for (int slot = 0; slot < descriptor.getNumberOfSlots(); slot++) {
frame.setObject(slot, value);
if (frame.isStatic(slot)) {
frame.setObjectStatic(slot, value);
} else {
frame.setObject(slot, value);
}
}
for (int slot = 0; slot < descriptor.getNumberOfAuxiliarySlots(); slot++) {
frame.setAuxiliarySlot(slot, null);
Expand Down
Expand Up @@ -61,6 +61,7 @@
import java.util.WeakHashMap;
import java.util.concurrent.ConcurrentHashMap;

import com.oracle.truffle.api.frame.FrameSlotKind;
import com.oracle.truffle.api.frame.MaterializedFrame;
import org.junit.Assert;

Expand Down Expand Up @@ -253,6 +254,13 @@ protected InstrumentContext createContext(TruffleLanguage.Env env) {

private CallTarget lastParsed;

private static FrameDescriptor getDefaultFrameDescriptor() {
FrameDescriptor.Builder builder = FrameDescriptor.newBuilder();
builder.addSlot(FrameSlotKind.Static, null, null);
builder.addSlot(FrameSlotKind.Int, null, null);
return builder.build();
}

public static CallTarget getLastParsedCalltarget() {
return InstrumentationTestLanguage.get(null).lastParsed;
}
Expand Down Expand Up @@ -637,7 +645,7 @@ protected InstrumentationTestRootNode(InstrumentationTestLanguage lang, String n
}

protected InstrumentationTestRootNode(InstrumentationTestLanguage lang, String name, SourceSection sourceSection, RootCallTarget afterTarget, BaseNode... expressions) {
super(lang);
super(lang, getDefaultFrameDescriptor());
this.name = name;
this.sourceSection = sourceSection;
this.afterTarget = afterTarget;
Expand Down

0 comments on commit 90b3dd0

Please sign in to comment.