Skip to content

Commit

Permalink
Automatic merge of master into galahad
Browse files Browse the repository at this point in the history
  • Loading branch information
OracleLabsAutomation committed Jul 3, 2024
2 parents 2acc0c6 + 5ea8ee7 commit 44b6e58
Show file tree
Hide file tree
Showing 10 changed files with 494 additions and 172 deletions.
2 changes: 1 addition & 1 deletion sdk/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This changelog summarizes major changes between GraalVM SDK versions. The main f
* GR-54310 Removed disabled-by-default class-path isolation feature if polyglot is used from the class-path. The option `-Dpolyglotimpl.DisableClassPathIsolation` has no longer any effect.
* GR-49484 Added `PolyglotException.StackFrame.getBytecodeIndex()` which allows to access the internal bytecode index that the language uses to identify an execution location.
* GR-47956 Added the option `engine.InterpreterCallStackHeadRoom` to protect against stack overflow in the middle of a guest method execution in the interpreter. For the UNTRUSTED polyglot sandbox policy, the value for the option is computed automatically based on the value of the mandatory option `sandbox.MaxASTDepth`, the option `sandbox.MaxStackFrames` is no longer mandatory. The new option is available only in the AOT mode.
* GR-40931 Added experimental support for virtual threads on HotSpot. Not all languages are currently supported for use with virtual threads, please check the language changelog for further information. Truffle debugging, CPU time limits and some memory limits are currently not supported on virtual threads. The number of threads is currently limited to 65535 threads entered per context.
* GR-40931 Added experimental support for virtual threads on HotSpot. Not all languages are currently supported for use with virtual threads, please check the language changelog for further information. Truffle debugging, CPU time limits and some memory limits are currently not supported on virtual threads.
* GR-40931 Using virtual threads in a native-image will now emulate virtual threads using platform threads until Loom support for Truffle languages in native-image is implemented.
* GR-48481: It is now possible to depend on platform-specific Maven artifacts when using polyglot isolates. The `-isolate` Maven artifacts remain platform-independent. However, if platform specific builds are required, consider adding a platform specific suffix to the Maven artifact name, such as `-isolate-linux-amd64`. The reduced binary size of platform specific dependencies can improve build times and reduce the distribution size of your application. For more details, see [Embedding Languages](https://www.graalvm.org/latest/reference-manual/embed-languages/#polyglot-isolates).
* GR-48481: The Python language is now available as a polyglot isolate.
Expand Down
4 changes: 3 additions & 1 deletion truffle/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,12 @@ This changelog summarizes major changes between Truffle versions relevant to lan
* GR-28866 Deprecated `TruffleLanguage.Env.isPolyglotEvalAllowed()`. Replace usages with `TruffleLanguage.Env.isPolyglotEvalAllowed(LanguageInfo)`. Please see javadoc for the updated usage.
* GR-52843 Deprecated `Node.getCost()` and the associated `NodeCost` class without replacement. Truffle DSL no longer generates implementations of this method automatically and will therefore always return `NodeCost.MONOMORPHIC` by default. This is intended to reduce the binary footprint.
* GR-52843 Added the `UnadoptableNode` interface. This is interface should be preferred to overriding `Node.isAdoptable()` if the result is statically known.
* GR-40931 Virtual threads with a polyglot context are now experimentally supported on HotSpot. Experimental because access to caller frames in write or materialize mode is not yet supported and maximum 65535 threads concurrently accessing the context.
* GR-40931 Virtual threads with a polyglot context are now experimentally supported on HotSpot. Experimental because access to caller frames in write or materialize mode is not yet supported.
* GR-40931 Using virtual threads in a native-image will now emulate virtual threads using platform threads until Loom support for Truffle languages in native-image is implemented.
* GR-40931 Added [`TruffleThreadBuilder#virtual()`](https://www.graalvm.org/truffle/javadoc/com/oracle/truffle/api/TruffleThreadBuilder.html#virtual(boolean)) for languages to create virtual threads.
* GR-53454 Added warning in the annotation processor when `@ReportPolymorphism` is used incorrectly.
* GR-54516 The `Future` returned by submitting `ThreadLocalAction` now throws `CancellationException` on `Future#get()` when the future is cancelled, as it should per `Future` interface semantics.
* GR-54516 Synchronous `ThreadLocalAction`s which wait longer than `--engine.SynchronousThreadLocalActionMaxWait` (default 60) seconds for all threads to start executing that action now show a warning and are automatically cancelled to prevent applications to hang.

## Version 24.0.0

Expand Down
4 changes: 3 additions & 1 deletion truffle/docs/Options.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ They are useful to users and language and tool implementers.
```shell
- `--engine.PreinitializeContexts` : Preinitialize language contexts for given languages.
- `--engine.RelaxStaticObjectSafetyChecks` : On property accesses, the Static Object Model does not perform shape checks and uses unsafe casts
- `--engine.SynchronousThreadLocalActionMaxWait=[0, inf)` : How long to wait for other threads to reach a synchronous ThreadLocalAction before cancelling it, in seconds. 0 means no limit.
- `--engine.SynchronousThreadLocalActionPrintStackTraces` : Print thread stacktraces when a synchronous ThreadLocalAction is waiting for more than SynchronousThreadLocalActionMaxWait seconds.
- `--engine.TraceStackTraceInterval=[1, inf)` : Prints the stack trace for all threads for a time interval. By default 0, which disables the output.
- `--engine.DebugCacheCompileUseLastTier=true|false` : If true uses the last tier instead of the first tier compiler. By default the last tier compiler is used (default: true).
- `--engine.BackgroundCompilation=true|false` : Enable asynchronous truffle compilation in background threads (default: true)
Expand Down Expand Up @@ -114,7 +116,7 @@ These are internal options for debugging language implementations and tools.
- `--engine.StaticObjectStorageStrategy=default|array-based|field-based` : Set the storage strategy used by the Static Object Model. Accepted values are: ['default', 'array-based', 'field-based']
- `--engine.TraceCodeSharing` : Enables printing of code sharing related information to the logger. This option is intended to support debugging language implementations.
- `--engine.TraceMissingSafepointPollInterval=[0, inf)` : Show Java stacktraces for missing polls longer than the supplied number of milliseconds. Implies SafepointALot.
- `--engine.TraceThreadLocalActions` : Traces thread local events and when they are processed on the individual threads.Prints messages with the [engine] [tl] prefix.
- `--engine.TraceThreadLocalActions` : Traces thread local events and when they are processed on the individual threads. Prints messages with the [engine] [tl] prefix.
- `--engine.TriggerUncaughtExceptionHandlerForCancel` : Propagates cancel execution exception into UncaughtExceptionHandler. For testing purposes only.
- `--engine.UseConservativeContextReferences` : Enables conservative context references. This allows invalid sharing between contexts. For testing purposes only.
- `--engine.UsePreInitializedContext=true|false` : Use pre-initialized context when it's available (default: true).
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.concurrent.atomic.AtomicBoolean;

import com.oracle.truffle.api.test.polyglot.AbstractThreadedPolyglotTest;
import org.graalvm.polyglot.Context;
import org.graalvm.polyglot.PolyglotException;
import org.junit.After;
Expand All @@ -67,8 +67,12 @@
import com.oracle.truffle.api.instrumentation.SourceSectionFilter;
import com.oracle.truffle.api.instrumentation.TruffleInstrument;
import com.oracle.truffle.api.test.polyglot.AbstractPolyglotTest;
import org.junit.runner.RunWith;
import org.junit.runners.Parameterized;

public class ContextPauseTest {
@SuppressWarnings("hiding")
@RunWith(Parameterized.class)
public class ContextPauseTest extends AbstractThreadedPolyglotTest {

private static final String TEST_EXECUTION_STOPPED = "Test execution stopped!";

Expand All @@ -85,9 +89,15 @@ private interface AfterPauseAction {
}

private static void testCommon(OnEnterAction onEnterAction, GuestAction guestAction, boolean waitForPause, AfterPauseAction afterPauseAction) throws ExecutionException, InterruptedException {
int processors = Runtime.getRuntime().availableProcessors();
for (int nThreads = 1; nThreads <= 10; nThreads += 3) {
if (vthreads && nThreads > processors) {
// Can hang, see https://bugs.openjdk.org/browse/JDK-8334304
continue;
}

for (int nPauses = 1; nPauses <= 3; nPauses++) {
ExecutorService executorService = Executors.newFixedThreadPool(nThreads);
ExecutorService executorService = threadPool(nThreads, vthreads);
try (Context context = Context.create()) {
context.initialize(InstrumentationTestLanguage.ID);
TruffleInstrument.Env instrumentEnv = context.getEngine().getInstruments().get("InstrumentationUpdateInstrument").lookup(TruffleInstrument.Env.class);
Expand Down
Loading

0 comments on commit 44b6e58

Please sign in to comment.