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

aot suggested fixes #574

Merged
merged 1 commit into from
Oct 13, 2024
Merged

aot suggested fixes #574

merged 1 commit into from
Oct 13, 2024

Conversation

andreaTP
Copy link
Collaborator

At Devoxx I had the pleasure to meet @forax , he is one of the maintainer of the ASM library we are using in the AOT compiler and suggested those fixes.

@@ -367,13 +367,13 @@ private byte[] compileClass(String className, FunctionSection functions) {
var classWriter = new ClassWriter(ClassWriter.COMPUTE_FRAMES);
classWriter.visit(
Opcodes.V11,
Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL,
Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL | Opcodes.ACC_SUPER,
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Apparently, compatibility with project Leyden.

Copy link

Choose a reason for hiding this comment

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

Not Leyden, Valhalla. In Valhalla, if you have a class without ACC_SUPER (renamed ACC_IDENTITY), you are creating a value class. See https://bugs.openjdk.org/browse/JDK-8317278

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Many thanks for the explanation!

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm guessing this doesn't matter was we're currently generating V11 classes, but good to fix for the future!

internalClassName,
null,
getInternalName(Object.class),
new String[] {getInternalName(Machine.class)});

classWriter.visitSource("wasm", "wasm");
classWriter.visitSource(null, null);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Better to leave those fields empty than using dummy values.

Copy link
Collaborator

Choose a reason for hiding this comment

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

The second argument seems wrong for sure. The first one causes stack traces to include wasm, which seems useful, but I don't know if there are downsides. If @forax says we should remove it, then let's remove it!

Copy link

Choose a reason for hiding this comment

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

As electrum said, for me, it should be

classWriter.visitSource("wasm", null);

so you get "wasm" printed in the stacktraces.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, I have nothing against, my reasoning was:
"better to not provide anything than a wrong fileName that the IDE will try to resolve".

But the IDE is still broken in either cases, so I just opened #576 to track it as a separate issue.

Thanks everyone for the feedback, much appreciated!

internalClassName,
null,
getInternalName(Object.class),
new String[] {getInternalName(Machine.class)});

classWriter.visitSource("wasm", "wasm");
classWriter.visitSource(null, null);
Copy link
Collaborator

Choose a reason for hiding this comment

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

We can simply remove this call, as calling with null won't do anything.

@andreaTP andreaTP force-pushed the forax-fixes2 branch 3 times, most recently from 752fe05 to c4e2c87 Compare October 13, 2024 10:33
@andreaTP andreaTP merged commit 98ecd00 into dylibso:main Oct 13, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants