Skip to content

Showcase how to dump locals info via debuginfo #4227

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
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

graalvmbot
Copy link
Collaborator

No description provided.

@@ -278,6 +284,48 @@ public String toString() {
return String.format("-%s, span %d, bci %d, method %s", getPosStr(), getSpan(), frame.getBCI(), frame.getMethod().format("%h.%n(%p)"));
}

public String getLocalsStr() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@adinn this is a hopefully more correct example code how to get locals info for the CompilationResultFrameTree

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@olpaw Thanks. I'll work that into something that communicates the frame tree content to the debug info generation code.

Local[] locals = lvt.getLocals();
if (locals != null && locals.length > 0) {
nonEmptySortedLocals = Arrays.copyOf(locals, locals.length);
Arrays.sort(nonEmptySortedLocals, (Local l1, Local l2) -> l1.getSlot() - l2.getSlot());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arrays.sort(nonEmptySortedLocals, Comparator.comparingInt(Local::getSlot)); is clearly more elegant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants