Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@ public interface pthread_key_tPointer extends PointerBase {
pthread_key_t read();
}

@CConstant
public static native int PTHREAD_KEYS_MAX();

@CConstant
public static native int PTHREAD_CREATE_JOINABLE();

Expand All @@ -98,9 +95,6 @@ public interface pthread_key_tPointer extends PointerBase {
@CFunction(value = "pthread_create", transition = Transition.NO_TRANSITION)
public static native int pthread_create_no_transition(pthread_tPointer newthread, pthread_attr_t attr, WordBase start_routine, WordBase arg);

@CFunction
public static native int pthread_join(pthread_t th, WordPointer thread_return);

@CFunction(value = "pthread_join", transition = Transition.NO_TRANSITION)
public static native int pthread_join_no_transition(pthread_t th, WordPointer thread_return);

Expand Down Expand Up @@ -188,9 +182,6 @@ public interface pthread_key_tPointer extends PointerBase {
@CFunction(transition = Transition.NO_TRANSITION)
public static native int pthread_condattr_destroy(pthread_condattr_t attr);

@CFunction
public static native int pthread_kill(pthread_t thread, Signal.SignalEnum sig);

@CFunction(transition = Transition.NO_TRANSITION)
public static native int pthread_key_create(pthread_key_tPointer key, PointerBase keyDestructor);

Expand All @@ -203,4 +194,8 @@ public interface pthread_key_tPointer extends PointerBase {
@CFunction(transition = Transition.NO_TRANSITION)
public static native VoidPointer pthread_getspecific(pthread_key_t key);

public static class NoTransition {
@CFunction(transition = Transition.NO_TRANSITION)
public static native int pthread_exit(VoidPointer retval);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

/**
* A handle to an object of type T that exists in the {@linkplain ClientIsolateThread compilation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

import org.graalvm.nativeimage.IsolateThread;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

/**
* A handle to an object of type T that exists in the {@linkplain CompilerIsolateThread compilation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

import org.graalvm.nativeimage.IsolateThread;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

import java.io.ByteArrayOutputStream;
import java.io.PrintWriter;
Expand All @@ -37,8 +37,6 @@
import com.oracle.svm.core.c.function.CEntryPointOptions;
import com.oracle.svm.core.threadlocal.FastThreadLocalFactory;
import com.oracle.svm.core.threadlocal.FastThreadLocalObject;
import com.oracle.svm.hosted.code.CEntryPointCallStubMethod;
import com.oracle.svm.hosted.code.CEntryPointJavaCallStubMethod;

import jdk.graal.compiler.core.common.GraalBailoutException;

Expand Down Expand Up @@ -83,13 +81,13 @@ protected static void throwPendingException() {
* entry point.
* <p>
* Note that the caller isolate cannot have called from uninterruptible code because
* {@link CEntryPointJavaCallStubMethod} does thread state transitions that require a safepoint
* {@code CEntryPointJavaCallStubMethod} does thread state transitions that require a safepoint
* check, so this method calling it back to dispatch the exception in interruptible code is
* considered acceptable.
* <p>
* Our (callee) entry point might intend to execute only uninterruptible code save for this
* exception handler, but as of writing this, isolated compilation nowhere requires relying on
* that and {@link CEntryPointCallStubMethod} also does state transitions and safepoint checks.
* that and {@code CEntryPointCallStubMethod} also does state transitions and safepoint checks.
* <p>
* Also note that an exception's stack trace contains all its isolate's frames up until the last
* entry frame, but not another isolate's frames in between. When an exception is propagated
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;

import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.ObjectHandle;
Expand Down Expand Up @@ -102,6 +104,7 @@ public IsolatedCompileClient(CompilerIsolateThread compiler) {
this.compiler = compiler;
}

@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
public CompilerIsolateThread getCompiler() {
return compiler;
}
Expand All @@ -113,7 +116,7 @@ protected IsolateThread getOtherIsolate() {
}

@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
ThreadLocalHandles<ObjectHandle> getHandleSet() {
public ThreadLocalHandles<ObjectHandle> getHandleSet() {
return handles;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.oracle.svm.graal.isolated;
package com.oracle.svm.core.graal.isolated;

import static com.oracle.svm.core.Uninterruptible.CALLED_FROM_UNINTERRUPTIBLE_CODE;

import org.graalvm.nativeimage.IsolateThread;
import org.graalvm.nativeimage.ObjectHandle;
Expand Down Expand Up @@ -116,6 +118,7 @@ public IsolatedCompileContext(ClientIsolateThread clientIsolate) {
this.client = clientIsolate;
}

@Uninterruptible(reason = CALLED_FROM_UNINTERRUPTIBLE_CODE, mayBeInlined = true)
public ClientIsolateThread getClient() {
return client;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/*
* Copyright (c) 2019, 2025, 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.
*/
package com.oracle.svm.core.graal.isolated;

import org.graalvm.nativeimage.ObjectHandle;

/**
* An object handle for isolated compilation with added static type information.
*
* @param <T> The type of the object referenced by the handle.
*/
public interface IsolatedHandle<T> extends ObjectHandle {
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,15 @@
import org.graalvm.word.UnsignedWord;

import com.oracle.svm.core.NeverInline;
import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.Uninterruptible;
import com.oracle.svm.core.c.function.CEntryPointErrors;
import com.oracle.svm.core.c.function.CFunctionOptions;
import com.oracle.svm.core.config.ConfigurationValues;
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.graal.isolated.IsolatedCompileClient;
import com.oracle.svm.core.graal.isolated.IsolatedCompileContext;
import com.oracle.svm.core.heap.Heap;
import com.oracle.svm.core.heap.VMOperationInfos;
import com.oracle.svm.core.imagelayer.ImageLayerBuildingSupport;
Expand Down Expand Up @@ -1016,7 +1019,23 @@ public static void preventSafepoints() {
*/
@Uninterruptible(reason = "Called from uninterruptible code.", mayBeInlined = true)
public static void markThreadAsCrashed() {
// It would be nice if we could retire the TLAB here but that wouldn't work reliably.
if (SubstrateOptions.supportCompileInIsolates()) {
/*
* Threads that are used for isolated compilation may be attached to both the main
* and a compilation isolate. So, mark it as crashed in both isolates.
*/
IsolatedCompileContext compileContext = IsolatedCompileContext.get();
if (compileContext != null) {
safepointBehaviorTL.setVolatile(compileContext.getClient(), THREAD_CRASHED);
}

IsolatedCompileClient compileClient = IsolatedCompileClient.get();
if (compileClient != null) {
safepointBehaviorTL.setVolatile(compileClient.getCompiler(), THREAD_CRASHED);
}
}

/* It would be nice if we could retire the TLAB here but that wouldn't work reliably. */
safepointBehaviorTL.setVolatile(THREAD_CRASHED);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@
*/
package com.oracle.svm.graal.isolated;

import jdk.graal.compiler.core.common.CompilationIdentifier;
import org.graalvm.nativeimage.c.struct.RawField;
import org.graalvm.nativeimage.c.struct.RawStructure;
import org.graalvm.word.PointerBase;

import com.oracle.svm.core.code.CodeInfo;
import com.oracle.svm.core.graal.isolated.ClientHandle;

import jdk.graal.compiler.core.common.CompilationIdentifier;

/** The data that is required for installing compiled code in a different isolate. */
@RawStructure
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,19 @@
*/
package com.oracle.svm.graal.isolated;

import jdk.graal.compiler.word.Word;
import org.graalvm.nativeimage.c.struct.RawField;
import org.graalvm.nativeimage.c.struct.RawStructure;
import org.graalvm.word.PointerBase;
import org.graalvm.word.WordBase;

import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.isolated.IsolatedCompileClient;
import com.oracle.svm.core.meta.DirectSubstrateObjectConstant;
import com.oracle.svm.core.meta.SubstrateObjectConstant;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.graal.meta.SubstrateMemoryAccessProviderImpl;

import jdk.graal.compiler.word.Word;
import jdk.vm.ci.meta.Constant;
import jdk.vm.ci.meta.JavaConstant;
import jdk.vm.ci.meta.JavaKind;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@
*/
package com.oracle.svm.graal.isolated;

import jdk.graal.compiler.code.CompilationResult;

import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.deopt.SubstrateInstalledCode;
import com.oracle.svm.core.graal.code.SubstrateCompiledCode;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.meta.SharedRuntimeMethod;
import com.oracle.svm.core.util.VMError;
import com.oracle.svm.graal.meta.SubstrateCodeCacheProvider;
import com.oracle.svm.graal.meta.SubstrateMethod;

import jdk.graal.compiler.code.CompilationResult;
import jdk.graal.compiler.debug.DebugContext;
import jdk.vm.ci.code.CompiledCode;
import jdk.vm.ci.code.InstalledCode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@

import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.c.function.CEntryPointOptions;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.isolated.ClientIsolateThread;
import com.oracle.svm.core.graal.isolated.IsolatedCompileClient;
import com.oracle.svm.core.graal.isolated.IsolatedCompileContext;
import com.oracle.svm.core.graal.meta.SubstrateMemoryAccessProvider;
import com.oracle.svm.core.hub.DynamicHub;
import com.oracle.svm.core.meta.SubstrateObjectConstant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.deopt.SubstrateSpeculationLog.SubstrateSpeculation;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.meta.DirectSubstrateObjectConstant;
import com.oracle.svm.core.meta.SubstrateObjectConstant;
import com.oracle.svm.graal.meta.SubstrateMetaAccess;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
import com.oracle.svm.core.feature.AutomaticallyRegisteredFeature;
import com.oracle.svm.core.feature.InternalFeature;
import com.oracle.svm.core.graal.RuntimeCompilation;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.isolated.ClientIsolateThread;
import com.oracle.svm.core.graal.isolated.IsolatedCompileClient;
import com.oracle.svm.core.graal.isolated.IsolatedCompileContext;
import com.oracle.svm.core.meta.DirectSubstrateObjectConstant;
import com.oracle.svm.core.meta.ObjectConstantEquality;
import com.oracle.svm.core.meta.SubstrateObjectConstant;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,28 @@
*/
package com.oracle.svm.graal.isolated;

import org.graalvm.nativeimage.c.function.CEntryPoint;
import org.graalvm.nativeimage.c.function.CodePointer;
import org.graalvm.nativeimage.c.type.CTypeConversion;

import com.oracle.svm.core.Uninterruptible;
import com.oracle.svm.core.code.CodeInfo;
import com.oracle.svm.core.code.CodeInfoAccess;
import com.oracle.svm.core.code.CodeInfoTable;
import com.oracle.svm.core.code.UntetheredCodeInfo;
import com.oracle.svm.core.deopt.SubstrateInstalledCode;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.isolated.ClientIsolateThread;
import com.oracle.svm.core.graal.isolated.CompilerHandle;
import com.oracle.svm.core.graal.isolated.CompilerIsolateThread;
import com.oracle.svm.core.graal.isolated.IsolatedCompileClient;
import com.oracle.svm.core.graal.isolated.IsolatedCompileContext;
import com.oracle.svm.core.util.VMError;
import com.oracle.truffle.compiler.OptimizedAssumptionDependency;
import com.oracle.truffle.compiler.TruffleCompilable;

import jdk.graal.compiler.word.Word;
import jdk.vm.ci.code.InstalledCode;
import org.graalvm.nativeimage.c.function.CEntryPoint;
import org.graalvm.nativeimage.c.function.CodePointer;
import org.graalvm.nativeimage.c.type.CTypeConversion;

/**
* A helper to pass information for installing code in the compilation client through a Truffle
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
package com.oracle.svm.graal.isolated;

import com.oracle.svm.core.Uninterruptible;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.meta.SharedRuntimeMethod;

/** Method object in the compiler isolate with an equivalent method object in the client isolate. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import java.lang.reflect.Array;
import java.nio.ByteBuffer;

import com.oracle.svm.core.SubstrateSegfaultHandler;
import org.graalvm.collections.EconomicMap;
import org.graalvm.nativeimage.CurrentIsolate;
import org.graalvm.nativeimage.Isolates;
Expand All @@ -40,9 +39,15 @@
import org.graalvm.word.WordBase;

import com.oracle.svm.core.SubstrateOptions;
import com.oracle.svm.core.SubstrateSegfaultHandler;
import com.oracle.svm.core.c.function.CEntryPointOptions;
import com.oracle.svm.core.c.function.IsolateSupportImpl;
import com.oracle.svm.core.deopt.SubstrateInstalledCode;
import com.oracle.svm.core.graal.isolated.ClientHandle;
import com.oracle.svm.core.graal.isolated.ClientIsolateThread;
import com.oracle.svm.core.graal.isolated.CompilerIsolateThread;
import com.oracle.svm.core.graal.isolated.IsolatedCompileClient;
import com.oracle.svm.core.graal.isolated.IsolatedCompileContext;
import com.oracle.svm.core.graal.meta.RuntimeConfiguration;
import com.oracle.svm.core.handles.PrimitiveArrayView;
import com.oracle.svm.core.log.Log;
Expand Down
Loading