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

Keep truffle runtime now that its' footprint is minimal #369

Closed
wants to merge 1 commit into from

Conversation

zakkak
Copy link
Collaborator

@zakkak zakkak commented Oct 3, 2023

This change only increases the Mandrel installation by 1MB, while allowing users to use Truffle maven artifacts.

However it comes at the cost of the following build-time dependencies:

  • ANTLR4
  • TRUFFLE_ASM
  • TRUFFLE_JCODINGS

Unfortunately, dropping these dependencies results in build failures, as expected. As a result IMO it's not worth the effort as it's not a priority for us. @jerboaa WDYT?

This change only increases the Mandrel installation by 1MB, while
allowing users to use Truffle maven artifacts.

However it comes at the cost of the following build-time dependencies:

- ANTLR4
- TRUFFLE_ASM
- TRUFFLE_JCODINGS

Unfortunately, dropping these dependencies results in build failures, as
expected.
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Oct 3, 2023
@jerboaa
Copy link
Collaborator

jerboaa commented Oct 3, 2023

However it comes at the cost of the following build-time dependencies:

* ANTLR4
* TRUFFLE_ASM
* TRUFFLE_JCODINGS

Unfortunately, dropping these dependencies results in build failures, as expected. As a result IMO it's not worth the effort as it's not a priority for us. @jerboaa WDYT?

Let me try to sound-board this. Right now, we don't support truffle-runtime. If we were to include truffle-runtime, then we'd depend on antlr4, truffle-asm, truffle-jcodings? Did I get this correct?

If I did understand this correctly, then those dependencies are not worth the trouble of <insert-benefit-here\>. We haven't needed it in the past and packaging those dependencies is a can of worms I'd rather not open.

Is the plan to get this merged?

@zakkak
Copy link
Collaborator Author

zakkak commented Oct 3, 2023

You got it right.

No the plan is to not merge it. I opened it as draft to have in record what we tried and why we don't want it (at least for now). I am closing it.

@zakkak zakkak closed this Oct 3, 2023
@jerboaa
Copy link
Collaborator

jerboaa commented Oct 3, 2023

Thanks for the clarification.

@chumer
Copy link
Member

chumer commented Oct 10, 2023

@zakkak let me know if I can help with the truffle svm runtime integration in Mandrel. Its definitely much easier now to integrate truffle in the new unchained world since 23.1. All you basically need to keep is the truffle-svm-runtime.jar and the truffle-svm macro. You should not add it to the builder class-path always as it has a lot of dependencies we can only resolve if truffle-runtime.jar is on the class or module-path.

The way this works is that if truffle-runtime.jar is on the class or module-path it activates the truffle-svm macro.
The macro looks like this in a GraalVM JDK:

ImageModulePath = ${.}/../../../truffle/builder/truffle-runtime-svm.jar
Args = -H:CLibraryPath=${.}/builder
IgnoreIfBuilderOnClasspath = true

Customizing this allows you to put the truffle-runtime-svm.jar anywhere you want. You just should not put it on the builder class-path by default as it requires a lot of dependencies regular applications don't have.

@zakkak
Copy link
Collaborator Author

zakkak commented Oct 16, 2023

@chumer thanks for looking into this.

Our main issue is that in order to build truffle-svm-runtime.jar we need the following two dependencies that are truffle specific (and thus not in our internal build chain):

  • TRUFFLE_ASM
  • TRUFFLE_JCODINGS

If we could use the original ASM and JCODINGS it would allow us to build without issues AFAIU.

@chumer
Copy link
Member

chumer commented Oct 17, 2023

@zakkak you should be able to use the 23.1 (or latest LTS) of truffle and its dependencies from Maven central to build truffle-svm-runtime.jar. We are currently considering to move to a build like this internally by default. No decision yet.

@jerboaa
Copy link
Collaborator

jerboaa commented Oct 18, 2023

you should be able to use the 23.1 (or latest LTS) of truffle and its dependencies from Maven central to build truffle-svm-runtime.jar.

We build everything from source, so an external dependency from Maven central is not possible for us.

@chumer
Copy link
Member

chumer commented Oct 18, 2023

@jerboaa you only need it to compile you don't need to ship any of these things.

@jerboaa
Copy link
Collaborator

jerboaa commented Oct 18, 2023

@chumer Since it's a compile time dependency, we need to build the compile time deps from source too. That's the trouble.

@chumer
Copy link
Member

chumer commented Oct 19, 2023

@jerboaa we could use the new mx builtin auto-shader based on the original ASM and JCODINGS dependencies that we already use for ICU4J. Would that work? Feel free to open an issue for us then.

@m4ttek
Copy link

m4ttek commented Dec 19, 2023

Hi,

are there any plans on making truffle work in native-image with mandrel? I'm getting an error while trying to build a project using it:

Error: Processing jar:file:///home/mkaminski/work/exec-engine/build/exec-engine-0.1.0-SNAPSHOT-native-image-source-jar/lib/org.graalvm.truffle.truffle-api-23.1.1.jar!/META-INF/native-image/org.graalvm.truffle/native-image.properties failed
Caused by: com.oracle.svm.driver.NativeImage$NativeImageError: Unknown name in option specification: macro:truffle-svm

@jerboaa
Copy link
Collaborator

jerboaa commented Dec 20, 2023

are there any plans on making truffle work in native-image with mandrel?

No, sorry. There are no plans on supporting that. Use GraalVM for JDK 21 instead.

@zakkak
Copy link
Collaborator Author

zakkak commented Dec 20, 2023

@jerboaa we could use the new mx builtin auto-shader based on the original ASM and JCODINGS dependencies that we already use for ICU4J. Would that work? Feel free to open an issue for us then.

I think that could work, will give it a try.

FTR the referenced code above is https://github.com/oracle/graal/blame/d5f2e7c44a2f9c123d78d0dcffa1c096152d6286/truffle/mx.truffle/suite.py#L1088 (since the original link is not a permanent one)

Disclaimer: This doesn't mean we plan to support Truffle, we are just experimenting at this stage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCA Verified All contributors have signed the Oracle Contributor Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants