Skip to content

Conversation

JaroslavTulach
Copy link
Member

@JaroslavTulach JaroslavTulach commented Jul 14, 2025

Pull Request Description

Making EpbLanguage the central place to deal with foreign and polyglot Enso statements. Moving all the JVM class loading functionality into runtime-language-epb module. Being a language, the EpbLanguage is better suited for entering/leaving TruffleContext instances than regular code that only uses org.graalvm.polyglot API.

Opt-in with polyglot.enso.classLoading=guest for this dual JVM execution mode. Use for example:

$ ENSO_LAUNCHER=native,-ls,fast sbt
sbt:enso> runEngineDistribution --vm.D=polyglot.enso.classLoading=guest --run test/Generic_JDBC_Tests
22 tests succeeded.
0 tests failed.
0 tests skipped.
0 groups skipped.

to execute 100% test/Generic_JDBC_Tests in this dual JVM execution mode. Subsequent PRs will continue towards making this execution mode the default.

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

@JaroslavTulach JaroslavTulach self-assigned this Jul 14, 2025
@JaroslavTulach JaroslavTulach added the CI: No changelog needed Do not require a changelog entry for this PR. label Jul 14, 2025
@enso-bot
Copy link

enso-bot bot commented Jul 18, 2025

Jaroslav Tulach reports a new STANDUP for yesterday (2025-07-17):

Progress: .

GitHub
Enso Analytics is a self-service data prep and analysis platform designed for data teams. - enso-org/enso

@JaroslavTulach
Copy link
Member Author

With 67d8c11 I see to be able to change the Generic_JDBC_Tests to:

enso$ ENSO_LAUNCHER=native,-ls,fast sbt buildEngineDistribution
enso$ ./enso --vm.D=polyglot.enso.classLoading=guest --run test/Generic_JDBC_Tests/

20 tests succeeded.
2 tests failed.
0 tests skipped.
0 groups skipped.

Failed tests: 'should.handle.SQL.errors'

e.g. the dual JVM mode is almost working for Generic_JDBC_Tests in native image mode.

@enso-bot
Copy link

enso-bot bot commented Jul 19, 2025

Jaroslav Tulach reports a new STANDUP for yesterday (2025-07-18):

Progress: .

Discord
Discord is great for playing games and chilling with friends, or even building a worldwide community. Customize your own space to talk, play, and hang out.

import org.junit.After;
import org.junit.Test;

/**
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd like to point attention of everyone and primarily libraries team, e.g. @jdunkerley, @GregoryTravis, @AdRiley to this test.

  • should there be any inconsistencies between hosted mode (used so far) and guest mode (the dual JVM mode), then this suite will demonstrate them
  • add a new @Test into this JavaInteropTest file
  • execute as runtime-integration-tests/testOnly *JavaInteropTest
  • the test gets executed in both configurations
  • failing in one of the configurations nicely demonstrates differences in implementation

Please remind yourself of this testing infrastructure when you see misbehavior of polyglot java import with/without --jvm mode or in dual JVM mode. Should you have any questions, please ask now or in the future.

@JaroslavTulach JaroslavTulach changed the title Moving the Java loading functionality into EpbLanguage Moving polyglot java import handling functionality into EpbLanguage Jul 19, 2025
@JaroslavTulach JaroslavTulach changed the title Moving polyglot java import handling functionality into EpbLanguage Moving polyglot java import handling into EpbLanguage Jul 19, 2025
@JaroslavTulach JaroslavTulach added the CI: Clean build required CI runners will be cleaned before and after this PR is built. label Jul 19, 2025
@enso-bot
Copy link

enso-bot bot commented Jul 21, 2025

Jaroslav Tulach reports a new STANDUP for yesterday (2025-07-20):

Progress: .

  • onEnter & onLeave: 63f1b12
  • documenting JavaInteropTest:
  • Hunting SQLException: edce6ba It should be finished by 2025-07-26.

@JaroslavTulach JaroslavTulach force-pushed the wip/jtulach/ChannelInEpbLanguage branch from edce6ba to 62aaafe Compare July 21, 2025 04:16
@JaroslavTulach
Copy link
Member Author

Future: Make it Faster!

Executing test/Generic_JDBC_Tests in the dual JVM mode is slower than running in single JVM. Obviously serde costs us something. However the bigger problem is the amount of back and forth messages. Here is a histogram of messages being exchanged between those to JVMs:

      1 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.execute(Object,Object[])(Object, Object[])
      3 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isException(Object)(Object)
      3 MESSAGE: Message[RuntimeException com.oracle.truffle.api.interop.InteropLibrary.throwException(Object)(Object)
     21 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isIdentical(Object,Object,InteropLibrary)(Object, Object, InteropLibrary)
     25 MESSAGE: Message[ZoneId com.oracle.truffle.api.interop.InteropLibrary.asTimeZone(Object)(Object)
     29 MESSAGE: Message[LocalDate com.oracle.truffle.api.interop.InteropLibrary.asDate(Object)(Object)
     29 MESSAGE: Message[LocalTime com.oracle.truffle.api.interop.InteropLibrary.asTime(Object)(Object)
     74 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.hasMembers(Object)(Object)
    120 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isExecutable(Object)(Object)
    543 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.instantiate(Object,Object[])(Object, Object[])
   1250 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.readMember(Object,String)(Object, String)
   4234 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isBoolean(Object)(Object)
   4245 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isNumber(Object)(Object)
   6584 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isMetaInstance(Object,Object)(Object, Object)
   6805 MESSAGE: Message[String com.oracle.truffle.api.interop.InteropLibrary.asString(Object)(Object)
  17117 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isInstantiable(Object)(Object)
  18273 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isMemberReadable(Object,String)(Object, String)
  49635 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.hasMetaObject(Object)(Object)
  49635 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.getMetaObject(Object)(Object)
  69461 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.invokeMember(Object,String,Object[])(Object, String, Object[])
  86111 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.getMetaParents(Object)(Object)
  87180 MESSAGE: Message[long com.oracle.truffle.api.interop.InteropLibrary.getArraySize(Object)(Object)
  87295 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.hasHashEntries(Object)(Object)
  87302 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isMemberInvocable(Object,String)(Object, String)
  93601 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isDuration(Object)(Object)
  93602 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.fitsInBigInteger(Object)(Object)
  93642 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isTimeZone(Object)(Object)
  93688 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isDate(Object)(Object)
  93688 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isTime(Object)(Object)
  94391 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.hasArrayElements(Object)(Object)
 100934 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isString(Object)(Object)
 137039 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.readArrayElement(Object,long)(Object, long)
 215272 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.hasMetaParents(Object)(Object)
 448868 MESSAGE: Message[Object com.oracle.truffle.api.interop.InteropLibrary.getMetaQualifiedName(Object)(Object)
 455474 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isMetaObject(Object)(Object)
 498649 MESSAGE: Message[boolean com.oracle.truffle.api.interop.InteropLibrary.isNull(Object)(Object)

Future work is to extract these queries and perform them before serializing OtherJvmObject. Thta way we don't need to have twice as much of isNull or isMetaObject messages as nearest "competitor". There is just seventy thousand of invokeMember messages - those need to happen - no other type of messages should have higher number than these "necessary" ones.

@JaroslavTulach JaroslavTulach merged commit ac3d8ce into develop Jul 21, 2025
74 checks passed
@JaroslavTulach JaroslavTulach deleted the wip/jtulach/ChannelInEpbLanguage branch July 21, 2025 08:11
@enso-bot
Copy link

enso-bot bot commented Jul 22, 2025

Jaroslav Tulach reports a new STANDUP for yesterday (2025-07-21):

Progress: .

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

Labels

CI: Clean build required CI runners will be cleaned before and after this PR is built. CI: No changelog needed Do not require a changelog entry for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants