From c5fbcf29a0ed0cf2e6cdb3e30569d3845684c99d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C3=B6=20Barany?= Date: Mon, 4 Sep 2023 16:26:12 +0200 Subject: [PATCH 01/35] Fix handling of indexed load/store of byte/boolean during bytecode parsing --- .../graalvm/compiler/java/BytecodeParser.java | 84 ++++++++++++++++++- 1 file changed, 82 insertions(+), 2 deletions(-) diff --git a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/java/BytecodeParser.java b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/java/BytecodeParser.java index 9db05726e7db..5ad9214cf9b2 100644 --- a/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/java/BytecodeParser.java +++ b/compiler/src/jdk.internal.vm.compiler/src/org/graalvm/compiler/java/BytecodeParser.java @@ -4012,6 +4012,14 @@ protected void genLoadConstant(int cpi, int opcode) { } } + /** + * Tries to refine the access kind for an array access. That is, if the given {@code kind} is + * {@link JavaKind#Byte}, tries to determine if the array access ({@code baload} or + * {@code bastore}) refers to a {@code byte} or a {@code boolean} array and returns + * {@link JavaKind#Byte} or {@link JavaKind#Boolean} accordingly. If {@code array}'s stamp does + * not provide enough information to determine the correct kind, returns {@code null}. Returns + * the input {@code kind} unchanged if it is not {@link JavaKind#Byte}. + */ private JavaKind refineComponentType(ValueNode array, JavaKind kind) { if (kind == JavaKind.Byte) { JavaType type = array.stamp(NodeView.DEFAULT).javaType(getMetaAccess()); @@ -4023,6 +4031,13 @@ private JavaKind refineComponentType(ValueNode array, JavaKind kind) { return refinedKind; } } + /* + * We weren't able to recover enough type information from the array input. This can be + * the case for certain loop phi shapes where we don't have precise type information + * available during parsing. It can also be the case during OSR compilations where entry + * proxies deliberately coarsen stamps. + */ + return null; } return kind; } @@ -4041,7 +4056,40 @@ private void genLoadIndexed(JavaKind kind) { } JavaKind actualKind = refineComponentType(array, kind); - frameState.push(actualKind, append(genLoadIndexed(array, index, boundsCheck, actualKind))); + if (actualKind != null) { + frameState.push(actualKind, append(genLoadIndexed(array, index, boundsCheck, actualKind))); + } else { + GraalError.guarantee(kind == JavaKind.Byte, "refineComponentType should not have failed for %s", kind); + genByteSizedLoadIndexed(index, array, boundsCheck); + } + } + + /** + * Build code for a byte-sized array element load where we don't know if the load is from a + * {@code byte} or a {@code boolean} array. This builds both kinds of load and a type check to + * choose one or the other dynamically. After the whole graph is built, canonicalization can + * usually recover concrete types for loop phis and OSR entry proxies. We expect this check to + * fold away, and only the correct load to remain. + */ + private void genByteSizedLoadIndexed(ValueNode index, ValueNode array, GuardingNode boundsCheck) { + LoadIndexedNode loadByte = graph.add(new LoadIndexedNode(graph.getAssumptions(), array, index, boundsCheck, JavaKind.Byte)); + EndNode loadByteEnd = graph.add(new EndNode()); + loadByte.setNext(loadByteEnd); + LoadIndexedNode loadBoolean = graph.add(new LoadIndexedNode(graph.getAssumptions(), array, index, boundsCheck, JavaKind.Boolean)); + EndNode loadBooleanEnd = graph.add(new EndNode()); + loadBoolean.setNext(loadBooleanEnd); + + LogicNode isByteArray = createInstanceOfAllowNull(TypeReference.createExactTrusted(getMetaAccess().lookupJavaType(byte[].class)), array, null); + ValueNode ifNode = genIfNode(isByteArray, loadByte, loadBoolean, BranchProbabilityData.unknown()); + postProcessIfNode(ifNode); + append(ifNode); + + MergeNode merge = graph.add(new MergeNode()); + merge.addForwardEnd(loadByteEnd); + merge.addForwardEnd(loadBooleanEnd); + frameState.push(JavaKind.Byte, add(new ValuePhiNode(loadByte.stamp(NodeView.DEFAULT), merge, loadByte, loadBoolean))); + setStateAfter(merge); + updateLastInstruction(merge); } private void genStoreIndexed(JavaKind kind) { @@ -4060,7 +4108,39 @@ private void genStoreIndexed(JavaKind kind) { } JavaKind actualKind = refineComponentType(array, kind); - genStoreIndexed(array, index, boundsCheck, storeCheck, actualKind, maskSubWordValue(value, actualKind)); + if (actualKind != null) { + genStoreIndexed(array, index, boundsCheck, storeCheck, actualKind, maskSubWordValue(value, actualKind)); + } else { + GraalError.guarantee(kind == JavaKind.Byte, "refineComponentType should not have failed for %s", kind); + genByteSizedStoreIndexed(value, index, array, boundsCheck, storeCheck); + } + } + + /** + * Build code for a byte-sized array element store where we don't know if the store is to a + * {@code byte} or a {@code boolean} array. This builds both kinds of store and a type check to + * choose one or the other dynamically. After the whole graph is built, canonicalization can + * usually recover concrete types for loop phis and OSR entry proxies. We expect this check to + * fold away, and only the correct store to remain. + */ + private void genByteSizedStoreIndexed(ValueNode value, ValueNode index, ValueNode array, GuardingNode boundsCheck, GuardingNode storeCheck) { + StoreIndexedNode storeByte = graph.add(new StoreIndexedNode(array, index, boundsCheck, storeCheck, JavaKind.Byte, maskSubWordValue(value, JavaKind.Byte))); + setStateAfter(storeByte); + EndNode storeByteEnd = graph.add(new EndNode()); + storeByte.setNext(storeByteEnd); + StoreIndexedNode storeBoolean = graph.add(new StoreIndexedNode(array, index, boundsCheck, storeCheck, JavaKind.Boolean, maskSubWordValue(value, JavaKind.Boolean))); + setStateAfter(storeBoolean); + EndNode storeBooleanEnd = graph.add(new EndNode()); + storeBoolean.setNext(storeBooleanEnd); + + LogicNode isByteArray = createInstanceOfAllowNull(TypeReference.createExactTrusted(getMetaAccess().lookupJavaType(byte[].class)), array, null); + ValueNode ifNode = genIfNode(isByteArray, storeByte, storeBoolean, BranchProbabilityData.unknown()); + postProcessIfNode(ifNode); + append(ifNode); + + MergeNode merge = add(new MergeNode()); + merge.addForwardEnd(storeByteEnd); + merge.addForwardEnd(storeBooleanEnd); } private void genArithmeticOp(JavaKind kind, int opcode) { From d2ab66d350922a151bd50b8d3293e587b4a56459 Mon Sep 17 00:00:00 2001 From: Tomas Zezula Date: Tue, 29 Aug 2023 17:51:03 +0200 Subject: [PATCH 02/35] [GR-47481] Truffle patch pre-intialized contexts of non-permitted languages. --- .../ContextPreInitializationTest.java | 52 +++++++++++++++++++ .../polyglot/PolyglotLanguageContext.java | 8 ++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPreInitializationTest.java b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPreInitializationTest.java index 3e605e286dc9..e566880d5e45 100644 --- a/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPreInitializationTest.java +++ b/truffle/src/com.oracle.truffle.api.test/src/com/oracle/truffle/api/test/polyglot/ContextPreInitializationTest.java @@ -2808,6 +2808,58 @@ public void testOverriddenResourceRoot() throws Exception { } } + @Test + public void testPatchNotCalledOnNonAllowedLanguage() throws ReflectiveOperationException { + setPatchable(FIRST, SECOND); + doContextPreinitialize(FIRST, SECOND); + List contexts = new ArrayList<>(emittedContexts); + assertEquals(2, contexts.size()); + CountingContext firstLangCtx = findContext(FIRST, contexts); + assertNotNull(firstLangCtx); + CountingContext secondLangCtx = findContext(SECOND, contexts); + assertNotNull(secondLangCtx); + assertEquals(1, firstLangCtx.createContextCount); + assertEquals(1, firstLangCtx.initializeContextCount); + assertEquals(0, firstLangCtx.patchContextCount); + assertEquals(0, firstLangCtx.disposeContextCount); + assertEquals(1, firstLangCtx.initializeThreadCount); + assertEquals(1, firstLangCtx.disposeThreadCount); + assertEquals(1, secondLangCtx.createContextCount); + assertEquals(1, secondLangCtx.initializeContextCount); + assertEquals(0, secondLangCtx.patchContextCount); + assertEquals(0, secondLangCtx.disposeContextCount); + assertEquals(1, secondLangCtx.initializeThreadCount); + assertEquals(1, secondLangCtx.disposeThreadCount); + try (Context ctx = Context.create(FIRST)) { + Value res = ctx.eval(Source.create(FIRST, "test")); + assertEquals("test", res.asString()); + contexts = new ArrayList<>(emittedContexts); + assertEquals(3, contexts.size()); + Collection firstLangCtxs = findContexts(FIRST, contexts); + firstLangCtxs.remove(firstLangCtx); + assertEquals(1, firstLangCtxs.size()); + CountingContext firstLangCtx2 = firstLangCtxs.iterator().next(); + assertEquals(1, firstLangCtx.createContextCount); + assertEquals(1, firstLangCtx.initializeContextCount); + assertEquals(1, firstLangCtx.patchContextCount); + assertEquals(1, firstLangCtx.disposeContextCount); + assertEquals(2, firstLangCtx.initializeThreadCount); // Close initializes thread + assertEquals(2, firstLangCtx.disposeThreadCount); // Close initializes thread + assertEquals(1, secondLangCtx.createContextCount); + assertEquals(1, secondLangCtx.initializeContextCount); + assertEquals(0, secondLangCtx.patchContextCount); + assertEquals(1, secondLangCtx.disposeContextCount); + assertEquals(2, secondLangCtx.initializeThreadCount); // Close initializes thread + assertEquals(2, secondLangCtx.disposeThreadCount); // Close initializes thread + assertEquals(1, firstLangCtx2.createContextCount); + assertEquals(1, firstLangCtx2.initializeContextCount); + assertEquals(0, firstLangCtx2.patchContextCount); + assertEquals(0, firstLangCtx2.disposeContextCount); + assertEquals(1, firstLangCtx2.initializeThreadCount); + assertEquals(0, firstLangCtx2.disposeThreadCount); + } + } + private static boolean executedWithXCompOptions() { Properties props = System.getProperties(); return props.containsKey("polyglot.engine.CompileImmediately") || props.containsKey("polyglot.engine.BackgroundCompilation"); diff --git a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotLanguageContext.java b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotLanguageContext.java index e9b01526ef81..4dd8670fc6b6 100644 --- a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotLanguageContext.java +++ b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/PolyglotLanguageContext.java @@ -884,7 +884,9 @@ public PolyglotImpl getImpl() { } boolean patch(PolyglotContextConfig newConfig) { - if (isCreated()) { + Set configuredLanguages = newConfig.getConfiguredLanguages(); + boolean requested = language.isHost() || language.cache.isInternal() || configuredLanguages.isEmpty() || configuredLanguages.contains(language); + if (requested && isCreated()) { try { OptionValuesImpl newOptionValues = newConfig.getLanguageOptionValues(language).copy(); lazy.computeAccessPermissions(newConfig); @@ -906,6 +908,10 @@ boolean patch(PolyglotContextConfig newConfig) { throw silenceException(RuntimeException.class, t); } } else { + if (LOG.isLoggable(Level.FINER)) { + LOG.log(Level.FINER, "The language context patching for {0} is being skipped due to requested: {1}, created: {2}.", + new Object[]{this.language.getId(), requested, isCreated()}); + } return true; } } From 71db8e5352469b89c7da9bda02053ff14e66b0c7 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 6 Sep 2023 00:58:02 +0200 Subject: [PATCH 03/35] Make sure Thread.exit is only executed once terminate might be called multiple times from different sources, make sure we only do the thread exit sequence (calling Thread.exit, changing the thread state to TERMINATED and notifying its monitor) once. This also implements eetop and removes the unnecessary isAlive substitution to avoid surprises when the JDK uses it and/or overrides alive (like for VirtualThreads). --- .../truffle/espresso/descriptors/Symbol.java | 1 + .../oracle/truffle/espresso/meta/Meta.java | 2 + .../Target_java_lang_Thread.java | 2 +- .../threads/EspressoThreadRegistry.java | 2 + .../espresso/threads/ThreadsAccess.java | 41 +++++++++++++++---- 5 files changed, 38 insertions(+), 10 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/Symbol.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/Symbol.java index 8e476e1095b5..57a1e5ee9f46 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/Symbol.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/descriptors/Symbol.java @@ -344,6 +344,7 @@ public static void ensureInitialized() { public static final Symbol createMemoryManager = StaticSymbols.putName("createMemoryManager"); public static final Symbol createGarbageCollector = StaticSymbols.putName("createGarbageCollector"); public static final Symbol tid = StaticSymbols.putName("tid"); + public static final Symbol eetop = StaticSymbols.putName("eetop"); public static final Symbol getFromClass = StaticSymbols.putName("getFromClass"); // MemberName diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java index afef9cb07b28..82045ac474ad 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java @@ -484,6 +484,7 @@ public Meta(EspressoContext context) { java_lang_Thread$FieldHolder_daemon = java_lang_Thread$FieldHolder.requireDeclaredField(Name.daemon, Type._boolean); } java_lang_Thread_tid = java_lang_Thread.requireDeclaredField(Name.tid, Type._long); + java_lang_Thread_eetop = java_lang_Thread.requireDeclaredField(Name.eetop, Type._long); java_lang_Thread_contextClassLoader = java_lang_Thread.requireDeclaredField(Name.contextClassLoader, Type.java_lang_ClassLoader); java_lang_Thread_name = java_lang_Thread.requireDeclaredField(Name.name, java_lang_String.getType()); @@ -1337,6 +1338,7 @@ private DiffVersionLoadHelper diff() { public final Field java_lang_Thread_threadGroup; public final Field java_lang_Thread$FieldHolder_group; public final Field java_lang_Thread_tid; + public final Field java_lang_Thread_eetop; public final ObjectKlass java_lang_Thread$Constants; public final Field java_lang_Thread$Constants_VTHREAD_GROUP; public final Field java_lang_Thread_contextClassLoader; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java index 4ae4d97e6de7..42a2d558ea7a 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java @@ -198,7 +198,7 @@ public static void setPriority0(@JavaType(Thread.class) StaticObject self, int n hostThread.setPriority(newPriority); } - @Substitution(hasReceiver = true) + @Substitution(hasReceiver = true, versionFilter = VersionFilter.Java18OrEarlier.class) public static boolean isAlive(@JavaType(Thread.class) StaticObject self, @Inject EspressoContext context) { return context.getThreadAccess().isAlive(self); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java index bc6c38e517bd..0419bee9c42c 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/EspressoThreadRegistry.java @@ -279,6 +279,7 @@ public StaticObject createGuestThreadFromHost(Thread hostThread, Meta meta, VM v if (getJavaVersion().java17OrEarlier()) { getThreadAccess().setPriority(guestThread, Thread.NORM_PRIORITY); } + getThreadAccess().setEETopAlive(guestThread); getThreadAccess().initializeHiddenFields(guestThread, hostThread, managedByEspresso); registerThread(hostThread, guestThread); assert getThreadAccess().getCurrentGuestThread() != null; @@ -322,6 +323,7 @@ public void createMainThread(Meta meta) { if (getJavaVersion().java17OrEarlier()) { getThreadAccess().setPriority(mainThread, Thread.NORM_PRIORITY); } + getThreadAccess().setEETopAlive(mainThread); getThreadAccess().initializeHiddenFields(mainThread, hostThread, false); registerMainThread(hostThread, mainThread); diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java index 9f3e485f328b..0cce032c105c 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java @@ -48,6 +48,7 @@ */ public final class ThreadsAccess extends ContextAccessImpl implements GuestInterrupter { + public static final long ALIVE_EETOP = 0XCAFEBABEL; private final Meta meta; @Override @@ -135,6 +136,19 @@ void setPriority(StaticObject thread, int priority) { } } + void setEETopAlive(StaticObject thread) { + meta.java_lang_Thread_eetop.setLong(thread, ALIVE_EETOP); + } + + void setEETopDead(StaticObject thread) { + meta.java_lang_Thread_eetop.setLong(thread, 0); + } + + long getEETop(StaticObject thread) { + return meta.java_lang_Thread_eetop.getLong(thread); + } + + int fromRunnable(StaticObject self, State state) { int old = getState(self); assert (old & State.RUNNABLE.value) != 0 || old == State.NEW.value : old; @@ -356,6 +370,7 @@ public Thread createJavaThread(StaticObject guest, DirectCallNode exit, DirectCa } String guestName = getContext().getThreadAccess().getThreadName(guest); host.setName(guestName); + getThreadAccess().setEETopAlive(guest); // Make the thread known to the context getContext().registerThread(host, guest); setState(guest, State.RUNNABLE.value); @@ -436,18 +451,25 @@ public void terminate(StaticObject thread) { void terminate(StaticObject thread, DirectCallNode exit) { DeprecationSupport support = getDeprecationSupport(thread, true); support.exit(); - if (!getContext().isTruffleClosed()) { - try { - if (exit == null) { - meta.java_lang_Thread_exit.invokeDirect(thread); - } else { - exit.call(thread); + long eetop = getEETop(thread); + // check eetop to avoid re-executing `exit` + if (eetop != 0) { + assert eetop == ALIVE_EETOP; + if (!getContext().isTruffleClosed()) { + try { + if (exit == null) { + meta.java_lang_Thread_exit.invokeDirect(thread); + } else { + exit.call(thread); + } + } catch (AbstractTruffleException e) { + // just drop it } - } catch (AbstractTruffleException e) { - // just drop it } + setTerminateStatusAndNotify(thread); + } else { + assert getState(thread) == State.TERMINATED.value; } - setTerminateStatusAndNotify(thread); } /** @@ -468,6 +490,7 @@ private void setTerminateStatusAndNotify(StaticObject guest) { guest.getLock(getContext()).lock(); try { setState(guest, State.TERMINATED.value); + setEETopDead(guest); // Notify waiting threads you are done working guest.getLock(getContext()).signalAll(); } finally { From 1b378d930b6e04a5abc2f44f6f858c98e2c0dd1e Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 6 Sep 2023 01:01:37 +0200 Subject: [PATCH 04/35] (re)move Thread susbtitution for better jdk 21 compatibility yield now has special behaviour with VirtualThreads getState substitution doesn't seem needed since it does the same as the bytecodes and can now be overriden --- .../Target_java_lang_Thread.java | 21 +++++++------------ 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java index 42a2d558ea7a..59b75e4a3ab4 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_java_lang_Thread.java @@ -180,11 +180,17 @@ private static boolean isSystemInnocuousThread(StaticObject thread, Meta meta) { } @TruffleBoundary - @Substitution(isTrivial = true) + @Substitution(isTrivial = true, versionFilter = VersionFilter.Java18OrEarlier.class) public static void yield() { Thread.yield(); } + @TruffleBoundary + @Substitution(isTrivial = true) + public static void yield0() { + Thread.yield(); + } + @SuppressWarnings("unused") @Substitution(hasReceiver = true) @TruffleBoundary // Host Thread.setPriority inlines too deeply. @@ -204,19 +210,6 @@ public static boolean isAlive(@JavaType(Thread.class) StaticObject self, return context.getThreadAccess().isAlive(self); } - @Substitution(hasReceiver = true) - abstract static class GetState extends SubstitutionNode { - abstract @JavaType(internalName = "Ljava/lang/Thread$State;") StaticObject execute(@JavaType(Thread.class) StaticObject self); - - @Specialization - @JavaType(internalName = "Ljava/lang/Thread$State;") - StaticObject doDefault(@JavaType(Thread.class) StaticObject self, - @Bind("getContext()") EspressoContext context, - @Cached("create(context.getMeta().sun_misc_VM_toThreadState.getCallTarget())") DirectCallNode toThreadState) { - return (StaticObject) toThreadState.call(context.getThreadAccess().getState(self)); - } - } - @SuppressWarnings("unused") @Substitution public static void registerNatives() { From 5da8483773b6bad454136cdbce8402dcdbc7a23b Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 6 Sep 2023 09:41:05 +0200 Subject: [PATCH 05/35] Remove unused class and method in Meta --- .../src/com/oracle/truffle/espresso/meta/Meta.java | 8 -------- .../oracle/truffle/espresso/threads/ThreadsAccess.java | 1 - 2 files changed, 9 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java index 82045ac474ad..3021f13d326b 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/meta/Meta.java @@ -713,12 +713,6 @@ public Meta(EspressoContext context) { .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_reflect_ConstructorAccessorImpl) // .klass(); - sun_misc_VM = diff() // - .klass(VERSION_8_OR_LOWER, Type.sun_misc_VM) // - .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_misc_VM) // - .klass(); - sun_misc_VM_toThreadState = sun_misc_VM.requireDeclaredMethod(Name.toThreadState, Signature.Thread$State_int); - sun_misc_Signal = diff() // .klass(VERSION_8_OR_LOWER, Type.sun_misc_Signal) // .klass(VERSION_9_OR_HIGHER, Type.jdk_internal_misc_Signal) // @@ -1374,8 +1368,6 @@ private DiffVersionLoadHelper diff() { public final ObjectKlass java_lang_ref_Reference$ReferenceHandler; public final ObjectKlass misc_InnocuousThread; - public final ObjectKlass sun_misc_VM; - public final Method sun_misc_VM_toThreadState; public final ObjectKlass sun_reflect_ConstantPool; public final ObjectKlass sun_misc_Signal; diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java index 0cce032c105c..ff1914817838 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/threads/ThreadsAccess.java @@ -148,7 +148,6 @@ long getEETop(StaticObject thread) { return meta.java_lang_Thread_eetop.getLong(thread); } - int fromRunnable(StaticObject self, State state) { int old = getState(self); assert (old & State.RUNNABLE.value) != 0 || old == State.NEW.value : old; From fdd1dbfc1c45676cb3be89069f0a41feced57fbb Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 6 Sep 2023 09:58:40 +0200 Subject: [PATCH 06/35] Fix vararg handling in WindowsArgumentsCalculator Make sure to accept both others for vararg moves (double -> int reg then double -> float reg or double -> float reg then double -> int reg). --- .../panama/WindowsArgumentsCalculator.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/panama/WindowsArgumentsCalculator.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/panama/WindowsArgumentsCalculator.java index 6d4da567ee97..bff1d67c2dcd 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/panama/WindowsArgumentsCalculator.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/runtime/panama/WindowsArgumentsCalculator.java @@ -26,7 +26,7 @@ public class WindowsArgumentsCalculator extends AbstractArgumentsCalculator { private int globalIndex; - private boolean skipNext; + private boolean inVarArg; public WindowsArgumentsCalculator(Platform platform, VMStorage[] callIntRegs, VMStorage[] callFloatRegs, VMStorage intReturn, VMStorage floatReturn) { super(platform, callIntRegs, callFloatRegs, intReturn, floatReturn); @@ -36,15 +36,20 @@ public WindowsArgumentsCalculator(Platform platform, VMStorage[] callIntRegs, VM public int getNextInputIndex(VMStorage reg, Klass type, VMStorage nextReg, Klass nextType) { // TODO this currently depends on order but doesn't actually need to assert isInt(type) || isFloat(type) : platform.toString(reg) + ": " + type; - if (skipNext) { - skipNext = false; - return SKIP; - } - if (isVarArg(reg, type, nextReg, nextType)) { - skipNext = true; + if (inVarArg) { + if (skipExtraVarArgMove(reg, type)) { + return SKIP; + } + inVarArg = false; + } else if (isVarArg(reg, type, nextReg, nextType)) { + // start of 2 registers used for the same argument + inVarArg = true; + if (skipExtraVarArgMove(reg, type)) { + return SKIP; + } } if (globalIndex < callIntRegs.length && callIntRegs[globalIndex].equals(reg)) { - assert isInt(type) || (skipNext && isFloat(type)) : platform.toString(reg) + ": " + type; + assert isInt(type) : platform.toString(reg) + ": " + type; return globalIndex++; } if (globalIndex < callFloatRegs.length && callFloatRegs[globalIndex].equals(reg)) { @@ -73,6 +78,10 @@ public boolean checkReturn(VMStorage reg, Klass type) { return false; } + private boolean skipExtraVarArgMove(VMStorage reg, Klass type) { + return isFloat(type) && reg.type(platform).isInteger(); + } + @Override public boolean isVarArg(VMStorage reg, Klass type, VMStorage nextReg, Klass nextType) { if (nextReg == null) { From 31e7df6a44d3476d856f0502aa9436f5e55efc27 Mon Sep 17 00:00:00 2001 From: Gilles Duboscq Date: Wed, 6 Sep 2023 10:41:28 +0200 Subject: [PATCH 07/35] Fix ScopedMemoryAccess#closeScope0 Wait for the thread local action to complete before returning the result. --- ...arget_jdk_internal_misc_ScopedMemoryAccess.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_misc_ScopedMemoryAccess.java b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_misc_ScopedMemoryAccess.java index f6fdc3355494..2734ad955306 100644 --- a/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_misc_ScopedMemoryAccess.java +++ b/espresso/src/com.oracle.truffle.espresso/src/com/oracle/truffle/espresso/substitutions/Target_jdk_internal_misc_ScopedMemoryAccess.java @@ -23,11 +23,15 @@ package com.oracle.truffle.espresso.substitutions; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; + import com.oracle.truffle.api.CallTarget; import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary; import com.oracle.truffle.api.RootCallTarget; import com.oracle.truffle.api.ThreadLocalAction; import com.oracle.truffle.api.Truffle; +import com.oracle.truffle.api.TruffleSafepoint; import com.oracle.truffle.api.frame.Frame; import com.oracle.truffle.api.frame.FrameInstance; import com.oracle.truffle.api.frame.FrameInstanceVisitor; @@ -35,6 +39,7 @@ import com.oracle.truffle.espresso.classfile.attributes.Local; import com.oracle.truffle.espresso.classfile.attributes.LocalVariableTable; import com.oracle.truffle.espresso.impl.Method; +import com.oracle.truffle.espresso.meta.EspressoError; import com.oracle.truffle.espresso.nodes.EspressoFrame; import com.oracle.truffle.espresso.nodes.EspressoRootNode; import com.oracle.truffle.espresso.runtime.EspressoContext; @@ -51,7 +56,14 @@ public static void registerNatives() { @TruffleBoundary public static boolean closeScope0(@JavaType(internalName = "Ljdk/internal/foreign/MemorySessionImpl;") StaticObject session, @Inject EspressoContext context) { CloseScopedMemoryAction action = new CloseScopedMemoryAction(session); - context.getEnv().submitThreadLocal(null, action); + Future future = context.getEnv().submitThreadLocal(null, action); + TruffleSafepoint.setBlockedThreadInterruptible(null, f -> { + try { + future.get(); + } catch (ExecutionException e) { + throw EspressoError.shouldNotReachHere(e); + } + }, future); return !action.found; } From af6ec4a29a7a0b56ca4751d34c34192aa04c8a57 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Wed, 9 Aug 2023 18:47:49 +0200 Subject: [PATCH 08/35] Deploy deprecated GraalVM Updater launchers. (cherry picked from commit 1af7c6f0fb00cc7a63a05fc055bce939e2cd8b7b) --- sdk/mx.sdk/mx_sdk_vm_impl.py | 11 ++++-- vm/mx.vm/gu-deprecated | 41 +++++++++++++++++++ vm/mx.vm/gu-deprecated.cmd | 35 +++++++++++++++++ vm/mx.vm/mx_vm.py | 76 +++++++++++++++++++++--------------- vm/mx.vm/suite.py | 23 +++++++++++ 5 files changed, 151 insertions(+), 35 deletions(-) create mode 100755 vm/mx.vm/gu-deprecated create mode 100755 vm/mx.vm/gu-deprecated.cmd diff --git a/sdk/mx.sdk/mx_sdk_vm_impl.py b/sdk/mx.sdk/mx_sdk_vm_impl.py index 279273e600c7..c1a22618532f 100644 --- a/sdk/mx.sdk/mx_sdk_vm_impl.py +++ b/sdk/mx.sdk/mx_sdk_vm_impl.py @@ -108,6 +108,8 @@ def unicode_utf8(string): default_components = [] +USE_LEGACY_GU = False + mx.add_argument('--base-dist-name', help='Sets the name of the GraalVM base image ( for complete, ruby ... images), default to "base"', default='base') @@ -866,10 +868,11 @@ def _get_metadata(suites, parent_release_file=None): catalog = gds_snapshot_catalog else: catalog = None - if catalog: - _metadata_dict['component_catalog'] = catalog - if gds_product_id: - _metadata_dict['GDS_PRODUCT_ID'] = gds_product_id + if USE_LEGACY_GU: + if catalog: + _metadata_dict['component_catalog'] = catalog + if gds_product_id: + _metadata_dict['GDS_PRODUCT_ID'] = gds_product_id # COMMIT_INFO is unquoted to simplify JSON parsing return mx_sdk_vm.format_release_file(_metadata_dict, {'COMMIT_INFO'}) diff --git a/vm/mx.vm/gu-deprecated b/vm/mx.vm/gu-deprecated new file mode 100755 index 000000000000..ccf0e9476886 --- /dev/null +++ b/vm/mx.vm/gu-deprecated @@ -0,0 +1,41 @@ +#!/usr/bin/env bash +# +# ---------------------------------------------------------------------------------------------------- +# +# Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# ---------------------------------------------------------------------------------------------------- + +cat < Date: Tue, 22 Aug 2023 11:48:48 +0200 Subject: [PATCH 09/35] Drop gu from mvn-simplelanguage gates. (cherry picked from commit 5a11ecf7cabf69dac9bb6faa3bc47a4d519bdedc) --- truffle/ci/ci.jsonnet | 5 ----- 1 file changed, 5 deletions(-) diff --git a/truffle/ci/ci.jsonnet b/truffle/ci/ci.jsonnet index 4d2b846605dd..2fd76537436a 100644 --- a/truffle/ci/ci.jsonnet +++ b/truffle/ci/ci.jsonnet @@ -95,11 +95,6 @@ ["./sl", "-disassemble", "language/tests/Add.sl"], ["./sl", "language/tests/Add.sl"], ["./native/slnative", "language/tests/Add.sl"], - ["$JAVA_HOME/bin/gu", "install", "-L", "component/sl-component.jar"], - ["$JAVA_HOME/bin/sl", "language/tests/Add.sl"], - ["$JAVA_HOME/bin/slnative", "language/tests/Add.sl"], - ["$JAVA_HOME/bin/polyglot", "--jvm", "--language", "sl", "--file", "language/tests/Add.sl"], - ["$JAVA_HOME/bin/gu", "remove", "sl"], ], }, From 89aa611337bbe1b11f232e1726df5825665ee7c4 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Mon, 4 Sep 2023 17:53:17 +0200 Subject: [PATCH 10/35] The `USE_LEGACY_GU` env var enables legacy gu. (cherry picked from commit 7312c9feba0c11a9f503b2606f22141378b6e0dc) --- sdk/mx.sdk/mx_sdk_vm_impl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sdk/mx.sdk/mx_sdk_vm_impl.py b/sdk/mx.sdk/mx_sdk_vm_impl.py index c1a22618532f..c1dc963fe0a1 100644 --- a/sdk/mx.sdk/mx_sdk_vm_impl.py +++ b/sdk/mx.sdk/mx_sdk_vm_impl.py @@ -108,7 +108,7 @@ def unicode_utf8(string): default_components = [] -USE_LEGACY_GU = False +USE_LEGACY_GU = mx.str_to_bool(mx.get_env('LEGACY_GU', 'false')) mx.add_argument('--base-dist-name', help='Sets the name of the GraalVM base image ( for complete, ruby ... images), default to "base"', default='base') From fe509166ce428e08d7d70063046300983915ffb4 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Mon, 4 Sep 2023 17:54:13 +0200 Subject: [PATCH 11/35] Use `truffle-json.jar` from the corresponding language. (cherry picked from commit 0395ee3283f2a7d4b5730f02f397ff9d17c43767) --- sdk/mx.sdk/mx_sdk_vm_impl.py | 1 - vm/tests/all/agentscript/generators/spec.test | 4 ++-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/sdk/mx.sdk/mx_sdk_vm_impl.py b/sdk/mx.sdk/mx_sdk_vm_impl.py index c1dc963fe0a1..0199f91930ca 100644 --- a/sdk/mx.sdk/mx_sdk_vm_impl.py +++ b/sdk/mx.sdk/mx_sdk_vm_impl.py @@ -110,7 +110,6 @@ def unicode_utf8(string): USE_LEGACY_GU = mx.str_to_bool(mx.get_env('LEGACY_GU', 'false')) - mx.add_argument('--base-dist-name', help='Sets the name of the GraalVM base image ( for complete, ruby ... images), default to "base"', default='base') diff --git a/vm/tests/all/agentscript/generators/spec.test b/vm/tests/all/agentscript/generators/spec.test index 3eb0df32fe38..90ae7eb0d69f 100644 --- a/vm/tests/all/agentscript/generators/spec.test +++ b/vm/tests/all/agentscript/generators/spec.test @@ -1,4 +1,4 @@ ->[0?] ls $JAVA_HOME/lib/installer/truffle-json.jar +>[0?] ls $JAVA_HOME/languages/truffle-json/truffle-json.jar >[0] cp watch.js ${TMP_DIR}/watch.js >[0] cp spec.ts ${TMP_DIR}/spec.in >[0] cp -r ../../../../../tools/generators/src ${TMP_DIR} @@ -13,4 +13,4 @@ Generating At Generating Where Generating SOp Generating WOp ->[0?] javac -cp $JAVA_HOME/lib/installer/truffle-json.jar -sourcepath parser/ parser/*.java -d out +>[0?] javac -cp $JAVA_HOME/languages/truffle-json/truffle-json.jar -sourcepath parser/ parser/*.java -d out From 7efeb4a744f8366547daa99cced231c7a2ed5df4 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Mon, 4 Sep 2023 18:33:07 +0200 Subject: [PATCH 12/35] Fix GraalVM configs. (cherry picked from commit 1056ab24932c74328310da77756015d7325b7d08) --- vm/mx.vm/mx_vm.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/vm/mx.vm/mx_vm.py b/vm/mx.vm/mx_vm.py index b9be69daab51..1965f56dc4e5 100644 --- a/vm/mx.vm/mx_vm.py +++ b/vm/mx.vm/mx_vm.py @@ -192,17 +192,17 @@ def local_path_to_url(args): # pylint: disable=line-too-long ce_unchained_components = ['bnative-image-configure', 'cmp', 'lg', 'ni', 'nic', 'nil', 'nr_lib_jvmcicompiler', 'sdkc', 'sdkni', 'svm', 'svmforeign', 'svmsl', 'svmt', 'tflc', 'tflsm'] -ce_components_minimal = ['bgu', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'lsp', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'pro', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] +ce_components_minimal = ['bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'lsp', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'pro', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] ce_components = ce_components_minimal + ['nr_lib_jvmcicompiler', 'bnative-image-configure', 'ni', 'nic', 'nil', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svmforeign'] -ce_win_complete_components = ['antlr4', 'bgu', 'bnative-image-configure', 'bpolyglot', 'cmp', 'cov', 'dap', 'ejvm', 'gu', 'gvm', 'gwa', 'gwal', 'icu4j', 'ins', 'insight', 'insightheap', 'java', 'js', 'jsl', 'jss', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrlf', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'njs', 'njsl', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svmforeign', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json', 'vvm'] +ce_win_complete_components = ['antlr4', 'bnative-image-configure', 'bpolyglot', 'cmp', 'cov', 'dap', 'ejvm', 'gu', 'gvm', 'gwa', 'gwal', 'icu4j', 'ins', 'insight', 'insightheap', 'java', 'js', 'jsl', 'jss', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrlf', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'ni', 'nic', 'nil', 'njs', 'njsl', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svmforeign', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json', 'vvm'] ce_aarch64_complete_components = ce_win_complete_components + ['rby', 'rbyl', 'svml'] ce_complete_components = ce_aarch64_complete_components + ['ellvm', 'R', 'bRMain'] ce_darwin_aarch64_complete_components = list(ce_aarch64_complete_components) ce_darwin_aarch64_complete_components.remove('svml') # GR-34811 / GR-40147 ce_ruby_components = ['antlr4', 'cmp', 'cov', 'dap', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'llp', 'llrc', 'llrlf', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pro', 'rby', 'rbyl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] -ce_python_components = llvm_components + ['antlr4', 'bgu', 'sllvmvm', 'bpolybench', 'bpolyglot', 'cmp', 'cov', 'dap', 'dis', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrlf', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pbm', 'pmh', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] +ce_python_components = llvm_components + ['antlr4', 'sllvmvm', 'bpolybench', 'bpolyglot', 'cmp', 'cov', 'dap', 'dis', 'gu', 'gvm', 'icu4j', 'ins', 'insight', 'insightheap', 'lg', 'libpoly', 'llp', 'llrc', 'llrl', 'llrlf', 'llrn', 'lsp', 'nfi-libffi', 'nfi', 'pbm', 'pmh', 'poly', 'polynative', 'pro', 'pyn', 'pynl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json'] ce_fastr_components = ce_components + llvm_components + ['antlr4', 'sllvmvm', 'llp', 'bnative-image', 'snative-image-agent', 'R', 'bRMain', 'bnative-image-configure', 'llrc', 'snative-image-diagnostics-agent', 'llrn', 'llrl', 'llrlf'] -ce_no_native_components = ['bgu', 'bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lsp', 'nfi-libffi', 'nfi', 'polynative', 'pro', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json', 'libpoly', 'poly'] +ce_no_native_components = ['bpolyglot', 'cmp', 'cov', 'dap', 'gu', 'gvm', 'ins', 'insight', 'insightheap', 'lsp', 'nfi-libffi', 'nfi', 'polynative', 'pro', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'spolyglot', 'tfl', 'tfla', 'tflc', 'tflm', 'truffle-json', 'libpoly', 'poly'] # Main GraalVMs mx_sdk_vm.register_vm_config('community', ce_unchained_components, _suite, env_file='ce-win') @@ -227,8 +227,8 @@ def local_path_to_url(args): mx_sdk_vm.register_vm_config('ce-no_native', ce_no_native_components, _suite) mx_sdk_vm.register_vm_config('libgraal', ['cmp', 'lg', 'sdkc', 'tflc'], _suite) mx_sdk_vm.register_vm_config('toolchain-only', ['antlr4', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'nfi-libffi', 'nfi', 'cmp', 'llp', 'llrc', 'llrlf', 'llrn'], _suite) -mx_sdk_vm.register_vm_config('libgraal-bash', llvm_components + ['bgu', 'cmp', 'gu', 'gvm', 'lg', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'bpolyglot'], _suite, env_file=False) -mx_sdk_vm.register_vm_config('toolchain-only-bash', llvm_components + ['antlr4', 'bgu', 'tfl', 'tfla', 'tflc', 'tflm', 'gu', 'gvm', 'polynative', 'llp', 'nfi-libffi', 'nfi', 'svml', 'bgu', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'llrc', 'llrlf', 'llrn', 'cmp'], _suite, env_file=False) +mx_sdk_vm.register_vm_config('libgraal-bash', llvm_components + ['cmp', 'gu', 'gvm', 'lg', 'nfi-libffi', 'nfi', 'poly', 'polynative', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'tfl', 'tfla', 'tflc', 'tflm', 'bpolyglot'], _suite, env_file=False) +mx_sdk_vm.register_vm_config('toolchain-only-bash', llvm_components + ['antlr4', 'tfl', 'tfla', 'tflc', 'tflm', 'gu', 'gvm', 'polynative', 'llp', 'nfi-libffi', 'nfi', 'svml', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'llrc', 'llrlf', 'llrn', 'cmp'], _suite, env_file=False) mx_sdk_vm.register_vm_config('ce', llvm_components + ['antlr4', 'java', 'libpoly', 'sjavavm', 'spolyglot', 'ejvm', 'sjsvm', 'sllvmvm', 'bnative-image', 'srubyvm', 'pynl', 'spythonvm', 'pyn', 'cmp', 'gwa', 'gwal', 'icu4j', 'js', 'jsl', 'jss', 'lg', 'llp', 'nfi-libffi', 'nfi', 'ni', 'nil', 'pbm', 'pmh', 'pbi', 'rby', 'rbyl', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'llrc', 'llrn', 'llrl', 'llrlf', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svmforeign', 'swasmvm', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file='polybench-ce') mx_sdk_vm.register_vm_config('ce', ['bnative-image', 'bpolybench', 'cmp', 'icu4j', 'lg', 'nfi', 'ni', 'nil', 'pbi', 'pbm', 'pmh', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svmforeign', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, dist_name='ce', env_file='polybench-ctw-ce') mx_sdk_vm.register_vm_config('ce', ['pbm', 'pmh', 'pbi', 'ni', 'icu4j', 'js', 'jsl', 'jss', 'lg', 'nfi-libffi', 'nfi', 'tfl', 'tfla', 'tflc', 'svm', 'svmt', 'nil', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'cmp', 'tflm', 'svmnfi', 'svmsl', 'svmforeign', 'bnative-image', 'sjsvm', 'snative-image-agent', 'snative-image-diagnostics-agent'], _suite, env_file='polybench-nfi-ce') @@ -237,7 +237,7 @@ def local_path_to_url(args): if mx.get_os() == 'windows': mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svmforeign', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False) else: - mx_sdk_vm.register_vm_config('svm', ['bgu', 'bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svml', 'svmforeign', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False) + mx_sdk_vm.register_vm_config('svm', ['bnative-image', 'bnative-image-configure', 'bpolyglot', 'cmp', 'gu', 'gvm', 'nfi-libffi', 'nfi', 'ni', 'nil', 'nju', 'njucp', 'nic', 'poly', 'polynative', 'rgx', 'sdk', 'sdkni', 'sdkc', 'sdkl', 'snative-image-agent', 'snative-image-diagnostics-agent', 'svm', 'svmt', 'svmnfi', 'svmsl', 'svml', 'svmforeign', 'tfl', 'tfla', 'tflc', 'tflm'], _suite, env_file=False) # pylint: enable=line-too-long From 484b60ae81b095c2096e11e40b2e28631a190be5 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 08:52:41 +0000 Subject: [PATCH 13/35] Fix path. (cherry picked from commit 9bd7f01b41ed1b08ca013e9fe383c2d29bb019ea) --- vm/mx.vm/gu-deprecated.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/mx.vm/gu-deprecated.cmd b/vm/mx.vm/gu-deprecated.cmd index e5fa8f3a15a2..2aa7f780faf8 100755 --- a/vm/mx.vm/gu-deprecated.cmd +++ b/vm/mx.vm/gu-deprecated.cmd @@ -29,7 +29,7 @@ echo For more details and information on migration options, please visit: echo. echo https://github.com/oracle/graal/issues/6855 echo. -echo (Note that \$JAVA_HOME/bin/gu will be removed entirely in a future release.) +echo (Note that $JAVA_HOME\bin\gu.cmd will be removed entirely in a future release.) echo. exit /b 1 From c95a6a22f54d13c9e8a9e93149cbaa6b477f5ec4 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 08:52:47 +0000 Subject: [PATCH 14/35] Fix duplicated spaces. (cherry picked from commit f62d30b2065e38e21cec40d0462421cda7a71df4) --- vm/mx.vm/gu-deprecated.cmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/mx.vm/gu-deprecated.cmd b/vm/mx.vm/gu-deprecated.cmd index 2aa7f780faf8..ae4e1f18c6fd 100755 --- a/vm/mx.vm/gu-deprecated.cmd +++ b/vm/mx.vm/gu-deprecated.cmd @@ -27,7 +27,7 @@ echo GraalVM Updater is no longer available in this release of GraalVM. echo. echo For more details and information on migration options, please visit: echo. -echo https://github.com/oracle/graal/issues/6855 +echo https://github.com/oracle/graal/issues/6855 echo. echo (Note that $JAVA_HOME\bin\gu.cmd will be removed entirely in a future release.) echo. From 00e0c996e5ea87eebf89418d00a18232f032d4a8 Mon Sep 17 00:00:00 2001 From: Tomas Zezula Date: Tue, 5 Sep 2023 17:58:09 +0200 Subject: [PATCH 15/35] Fixed truffle runtime license. Fixed too early reset of engine internal resources. (cherry picked from commit 8a57bd8265becaaef30c5455f3ccf89eb9c0efd3) --- .../oracle/svm/truffle/TruffleBaseFeature.java | 16 +++++++--------- truffle/mx.truffle/mx_truffle.py | 11 ++++------- .../truffle/polyglot/InternalResourceCache.java | 13 ------------- 3 files changed, 11 insertions(+), 29 deletions(-) diff --git a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java index 957bbdf32dfc..4931312c74bf 100644 --- a/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java +++ b/substratevm/src/com.oracle.svm.truffle/src/com/oracle/svm/truffle/TruffleBaseFeature.java @@ -344,6 +344,7 @@ public void cleanup() { Collections.emptyList()); invokeStaticMethod("com.oracle.truffle.polyglot.InstrumentCache", "resetNativeImageState", Collections.emptyList()); + invokeStaticMethod("com.oracle.truffle.polyglot.InternalResourceCache", "resetNativeImageState", List.of()); invokeStaticMethod("org.graalvm.polyglot.Engine$ImplHolder", "resetPreInitializedEngine", Collections.emptyList()); invokeStaticMethod("com.oracle.truffle.api.impl.TruffleLocator", "resetNativeImageState", @@ -501,7 +502,6 @@ public Object transform(Object receiver, Object originalValue) { @Override public void afterAnalysis(AfterAnalysisAccess access) { markAsUnsafeAccessed = null; - invokeStaticMethod("com.oracle.truffle.polyglot.InternalResourceCache", "resetNativeImageState", List.of()); } public static void preInitializeEngine() { @@ -1367,10 +1367,9 @@ final class Target_com_oracle_truffle_polyglot_LanguageCache { final class Target_com_oracle_truffle_polyglot_InternalResourceCache { /* - * The field is also reset explicitly in InternalResourceCache.resetFileSystemNativeImageState. - * However, the explicit reset comes too late for the String-must-not-contain-the-home-directory - * verification in DisallowedImageHeapObjectFeature, so we also do the implicit reset using a - * substitution. + * The field cannot be reset from the #afterAnalysis(). The reset comes too late for the + * String-must-not-contain-the-home-directory verification in DisallowedImageHeapObjectFeature, + * so we do the implicit reset using a substitution. */ @Alias @RecomputeFieldValue(kind = Kind.Reset) // private static volatile Pair cacheRoot; @@ -1380,10 +1379,9 @@ final class Target_com_oracle_truffle_polyglot_InternalResourceCache { final class Target_com_oracle_truffle_polyglot_InternalResourceCache_ResettableCachedRoot { /* - * The field is also reset explicitly in InternalResourceCache.resetFileSystemNativeImageState. - * However, the explicit reset comes too late for the String-must-not-contain-the-home-directory - * verification in DisallowedImageHeapObjectFeature, so we also do the implicit reset using a - * substitution. + * The field cannot be reset from the #afterAnalysis(). The reset comes too late for the + * String-must-not-contain-the-home-directory verification in DisallowedImageHeapObjectFeature, + * so we do the implicit reset using a substitution. */ @Alias @RecomputeFieldValue(kind = Kind.Reset) // private volatile Path resourceCacheRoot; diff --git a/truffle/mx.truffle/mx_truffle.py b/truffle/mx.truffle/mx_truffle.py index a20cd51e625a..3fc81049395f 100644 --- a/truffle/mx.truffle/mx_truffle.py +++ b/truffle/mx.truffle/mx_truffle.py @@ -998,13 +998,10 @@ def register_polyglot_isolate_distributions(register_distribution, language_id, 'tag': ['default', 'public'], }, } - # the graal-enterprise may not be fully loaded - # we need to use suiteDict to get the license - graal_enterprise = mx.suite('graal-enterprise') - graal_enterprise_license = graal_enterprise.suiteDict.get('defaultLicense') - if isinstance(graal_enterprise_license, str): - graal_enterprise_license = [graal_enterprise_license] - licenses.update(graal_enterprise_license) + # The graal-enterprise suite may not be fully loaded. + # We cannot look up the TRUFFLE_ENTERPRISE distribution to resolve its license + # We pass directly the license id + licenses.update(['GFTC']) meta_pom_dist = mx_pomdistribution.POMDistribution( suite=owner_suite, name=isolate_dist_name, diff --git a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java index c11c4e98c098..1869391ec797 100644 --- a/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java +++ b/truffle/src/com.oracle.truffle.polyglot/src/com/oracle/truffle/polyglot/InternalResourceCache.java @@ -328,19 +328,6 @@ static void initializeNativeImageState(ClassLoader nativeImageClassLoader) { * {@code TruffleBaseFeature#afterAnalysis}. */ static void resetNativeImageState() { - cacheRoot = null; - for (LanguageCache language : LanguageCache.languages().values()) { - for (String resourceId : language.getResourceIds()) { - InternalResourceCache cache = language.getResourceCache(resourceId); - cache.resetFileSystemNativeImageState(); - } - } - for (InstrumentCache instrument : InstrumentCache.load()) { - for (String resourceId : instrument.getResourceIds()) { - InternalResourceCache cache = instrument.getResourceCache(resourceId); - cache.resetFileSystemNativeImageState(); - } - } nativeImageCache.clear(); } From 2f5a67c4869252008ce369d04391bda92342f2ac Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 5 Sep 2023 12:02:01 +0200 Subject: [PATCH 16/35] Allow custom mx args. (cherry picked from commit becd8d774a630852107c28ef84e25047d20e6d9a) --- vm/ci/ci_common/common.jsonnet | 5 +++-- vm/ci/ci_includes/vm.jsonnet | 3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index fe48e662e569..6ba190d56cd4 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -542,8 +542,9 @@ local devkits = graal_common.devkits; ce_licenses, legacy_mx_args:: ['--disable-installables=true', '--force-bash-launcher=true', '--skip-libraries=true'], - mx_cmd_base(os, arch):: ['mx'] + vm.maven_deploy_base_functions.dynamic_imports(os, arch) + self.legacy_mx_args, - mx_cmd_base_only_native(os, arch):: ['mx', '--dynamicimports', '/substratevm'] + self.legacy_mx_args, + mx_args(os, arch):: self.legacy_mx_args + vm.maven_deploy_base_functions.mx_args(os, arch), + mx_cmd_base(os, arch):: ['mx'] + vm.maven_deploy_base_functions.dynamic_imports(os, arch) + self.mx_args(os, arch), + mx_cmd_base_only_native(os, arch):: ['mx', '--dynamicimports', '/substratevm'] + self.mx_args(os, arch), only_native_dists:: 'TRUFFLE_NFI_NATIVE,SVM_HOSTED_NATIVE', diff --git a/vm/ci/ci_includes/vm.jsonnet b/vm/ci/ci_includes/vm.jsonnet index 346769a49741..b9596152594c 100644 --- a/vm/ci/ci_includes/vm.jsonnet +++ b/vm/ci/ci_includes/vm.jsonnet @@ -89,6 +89,9 @@ local graal_common = import '../../../ci/ci_common/common.jsonnet'; maven_deploy_base_functions: { edition:: 'ce', + mx_args(os, arch):: + [], + dynamic_imports(os, arch):: ['--dynamicimports', vm_common.maven_deploy_base_functions.dynamic_ce_imports(os, arch)], From d21242c234a2b9b9703f0457d844e94079c55ce8 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 5 Sep 2023 14:28:40 +0200 Subject: [PATCH 17/35] Add `vm` to the suites that contribute to the Maven resource bundles. (cherry picked from commit 6aaf3ac8bef998295d062ba095c93f0731e4d492) --- vm/ci/ci_common/common.jsonnet | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index 6ba190d56cd4..37e0b957f3c0 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -503,7 +503,7 @@ local devkits = graal_common.devkits; maven_deploy_base_functions: { dynamic_ce_imports(os, arch):: local legacy_imports = '/tools,/compiler,/graal-js,/espresso,/substratevm'; - local ce_windows_imports = legacy_imports + ',/wasm,/sulong,graalpython'; + local ce_windows_imports = legacy_imports + ',/vm,/wasm,/sulong,graalpython'; local non_windows_imports = ',truffleruby'; if (os == 'windows') then @@ -523,6 +523,7 @@ local devkits = graal_common.devkits; '--suite', 'substratevm', ]; local ce_windows_suites = legacy_suites + [ + '--suite', 'vm', '--suite', 'wasm', '--suite', 'sulong', '--suite', 'graalpython' From 4ed8c5c8c5147967c57faa383f0790dd87234ba2 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 5 Sep 2023 19:34:50 +0200 Subject: [PATCH 18/35] Avoid duplicated remote deployments. The CE repo remotely deploys only CE dists. The EE repo remotely deploys only EE dists. (cherry picked from commit 558e179c606763ad97f033c74736cdece6b61f18) --- vm/ci/ci_common/common.jsonnet | 35 ++++++++++++++++++++++++++++------ vm/ci/ci_includes/vm.jsonnet | 8 ++++---- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index 37e0b957f3c0..fd6c18e961c4 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -564,11 +564,20 @@ local devkits = graal_common.devkits; other_platforms:: ['linux-aarch64', 'darwin-amd64', 'darwin-aarch64', 'windows-amd64'], is_main_platform(os, arch):: os + '-' + arch == self.main_platform, - deploy(os, arch, dry_run, repo_strings):: [ + deploy_ce(os, arch, dry_run, repo_strings):: [ self.mx_cmd_base(os, arch) - + vm.maven_deploy_base_functions.suites(os, arch) + + $.maven_deploy_base_functions.ce_suites(os,arch) + self.mvn_args - + vm.maven_deploy_base_functions.licenses() + + ['--licenses', $.maven_deploy_base_functions.ce_licenses()] + + (if dry_run then ['--dry-run'] else []) + + repo_strings, + ], + + deploy_ee(os, arch, dry_run, repo_strings):: [ + self.mx_cmd_base(os, arch) + + vm.maven_deploy_base_functions.ee_suites(os, arch) + + self.mvn_args + + ['--licenses', vm.maven_deploy_base_functions.ee_licenses()] + (if dry_run then ['--dry-run'] else []) + repo_strings, ], @@ -576,7 +585,7 @@ local devkits = graal_common.devkits; deploy_only_native(os, arch, dry_run, repo_strings):: [ self.mx_cmd_base_only_native(os, arch) + self.mvn_args_only_native - + vm.maven_deploy_base_functions.licenses() + + ['--licenses', $.maven_deploy_base_functions.ce_licenses()] + (if dry_run then ['--dry-run'] else []) + repo_strings, ], @@ -587,14 +596,27 @@ local devkits = graal_common.devkits; self.mx_cmd_base(os, arch) + ['restore-pd-layouts', self.pd_layouts_archive_name(platform)] for platform in self.other_platforms ] + self.build(os, arch, mx_args=['--multi-platform-layout-directories=' + std.join(',', [self.main_platform] + self.other_platforms)], build_args=['--targets={MAVEN_TAG_DISTRIBUTIONS:public}']) # `self.only_native_dists` are in `{MAVEN_TAG_DISTRIBUTIONS:public}` - + self.deploy(os, arch, dry_run, [remote_mvn_repo]) + + ( + # remotely deploy only the suites that are defined in the current repository, to avoid duplicated deployments + if (vm.maven_deploy_base_functions.edition == 'ce') then + self.deploy_ce(os, arch, dry_run, [remote_mvn_repo]) + else + self.deploy_ee(os, arch, dry_run, [remote_mvn_repo]) + ) + [ # resource bundle ['set-export', 'VERSION_STRING', self.mx_cmd_base(os, arch) + ['--quiet', 'graalvm-version']], ['set-export', 'LOCAL_MAVEN_REPO_REL_PATH', 'maven-resource-bundle-' + vm.maven_deploy_base_functions.edition + '-${VERSION_STRING}'], ['set-export', 'LOCAL_MAVEN_REPO_URL', ['mx', '--quiet', 'local-path-to-url', '${LOCAL_MAVEN_REPO_REL_PATH}']], ] - + self.deploy(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) + + ( + # locally deploy all relevant suites + if (vm.maven_deploy_base_functions.edition == 'ce') then + self.deploy_ce(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) + else + self.deploy_ce(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) + + self.deploy_ee(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) + ) + ( if (dry_run) then [['echo', 'Skipping the archiving and the final maven deployment']] @@ -609,6 +631,7 @@ local devkits = graal_common.devkits; + ( if (vm.maven_deploy_base_functions.edition == 'ce') then self.deploy_only_native(os, arch, dry_run, [remote_mvn_repo]) +// [['foo']] else [['echo', 'Skipping the deployment of ' + self.only_native_dists + ': It is already deployed by the ce job']] ) diff --git a/vm/ci/ci_includes/vm.jsonnet b/vm/ci/ci_includes/vm.jsonnet index b9596152594c..ba3b9593ba90 100644 --- a/vm/ci/ci_includes/vm.jsonnet +++ b/vm/ci/ci_includes/vm.jsonnet @@ -95,11 +95,11 @@ local graal_common = import '../../../ci/ci_common/common.jsonnet'; dynamic_imports(os, arch):: ['--dynamicimports', vm_common.maven_deploy_base_functions.dynamic_ce_imports(os, arch)], - suites(os, arch):: - vm_common.maven_deploy_base_functions.ce_suites(os,arch), + ee_suites(os, arch):: + error 'The vm suite does not define ee suites', - licenses():: - ['--licenses', vm_common.maven_deploy_base_functions.ce_licenses()], + ee_licenses():: + error 'The vm suite does not define ee licenses', }, local builds = [ From 179007b34953f77aa62ef1d0048e8a78104302a3 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 09:55:20 +0000 Subject: [PATCH 19/35] Remove leftover code. (cherry picked from commit 81d63452d62e17248b70ab3b93415eea2164e6cc) --- vm/ci/ci_common/common.jsonnet | 1 - 1 file changed, 1 deletion(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index fd6c18e961c4..ee326b8fec8d 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -631,7 +631,6 @@ local devkits = graal_common.devkits; + ( if (vm.maven_deploy_base_functions.edition == 'ce') then self.deploy_only_native(os, arch, dry_run, [remote_mvn_repo]) -// [['foo']] else [['echo', 'Skipping the deployment of ' + self.only_native_dists + ': It is already deployed by the ce job']] ) From 862d0dbe50f13360742629824fd2155a2199bbaa Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Mon, 4 Sep 2023 18:56:44 +0200 Subject: [PATCH 20/35] Build the JS polyglot isolate. (cherry picked from commit b6e9a2208a7c92f39ec592941babcbe01d68f7eb) --- vm/ci/ci_common/common.jsonnet | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index ee326b8fec8d..79306770851b 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -542,10 +542,10 @@ local devkits = graal_common.devkits; local ce_licenses = legacy_licenses + ',PSF-License,BSD-simplified,BSD-new,EPL-2.0'; ce_licenses, - legacy_mx_args:: ['--disable-installables=true', '--force-bash-launcher=true', '--skip-libraries=true'], + legacy_mx_args:: ['--disable-installables=true'], # `['--force-bash-launcher=true', '--skip-libraries=true']` have been replaced by `--native-images=lib:jsvm` and `--native-images=false` mx_args(os, arch):: self.legacy_mx_args + vm.maven_deploy_base_functions.mx_args(os, arch), - mx_cmd_base(os, arch):: ['mx'] + vm.maven_deploy_base_functions.dynamic_imports(os, arch) + self.mx_args(os, arch), - mx_cmd_base_only_native(os, arch):: ['mx', '--dynamicimports', '/substratevm'] + self.mx_args(os, arch), + mx_cmd_base(os, arch):: ['mx'] + vm.maven_deploy_base_functions.dynamic_imports(os, arch) + self.mx_args(os, arch) + ['--native-images=lib:jsvm'], + mx_cmd_base_only_native(os, arch):: ['mx', '--dynamicimports', '/substratevm'] + self.mx_args(os, arch) + ['--native-images=false'], only_native_dists:: 'TRUFFLE_NFI_NATIVE,SVM_HOSTED_NATIVE', From 9a57ceaf8c29de3643b393ebe34747f8e15c1f4a Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 5 Sep 2023 20:03:35 +0200 Subject: [PATCH 21/35] EE deployments include only dummy javadoc. (cherry picked from commit 90567f9bdc72921274b8e492549ae0d811f5edc6) --- vm/ci/ci_common/common.jsonnet | 1 + 1 file changed, 1 insertion(+) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index 79306770851b..e2383eea0259 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -577,6 +577,7 @@ local devkits = graal_common.devkits; self.mx_cmd_base(os, arch) + vm.maven_deploy_base_functions.ee_suites(os, arch) + self.mvn_args + + ['--dummy-javadoc'] + ['--licenses', vm.maven_deploy_base_functions.ee_licenses()] + (if dry_run then ['--dry-run'] else []) + repo_strings, From d34bfc3ecddd8b1ab6cd5b1f6f1e7feedc90b8ec Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 5 Sep 2023 20:10:15 +0200 Subject: [PATCH 22/35] EE Maven deploy jobs use JDK21. (cherry picked from commit d7d69ae83811d00b8353abbe7061aaf725fec459) --- vm/ci/ci_common/common.jsonnet | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index e2383eea0259..13dbdbac4877 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -454,12 +454,19 @@ local devkits = graal_common.devkits; graalvm_complete_build_deps(edition, os, arch): local java_deps(edition) = - if (edition == 'ce' || edition == 'ee') then { + if (edition == 'ce') then + { downloads+: { JAVA_HOME: graal_common.jdks_data['labsjdk-' + edition + '-17'], EXTRA_JAVA_HOMES: graal_common.jdks_data['labsjdk-' + edition + '-21'], } } + else if (edition == 'ee') then + { + downloads+: { + JAVA_HOME: graal_common.jdks_data['labsjdk-' + edition + '-21'], + } + } else error 'Unknown edition: ' + edition; From 02d1da601a7bff3ee856559462dbd3f58a17a3c6 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Tue, 5 Sep 2023 21:38:51 +0200 Subject: [PATCH 23/35] Add platforms to generated isolate library layout distributions. (cherry picked from commit 12a2140430e334eb9c6bc682b3fc9bb290c7e970) --- sdk/mx.sdk/mx_sdk_vm.py | 1 + sdk/mx.sdk/mx_sdk_vm_impl.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/sdk/mx.sdk/mx_sdk_vm.py b/sdk/mx.sdk/mx_sdk_vm.py index beeaecf335df..beb81671c227 100644 --- a/sdk/mx.sdk/mx_sdk_vm.py +++ b/sdk/mx.sdk/mx_sdk_vm.py @@ -201,6 +201,7 @@ def __init__(self, jar_distributions, build_args, language, main_class=None, is_ """ :param str language :param str main_class + :param isolate_library_layout_distribution dict """ kwargs.pop('destination', None) super(LanguageLibraryConfig, self).__init__('lib/', jar_distributions, build_args, home_finder=True, headers=headers, **kwargs) diff --git a/sdk/mx.sdk/mx_sdk_vm_impl.py b/sdk/mx.sdk/mx_sdk_vm_impl.py index 0199f91930ca..b9bb1567a09e 100644 --- a/sdk/mx.sdk/mx_sdk_vm_impl.py +++ b/sdk/mx.sdk/mx_sdk_vm_impl.py @@ -3519,7 +3519,7 @@ def mx_register_dynamic_suite_constituents(register_project, register_distributi } register_distribution(mx.LayoutDirDistribution( suite=_suite, - name=library_config.isolate_library_layout_distribution, + name=library_config.isolate_library_layout_distribution['name'], deps=[], layout={ f'{resource_base_folder}/': f'dependency:{library_project.name}' @@ -3527,6 +3527,7 @@ def mx_register_dynamic_suite_constituents(register_project, register_distributi path=None, platformDependent=True, theLicense=None, + platforms=library_config.isolate_library_layout_distribution['platforms'], **attrs )) if isinstance(component, mx_sdk.GraalVmLanguage) and component.support_distributions: From 97533950f7ac30e2f58e2ec018d311449f5419d7 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 12:31:12 +0200 Subject: [PATCH 24/35] Delegate decistions about native images to the vm suite. (cherry picked from commit ade02761bfcab7a822a187e79a8b306a9fb79af0) --- vm/ci/ci_common/common.jsonnet | 6 +++--- vm/ci/ci_includes/vm.jsonnet | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index 13dbdbac4877..392f0b1c33dd 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -549,10 +549,10 @@ local devkits = graal_common.devkits; local ce_licenses = legacy_licenses + ',PSF-License,BSD-simplified,BSD-new,EPL-2.0'; ce_licenses, - legacy_mx_args:: ['--disable-installables=true'], # `['--force-bash-launcher=true', '--skip-libraries=true']` have been replaced by `--native-images=lib:jsvm` and `--native-images=false` + legacy_mx_args:: ['--disable-installables=true'], # `['--force-bash-launcher=true', '--skip-libraries=true']` have been replaced by arguments from `vm.maven_deploy_base_functions.mx_args(os, arch)` mx_args(os, arch):: self.legacy_mx_args + vm.maven_deploy_base_functions.mx_args(os, arch), - mx_cmd_base(os, arch):: ['mx'] + vm.maven_deploy_base_functions.dynamic_imports(os, arch) + self.mx_args(os, arch) + ['--native-images=lib:jsvm'], - mx_cmd_base_only_native(os, arch):: ['mx', '--dynamicimports', '/substratevm'] + self.mx_args(os, arch) + ['--native-images=false'], + mx_cmd_base(os, arch):: ['mx'] + vm.maven_deploy_base_functions.dynamic_imports(os, arch) + self.mx_args(os, arch), + mx_cmd_base_only_native(os, arch):: ['mx', '--dynamicimports', '/substratevm'] + self.mx_args(os, arch) + ['--native-images=false'], # `--native-images=false` takes precedence over `self.mx_args(os, arch)` only_native_dists:: 'TRUFFLE_NFI_NATIVE,SVM_HOSTED_NATIVE', diff --git a/vm/ci/ci_includes/vm.jsonnet b/vm/ci/ci_includes/vm.jsonnet index ba3b9593ba90..472d0566c549 100644 --- a/vm/ci/ci_includes/vm.jsonnet +++ b/vm/ci/ci_includes/vm.jsonnet @@ -90,7 +90,7 @@ local graal_common = import '../../../ci/ci_common/common.jsonnet'; edition:: 'ce', mx_args(os, arch):: - [], + ['--native-images=false'], dynamic_imports(os, arch):: ['--dynamicimports', vm_common.maven_deploy_base_functions.dynamic_ce_imports(os, arch)], From 94e9ce8547305edd803f67675015a35c455dd011 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 13:45:08 +0200 Subject: [PATCH 25/35] Bump mx version. (cherry picked from commit 9f863a5b61bafe77112f5a990cb21467b7af1590) --- common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.json b/common.json index 56e5ef002999..76ccc54ec676 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.45.0", + "mx_version": "6.46.0", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { From d5ea0fc3f2b81d18cead334ef8563eb1c8523d61 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Wed, 6 Sep 2023 14:12:27 +0200 Subject: [PATCH 26/35] [GR-47432] Make sdk:MAVEN_DOWNLOADER a module --- sdk/mx.sdk/suite.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/sdk/mx.sdk/suite.py b/sdk/mx.sdk/suite.py index e3e96844fc34..26c2e2e4922e 100644 --- a/sdk/mx.sdk/suite.py +++ b/sdk/mx.sdk/suite.py @@ -769,6 +769,12 @@ class UniversalDetector { }, "MAVEN_DOWNLOADER": { + "moduleInfo" : { + "name" : "org.graalvm.maven.downloader", + "exports" : [ + "org.graalvm.maven.downloader", + ], + }, "defaultBuild": False, "mainClass": "org.graalvm.maven.downloader.Main", "dependencies": [ From 7118855a08d5d000b032bd1872a9b4f53e0742a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerg=C3=B6=20Barany?= Date: Wed, 6 Sep 2023 14:53:45 +0200 Subject: [PATCH 27/35] Add OSR test with boolean array accesses --- .../compiler/hotspot/test/GraalOSRTest.java | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java b/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java index 5f39fb17320e..56ac2d0181b9 100644 --- a/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java +++ b/compiler/src/jdk.internal.vm.compiler.test/src/org/graalvm/compiler/hotspot/test/GraalOSRTest.java @@ -28,6 +28,8 @@ import org.junit.Assert; import org.junit.Test; +import sun.misc.Unsafe; + /** * Test on-stack-replacement with Graal. The test manually triggers a Graal OSR-compilation which is * later invoked when hitting the backedge counter overflow. @@ -58,6 +60,11 @@ public void testOSR04() { testOSR(getInitialOptions(), "testDeoptAfterCountedLoop"); } + @Test + public void testOSR05() { + testOSR(getInitialOptions(), "testBooleanArray"); + } + static int limit = 10000; public static int sideEffect; @@ -115,4 +122,18 @@ public static ReturnValue testDeoptAfterCountedLoop() { GraalDirectives.controlFlowAnchor(); return ret + 1 == limit * limit ? ReturnValue.SUCCESS : ReturnValue.FAILURE; } + + public static ReturnValue testBooleanArray() { + boolean[] array = new boolean[16]; + for (int i = 0; GraalDirectives.injectIterationCount(17, i < array.length); i++) { + array[i] = !array[i]; + + byte rawValue = UNSAFE.getByte(array, Unsafe.ARRAY_BYTE_BASE_OFFSET + i * Unsafe.ARRAY_BYTE_INDEX_SCALE); + if (rawValue != 1) { + return ReturnValue.FAILURE; + } + } + GraalDirectives.controlFlowAnchor(); + return ReturnValue.SUCCESS; + } } From e30698b53f00a021fce8e7be17da960fcb4a262a Mon Sep 17 00:00:00 2001 From: Bernhard Urban-Forster Date: Wed, 6 Sep 2023 15:57:26 +0200 Subject: [PATCH 28/35] [GR-43389] [darwin-amd64] Workaround for buggy ld64 versions Some versions of `ld64` cannot deal with DIRECT8 relocations in the `.text` section. Approximately this is since version 820.1 (Xcode 14). Starting with Xcode15 beta3 the default linker has been replaced with "the new linker" (version 902.11) which does not suffer from this bug anymore. However, Xcode also ships a `ld-classic` which reassembles "the old linker" and is still affected by this bug (and it of course prints the same version number). See some more in-depth analysis of this ld64 bug in https://openradar.appspot.com/FB11942354 The workaround: Instead of emitting the address of a HostedMethod inlined, it will be put in the data section and thus requires a memory load to obtain it. --- .../AMD64LoadMethodPointerConstantOp.java | 12 ++++++-- .../core/graal/code/SubstrateDataBuilder.java | 27 ++++++++++------- .../oracle/svm/hosted/code/CompileQueue.java | 29 ++++++++++++++----- .../code/amd64/AMD64HostedPatcherFeature.java | 1 + .../hosted/image/NativeImageCodeCache.java | 6 ++-- .../hosted/image/NativeImageHeapWriter.java | 18 ++++++++++-- 6 files changed, 68 insertions(+), 25 deletions(-) diff --git a/substratevm/src/com.oracle.svm.core.graal.amd64/src/com/oracle/svm/core/graal/amd64/AMD64LoadMethodPointerConstantOp.java b/substratevm/src/com.oracle.svm.core.graal.amd64/src/com/oracle/svm/core/graal/amd64/AMD64LoadMethodPointerConstantOp.java index 46ec57d7ab26..df38fd162b75 100644 --- a/substratevm/src/com.oracle.svm.core.graal.amd64/src/com/oracle/svm/core/graal/amd64/AMD64LoadMethodPointerConstantOp.java +++ b/substratevm/src/com.oracle.svm.core.graal.amd64/src/com/oracle/svm/core/graal/amd64/AMD64LoadMethodPointerConstantOp.java @@ -28,6 +28,8 @@ import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.HINT; import static org.graalvm.compiler.lir.LIRInstruction.OperandFlag.REG; +import com.oracle.svm.core.FrameAccess; +import org.graalvm.compiler.asm.amd64.AMD64Address; import org.graalvm.compiler.asm.amd64.AMD64MacroAssembler; import org.graalvm.compiler.lir.LIRInstructionClass; import org.graalvm.compiler.lir.StandardOp; @@ -38,6 +40,7 @@ import jdk.vm.ci.code.Register; import jdk.vm.ci.meta.AllocatableValue; +import org.graalvm.nativeimage.Platform; public final class AMD64LoadMethodPointerConstantOp extends AMD64LIRInstruction implements StandardOp.LoadConstantOp { public static final LIRInstructionClass TYPE = LIRInstructionClass.create(AMD64LoadMethodPointerConstantOp.class); @@ -53,8 +56,13 @@ public final class AMD64LoadMethodPointerConstantOp extends AMD64LIRInstruction @Override public void emitCode(CompilationResultBuilder crb, AMD64MacroAssembler masm) { Register resultReg = asRegister(result); - crb.recordInlineDataInCode(constant); - masm.movq(resultReg, 0L, true); + if (!Platform.includedIn(Platform.DARWIN_AMD64.class)) { + crb.recordInlineDataInCode(constant); + masm.movq(resultReg, 0L, true); + } else { + /* [GR-43389] ld64 bug does not allow direct8 relocations in .text on darwin */ + masm.movq(resultReg, (AMD64Address) crb.recordDataReferenceInCode(constant, FrameAccess.wordSize())); + } } @Override diff --git a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/SubstrateDataBuilder.java b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/SubstrateDataBuilder.java index abccd9e73d3d..16df77749125 100644 --- a/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/SubstrateDataBuilder.java +++ b/substratevm/src/com.oracle.svm.core/src/com/oracle/svm/core/graal/code/SubstrateDataBuilder.java @@ -28,6 +28,7 @@ import java.nio.ByteBuffer; +import com.oracle.svm.core.meta.SubstrateMethodPointerConstant; import org.graalvm.compiler.code.DataSection.Data; import org.graalvm.compiler.code.DataSection.Patches; import org.graalvm.compiler.core.common.type.CompressibleConstant; @@ -50,8 +51,11 @@ public class SubstrateDataBuilder extends DataBuilder { @Override public Data createDataItem(Constant constant) { int size; - if (constant instanceof VMConstant vmConstant) { - assert constant instanceof JavaConstant && constant instanceof CompressibleConstant && constant instanceof TypedConstant : constant; + if (constant instanceof SubstrateMethodPointerConstant methodPointerConstant) { + size = FrameAccess.wordSize(); + return new ObjectData(size, size, methodPointerConstant); + } else if (constant instanceof VMConstant vmConstant) { + assert constant instanceof CompressibleConstant && constant instanceof TypedConstant : constant; return new ObjectData(vmConstant); } else if (JavaConstant.isNull(constant)) { if (SubstrateObjectConstant.isCompressed((JavaConstant) constant)) { @@ -60,9 +64,8 @@ public Data createDataItem(Constant constant) { size = FrameAccess.uncompressedReferenceSize(); } return createZeroData(size, size); - } else if (constant instanceof SerializableConstant) { - SerializableConstant s = (SerializableConstant) constant; - return createSerializableData(s); + } else if (constant instanceof SerializableConstant serializableConstant) { + return createSerializableData(serializableConstant); } else { throw new JVMCIError(String.valueOf(constant)); } @@ -71,15 +74,19 @@ public Data createDataItem(Constant constant) { public static class ObjectData extends Data { private final VMConstant constant; + protected ObjectData(int alignment, int size, VMConstant constant) { + super(alignment, size); + this.constant = constant; + } + protected ObjectData(VMConstant constant) { - super(ConfigurationValues.getObjectLayout().getReferenceSize(), ConfigurationValues.getObjectLayout().getReferenceSize()); + this(ConfigurationValues.getObjectLayout().getReferenceSize(), ConfigurationValues.getObjectLayout().getReferenceSize(), constant); assert ((CompressibleConstant) constant).isCompressed() == ReferenceAccess.singleton() .haveCompressedReferences() : "Constant object references in compiled code must be compressed (base-relative)"; - this.constant = constant; } - public JavaConstant getConstant() { - return (JavaConstant) constant; + public VMConstant getConstant() { + return constant; } @Override @@ -92,7 +99,7 @@ public static void emit(ByteBuffer buffer, Patches patches, int size, VMConstant if (size == Integer.BYTES) { buffer.putInt(0); } else if (size == Long.BYTES) { - buffer.putLong(0L); + buffer.putLong(0); } else { shouldNotReachHere("Unsupported object constant reference size: " + size); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java index f59a982b974f..ed9bef9f3994 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/CompileQueue.java @@ -39,6 +39,7 @@ import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ForkJoinPool; +import com.oracle.svm.core.graal.code.SubstrateDataBuilder; import org.graalvm.collections.EconomicMap; import org.graalvm.compiler.api.replacements.Fold; import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; @@ -122,7 +123,6 @@ import com.oracle.svm.core.graal.phases.OptimizeExceptionPathsPhase; import com.oracle.svm.core.heap.RestrictHeapAccess; import com.oracle.svm.core.heap.RestrictHeapAccessCallees; -import com.oracle.svm.core.meta.MethodPointer; import com.oracle.svm.core.meta.SubstrateMethodPointerConstant; import com.oracle.svm.core.util.InterruptImageBuilding; import com.oracle.svm.core.util.VMError; @@ -151,6 +151,7 @@ import jdk.vm.ci.meta.MetaAccessProvider; import jdk.vm.ci.meta.ResolvedJavaMethod; import jdk.vm.ci.meta.VMConstant; +import org.graalvm.nativeimage.Platform; public class CompileQueue { @@ -1368,15 +1369,29 @@ protected void removeDeoptTargetOptimizations(LIRSuites lirSuites) { DeoptimizationUtils.removeDeoptTargetOptimizations(lirSuites); } + private void ensureCompiledForMethodPointerConstant(HostedMethod method, CompileReason reason, SubstrateMethodPointerConstant methodPointerConstant) { + HostedMethod referencedMethod = (HostedMethod) methodPointerConstant.pointer().getMethod(); + ensureCompiled(referencedMethod, new MethodPointerConstantReason(method, referencedMethod, reason)); + } + protected final void ensureCompiledForMethodPointerConstants(HostedMethod method, CompileReason reason, CompilationResult result) { for (DataPatch dataPatch : result.getDataPatches()) { Reference reference = dataPatch.reference; - if (reference instanceof ConstantReference) { - VMConstant constant = ((ConstantReference) reference).getConstant(); - if (constant instanceof SubstrateMethodPointerConstant) { - MethodPointer pointer = ((SubstrateMethodPointerConstant) constant).pointer(); - HostedMethod referencedMethod = (HostedMethod) pointer.getMethod(); - ensureCompiled(referencedMethod, new MethodPointerConstantReason(method, referencedMethod, reason)); + if (reference instanceof ConstantReference constantReference) { + VMConstant vmConstant = constantReference.getConstant(); + if (vmConstant instanceof SubstrateMethodPointerConstant methodPointerConstant) { + ensureCompiledForMethodPointerConstant(method, reason, methodPointerConstant); + } + } + } + + for (DataSection.Data data : result.getDataSection()) { + if (data instanceof SubstrateDataBuilder.ObjectData objectData) { + VMConstant vmConstant = objectData.getConstant(); + if (vmConstant instanceof SubstrateMethodPointerConstant methodPointerConstant) { + /* [GR-43389] Only reachable with ld64 workaround on */ + VMError.guarantee(Platform.includedIn(Platform.DARWIN_AMD64.class)); + ensureCompiledForMethodPointerConstant(method, reason, methodPointerConstant); } } } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/amd64/AMD64HostedPatcherFeature.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/amd64/AMD64HostedPatcherFeature.java index 6b341a19d53c..8258907c0d20 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/amd64/AMD64HostedPatcherFeature.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/code/amd64/AMD64HostedPatcherFeature.java @@ -126,6 +126,7 @@ public void relocate(Reference ref, RelocatableBuffer relocs, int compStart) { VMConstant constant = ((ConstantReference) ref).getConstant(); Object relocVal = ref; if (constant instanceof SubstrateMethodPointerConstant) { + VMError.guarantee(!Platform.includedIn(Platform.DARWIN_AMD64.class), "[GR-43389] method pointer relocations should not be inlined."); MethodPointer pointer = ((SubstrateMethodPointerConstant) constant).pointer(); HostedMethod hMethod = (HostedMethod) pointer.getMethod(); VMError.guarantee(hMethod.isCompiled(), "Method %s is not compiled although there is a method pointer constant created for it.", hMethod); diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java index 07a2b3eb5a16..f052c9279027 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageCodeCache.java @@ -187,7 +187,7 @@ public void layoutConstants() { CompilationResult compilation = pair.getRight(); for (DataSection.Data data : compilation.getDataSection()) { if (data instanceof SubstrateDataBuilder.ObjectData) { - JavaConstant constant = ((SubstrateDataBuilder.ObjectData) data).getConstant(); + VMConstant constant = ((SubstrateDataBuilder.ObjectData) data).getConstant(); constantReasons.put(constant, compilation.getName()); } } @@ -207,7 +207,7 @@ public void layoutConstants() { public void addConstantsToHeap() { for (DataSection.Data data : dataSection) { if (data instanceof SubstrateDataBuilder.ObjectData) { - JavaConstant constant = ((SubstrateDataBuilder.ObjectData) data).getConstant(); + VMConstant constant = ((SubstrateDataBuilder.ObjectData) data).getConstant(); addConstantToHeap(constant, NativeImageHeap.HeapInclusionReason.DataSection); } } @@ -585,7 +585,7 @@ protected boolean verifyMethods(HostedUniverse hUniverse, ForkJoinPool threadPoo public void writeConstants(NativeImageHeapWriter writer, RelocatableBuffer buffer) { ByteBuffer bb = buffer.getByteBuffer(); dataSection.buildDataSection(bb, (position, constant) -> { - writer.writeReference(buffer, position, (JavaConstant) constant, "VMConstant: " + constant); + writer.writeReference(buffer, position, constant, "VMConstant: " + constant); }); } diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageHeapWriter.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageHeapWriter.java index 6f5c6f0fc838..ab80403ad89b 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageHeapWriter.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/image/NativeImageHeapWriter.java @@ -31,12 +31,15 @@ import java.lang.reflect.Modifier; import java.nio.ByteBuffer; +import com.oracle.svm.core.meta.SubstrateMethodPointerConstant; +import jdk.vm.ci.meta.Constant; import org.graalvm.compiler.api.replacements.SnippetReflectionProvider; import org.graalvm.compiler.core.common.CompressEncoding; import org.graalvm.compiler.core.common.NumUtil; import org.graalvm.compiler.debug.DebugContext; import org.graalvm.compiler.debug.Indent; import org.graalvm.nativeimage.ImageSingletons; +import org.graalvm.nativeimage.Platform; import org.graalvm.nativeimage.c.function.CFunctionPointer; import org.graalvm.nativeimage.c.function.RelocatedPointer; import org.graalvm.word.WordBase; @@ -165,10 +168,16 @@ private void write(RelocatableBuffer buffer, int index, JavaConstant con, Object private final boolean useHeapBase = NativeImageHeap.useHeapBase(); private final CompressEncoding compressEncoding = ImageSingletons.lookup(CompressEncoding.class); - void writeReference(RelocatableBuffer buffer, int index, JavaConstant target, Object reason) { - assert !(heap.hMetaAccess.isInstanceOf(target, WordBase.class)) : "word values are not references"; + void writeReference(RelocatableBuffer buffer, int index, Constant constant, Object reason) { mustBeReferenceAligned(index); - if (target.isNonNull()) { + + if (constant instanceof JavaConstant target) { + assert !(heap.hMetaAccess.isInstanceOf(target, WordBase.class)) : "word values are not references"; + + if (target.isNull()) { + return; + } + ObjectInfo targetInfo = heap.getConstantInfo(target); verifyTargetDidNotChange(target, reason, targetInfo); if (useHeapBase) { @@ -177,6 +186,9 @@ void writeReference(RelocatableBuffer buffer, int index, JavaConstant target, Ob } else { addDirectRelocationWithoutAddend(buffer, index, referenceSize(), target); } + } else { + assert Platform.includedIn(Platform.DARWIN_AMD64.class) : "[GR-43389] Workaround for ld64 bug that does not allow direct8 relocations in .text on amd64"; + buffer.addRelocationWithoutAddend(index, ObjectFile.RelocationKind.DIRECT_8, ((SubstrateMethodPointerConstant) constant).pointer()); } } From 739b4351931b00166e013639ef3a354f7884287d Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 15:15:11 +0200 Subject: [PATCH 29/35] Bump mx version. --- common.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/common.json b/common.json index 76ccc54ec676..0c661adadbee 100644 --- a/common.json +++ b/common.json @@ -4,7 +4,7 @@ "Jsonnet files should not include this file directly but use ci/common.jsonnet instead." ], - "mx_version": "6.46.0", + "mx_version": "6.46.1", "COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet", "jdks": { From edb835a69df6bbc63d1bdb1d86641a85d5599765 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 16:58:34 +0200 Subject: [PATCH 30/35] In the EE bundle, also CE artifacts have dummy javadocs. We can't build them on JDK21. --- vm/ci/ci_common/common.jsonnet | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index 392f0b1c33dd..dde76135d602 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -571,31 +571,30 @@ local devkits = graal_common.devkits; other_platforms:: ['linux-aarch64', 'darwin-amd64', 'darwin-aarch64', 'windows-amd64'], is_main_platform(os, arch):: os + '-' + arch == self.main_platform, - deploy_ce(os, arch, dry_run, repo_strings):: [ + deploy_ce(os, arch, dry_run, extra_args):: [ self.mx_cmd_base(os, arch) + $.maven_deploy_base_functions.ce_suites(os,arch) + self.mvn_args + ['--licenses', $.maven_deploy_base_functions.ce_licenses()] + (if dry_run then ['--dry-run'] else []) - + repo_strings, + + extra_args, ], - deploy_ee(os, arch, dry_run, repo_strings):: [ + deploy_ee(os, arch, dry_run, extra_args):: [ self.mx_cmd_base(os, arch) + vm.maven_deploy_base_functions.ee_suites(os, arch) + self.mvn_args - + ['--dummy-javadoc'] + ['--licenses', vm.maven_deploy_base_functions.ee_licenses()] + (if dry_run then ['--dry-run'] else []) - + repo_strings, + + extra_args, ], - deploy_only_native(os, arch, dry_run, repo_strings):: [ + deploy_only_native(os, arch, dry_run, extra_args):: [ self.mx_cmd_base_only_native(os, arch) + self.mvn_args_only_native + ['--licenses', $.maven_deploy_base_functions.ce_licenses()] + (if dry_run then ['--dry-run'] else []) - + repo_strings, + + extra_args, ], run_block(os, arch, dry_run, remote_mvn_repo, remote_non_mvn_repo, local_repo):: @@ -609,7 +608,7 @@ local devkits = graal_common.devkits; if (vm.maven_deploy_base_functions.edition == 'ce') then self.deploy_ce(os, arch, dry_run, [remote_mvn_repo]) else - self.deploy_ee(os, arch, dry_run, [remote_mvn_repo]) + self.deploy_ee(os, arch, dry_run, ['--dummy-javadoc', remote_mvn_repo]) ) + [ # resource bundle @@ -622,8 +621,8 @@ local devkits = graal_common.devkits; if (vm.maven_deploy_base_functions.edition == 'ce') then self.deploy_ce(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) else - self.deploy_ce(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) - + self.deploy_ee(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) + self.deploy_ce(os, arch, dry_run, ['--dummy-javadoc', local_repo, '${LOCAL_MAVEN_REPO_URL}']) + + self.deploy_ee(os, arch, dry_run, ['--dummy-javadoc', local_repo, '${LOCAL_MAVEN_REPO_URL}']) ) + ( if (dry_run) then From 032b5037e06c3b1f0582a364ffa905325ea3f245 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 15:52:29 +0200 Subject: [PATCH 31/35] Rename 'Java' standalones to 'JVM' standalones. (cherry picked from commit b7d0920d4c6a3b5276382c5b1e5a245fd896ec28) --- vm/ce-release-artifacts.json | 48 ++++++++++++++++++------------------ 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/vm/ce-release-artifacts.json b/vm/ce-release-artifacts.json index e34aa858be04..ab6709400dd5 100644 --- a/vm/ce-release-artifacts.json +++ b/vm/ce-release-artifacts.json @@ -81,27 +81,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" } ] }, @@ -147,27 +147,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" } ] }, @@ -208,22 +208,22 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" } ] }, @@ -269,27 +269,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" } ] }, @@ -335,27 +335,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-java-{version}-macos-{arch}" + "name_template": "{name}-community-jvm-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-java-{version}-{os}-{arch}" + "name_template": "{name}-community-jvm-{version}-{os}-{arch}" } ] }, From c21e84ea86b19f7b9ca16a86eb3943c155097e40 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 15:53:08 +0200 Subject: [PATCH 32/35] Rename 'Native' Standalones to the legacy name. (cherry picked from commit ae0c134aa8b377e77fd4d76b712dbd239616d55f) --- vm/ce-release-artifacts.json | 58 ++++++++++++++++++------------------ 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/vm/ce-release-artifacts.json b/vm/ce-release-artifacts.json index ab6709400dd5..496980db4a78 100644 --- a/vm/ce-release-artifacts.json +++ b/vm/ce-release-artifacts.json @@ -48,27 +48,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" } ] }, @@ -114,27 +114,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" } ] }, @@ -180,22 +180,22 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" } ] }, @@ -236,27 +236,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" } ] }, @@ -302,27 +302,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" } ] }, @@ -368,27 +368,27 @@ { "os": "linux", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "linux", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" }, { "os": "darwin", "arch": "amd64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "darwin", "arch": "aarch64", - "name_template": "{name}-community-native-{version}-macos-{arch}" + "name_template": "{name}-community-{version}-macos-{arch}" }, { "os": "windows", "arch": "amd64", - "name_template": "{name}-community-native-{version}-{os}-{arch}" + "name_template": "{name}-community-{version}-{os}-{arch}" } ] } From 88a23950d5bb398fb8a6b9ec596a1bbc28a52fa0 Mon Sep 17 00:00:00 2001 From: Danilo Ansaloni Date: Wed, 6 Sep 2023 20:26:22 +0200 Subject: [PATCH 33/35] The JS_ISOLATE distribution requires the set of EE licenses. --- vm/ci/ci_common/common.jsonnet | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/vm/ci/ci_common/common.jsonnet b/vm/ci/ci_common/common.jsonnet index dde76135d602..826066f1a236 100644 --- a/vm/ci/ci_common/common.jsonnet +++ b/vm/ci/ci_common/common.jsonnet @@ -571,26 +571,29 @@ local devkits = graal_common.devkits; other_platforms:: ['linux-aarch64', 'darwin-amd64', 'darwin-aarch64', 'windows-amd64'], is_main_platform(os, arch):: os + '-' + arch == self.main_platform, - deploy_ce(os, arch, dry_run, extra_args):: [ + deploy_ce(os, arch, dry_run, extra_args, extra_mx_args=[]):: [ self.mx_cmd_base(os, arch) + $.maven_deploy_base_functions.ce_suites(os,arch) + + extra_mx_args + self.mvn_args + ['--licenses', $.maven_deploy_base_functions.ce_licenses()] + (if dry_run then ['--dry-run'] else []) + extra_args, ], - deploy_ee(os, arch, dry_run, extra_args):: [ + deploy_ee(os, arch, dry_run, extra_args, extra_mx_args=[]):: [ self.mx_cmd_base(os, arch) + vm.maven_deploy_base_functions.ee_suites(os, arch) + + extra_mx_args + self.mvn_args + ['--licenses', vm.maven_deploy_base_functions.ee_licenses()] + (if dry_run then ['--dry-run'] else []) + extra_args, ], - deploy_only_native(os, arch, dry_run, extra_args):: [ + deploy_only_native(os, arch, dry_run, extra_args, extra_mx_args=[]):: [ self.mx_cmd_base_only_native(os, arch) + + extra_mx_args + self.mvn_args_only_native + ['--licenses', $.maven_deploy_base_functions.ce_licenses()] + (if dry_run then ['--dry-run'] else []) @@ -609,6 +612,7 @@ local devkits = graal_common.devkits; self.deploy_ce(os, arch, dry_run, [remote_mvn_repo]) else self.deploy_ee(os, arch, dry_run, ['--dummy-javadoc', remote_mvn_repo]) + + self.deploy_ee(os, arch, dry_run, ['--dummy-javadoc', '--only', 'JS_ISOLATE', remote_mvn_repo], extra_mx_args=['--suite', 'graal-js']) ) + [ # resource bundle @@ -621,7 +625,8 @@ local devkits = graal_common.devkits; if (vm.maven_deploy_base_functions.edition == 'ce') then self.deploy_ce(os, arch, dry_run, [local_repo, '${LOCAL_MAVEN_REPO_URL}']) else - self.deploy_ce(os, arch, dry_run, ['--dummy-javadoc', local_repo, '${LOCAL_MAVEN_REPO_URL}']) + self.deploy_ce(os, arch, dry_run, ['--dummy-javadoc', '--skip', 'JS_ISOLATE', local_repo, '${LOCAL_MAVEN_REPO_URL}']) + + self.deploy_ee(os, arch, dry_run, ['--dummy-javadoc', '--only', 'JS_ISOLATE', local_repo, '${LOCAL_MAVEN_REPO_URL}'], extra_mx_args=['--suite', 'graal-js']) + self.deploy_ee(os, arch, dry_run, ['--dummy-javadoc', local_repo, '${LOCAL_MAVEN_REPO_URL}']) ) + ( From edffdef7b8870715261e58fc2fbb20dd79590651 Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 7 Sep 2023 09:52:56 +0200 Subject: [PATCH 34/35] Hide usages of stable/internal multi-options. --- .../src/com/oracle/svm/hosted/ProgressReporter.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java index f2c1c5eb381c..298539a9389f 100644 --- a/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java +++ b/substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/ProgressReporter.java @@ -331,13 +331,13 @@ private void printExperimentalOptions(ImageClassLoader classLoader) { if (lmov.getValuesWithOrigins().allMatch(o -> o.getRight().isStable())) { continue; } else { - origins = lmov.getValuesWithOrigins().map(p -> p.getRight().toString()).collect(Collectors.joining(", ")); + origins = lmov.getValuesWithOrigins().filter(p -> !isStableOrInternalOrigin(p.getRight())).map(p -> p.getRight().toString()).collect(Collectors.joining(", ")); alternatives = lmov.getValuesWithOrigins().map(p -> SubstrateOptionsParser.commandArgument(hok, p.getLeft().toString())).filter(c -> !c.startsWith(hostedOptionPrefix)) .collect(Collectors.joining(", ")); } } else { OptionOrigin origin = hok.getLastOrigin(); - if (origin == null /* unknown */ || origin.isStable() || origin.isInternal()) { + if (origin == null /* unknown */ || isStableOrInternalOrigin(origin)) { continue; } origins = origin.toString(); @@ -370,6 +370,10 @@ private void printExperimentalOptions(ImageClassLoader classLoader) { } } + private static boolean isStableOrInternalOrigin(OptionOrigin origin) { + return origin.isStable() || origin.isInternal(); + } + private void printResourceInfo() { Runtime runtime = Runtime.getRuntime(); long maxMemory = runtime.maxMemory(); From aa229b363215fd4944e653c00a0326b8225b90ac Mon Sep 17 00:00:00 2001 From: Fabio Niephaus Date: Thu, 7 Sep 2023 13:50:06 +0200 Subject: [PATCH 35/35] `libpolyglot` needs at least 20G of memory. --- sdk/mx.sdk/mx_sdk_vm_impl.py | 1 + 1 file changed, 1 insertion(+) diff --git a/sdk/mx.sdk/mx_sdk_vm_impl.py b/sdk/mx.sdk/mx_sdk_vm_impl.py index 279273e600c7..1d6603eced7e 100644 --- a/sdk/mx.sdk/mx_sdk_vm_impl.py +++ b/sdk/mx.sdk/mx_sdk_vm_impl.py @@ -205,6 +205,7 @@ def add_dependencies(dependencies, excludes=True): # the `GraalVmNativeImage` project has a build-time dependency to Stage1 jar_distributions=[], build_args=[ + '-J-Xms20G', '-Dgraalvm.libpolyglot=true', '-Dorg.graalvm.polyglot.install_name_id=@rpath//lib/polyglot/', '--tool:all',