Skip to content

Commit 3f72d2f

Browse files
committed
[GR-26395] Periodic update of the graal import.
PullRequest: truffleruby/2492
2 parents 90afa7e + 0cc15b8 commit 3f72d2f

File tree

10 files changed

+277
-40
lines changed

10 files changed

+277
-40
lines changed

common.json

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,26 @@
22
"README": "This file contains definitions that are useful for the hocon and jsonnet CI files of multiple repositories.",
33

44
"jdks": {
5-
"openjdk8": {"name": "openjdk", "version": "8u282+08-jvmci-21.1-b01", "platformspecific": true },
6-
"oraclejdk8": {"name": "oraclejdk", "version": "8u281+09-jvmci-21.1-b01", "platformspecific": true },
7-
"oraclejdk8Debug": {"name": "oraclejdk", "version": "8u281+09-jvmci-21.1-b01-fastdebug", "platformspecific": true },
5+
"openjdk8": {"name": "openjdk", "version": "8u292+05-jvmci-21.1-b02", "platformspecific": true },
6+
"oraclejdk8": {"name": "oraclejdk", "version": "8u291+07-jvmci-21.1-b02", "platformspecific": true },
7+
"oraclejdk8Debug": {"name": "oraclejdk", "version": "8u291+07-jvmci-21.1-b02-fastdebug", "platformspecific": true },
88

99
"openjdk11": {"name": "openjdk", "version": "11.0.3+7", "platformspecific": true },
1010
"oraclejdk11": {"name": "oraclejdk", "version": "11.0.6+8", "platformspecific": true },
11-
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.10+9-jvmci-21.1-b01", "platformspecific": true },
12-
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.10+8-jvmci-21.1-b01", "platformspecific": true },
11+
"labsjdk-ce-11": {"name": "labsjdk", "version": "ce-11.0.11+5-jvmci-21.1-b02", "platformspecific": true },
12+
"labsjdk-ee-11": {"name": "labsjdk", "version": "ee-11.0.11+5-jvmci-21.1-b02", "platformspecific": true },
1313

1414
"oraclejdk16": {"name": "oraclejdk", "version": "16.0.1+4", "platformspecific": true },
15-
"labsjdk-ce-16": {"name": "labsjdk", "version": "ce-16+29-jvmci-21.1-b01", "platformspecific": true },
16-
"labsjdk-ce-16Debug": {"name": "labsjdk", "version": "ce-16+29-jvmci-21.1-b01-debug", "platformspecific": true },
17-
"labsjdk-ee-16": {"name": "labsjdk", "version": "ee-16.0.1+2-jvmci-21.1-b01", "platformspecific": true },
18-
"labsjdk-ee-16Debug": {"name": "labsjdk", "version": "ee-16.0.1+2-jvmci-21.1-b01-debug", "platformspecific": true }
15+
"labsjdk-ce-16": {"name": "labsjdk", "version": "ce-16+36-jvmci-21.1-b02", "platformspecific": true },
16+
"labsjdk-ce-16Debug": {"name": "labsjdk", "version": "ce-16+36-jvmci-21.1-b02-debug", "platformspecific": true },
17+
"labsjdk-ee-16": {"name": "labsjdk", "version": "ee-16+36-jvmci-21.1-b02", "platformspecific": true },
18+
"labsjdk-ee-16Debug": {"name": "labsjdk", "version": "ee-16+36-jvmci-21.1-b02-debug", "platformspecific": true }
1919
},
2020

2121
"COMMENT" : "The devkits versions reflect those used to build the JVMCI JDKs (e.g., see devkit_platform_revisions in <jdk>/make/conf/jib-profiles.js)",
2222
"devkits": {
2323
"windows-oraclejdk8": { "packages" : { "devkit:VS2017-15.9.16+1" : "==0" }},
24-
"windows-openjdk8": { "packages" : { "devkit:VS2017-15.5.5+1" : "==0" }},
24+
"windows-openjdk8": { "packages" : { "devkit:VS2017-15.9.16+1" : "==0" }},
2525
"windows-jdk11": { "packages" : { "devkit:VS2017-15.9.24+1" : "==0" }},
2626
"windows-jdk16": { "packages" : { "devkit:VS2019-16.7.2+1" : "==1" }}
2727
},

mx.truffleruby/suite.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
{
88
"name": "regex",
99
"subdir": True,
10-
"version": "4df0f40cf23670bcc329b0e1b09a96089ee0d2e8",
10+
"version": "05b3f80c848cf272f3ff97897d734b1858867c8d",
1111
"urls": [
1212
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
1313
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},
@@ -16,7 +16,7 @@
1616
{
1717
"name": "sulong",
1818
"subdir": True,
19-
"version": "4df0f40cf23670bcc329b0e1b09a96089ee0d2e8",
19+
"version": "05b3f80c848cf272f3ff97897d734b1858867c8d",
2020
"urls": [
2121
{"url": "https://github.com/oracle/graal.git", "kind": "git"},
2222
{"url": "https://curio.ssw.jku.at/nexus/content/repositories/snapshots", "kind": "binary"},

src/main/java/org/truffleruby/core/exception/CoreExceptions.java

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
import java.util.EnumSet;
1616

1717
import com.oracle.truffle.api.interop.InvalidBufferOffsetException;
18+
import com.oracle.truffle.api.interop.UnknownKeyException;
1819
import org.jcodings.Encoding;
1920
import org.jcodings.specific.UTF8Encoding;
2021
import org.truffleruby.RubyContext;
@@ -404,11 +405,6 @@ public RubyException mathDomainError(String method, Node currentNode) {
404405

405406
// IndexError
406407

407-
@TruffleBoundary
408-
public RubyException indexErrorOutOfString(int index, Node currentNode) {
409-
return indexError(StringUtils.format("index %d out of string", index), currentNode);
410-
}
411-
412408
@TruffleBoundary
413409
public RubyException indexError(String message, Node currentNode) {
414410
RubyClass exceptionClass = context.getCoreLibrary().indexErrorClass;
@@ -417,6 +413,11 @@ public RubyException indexError(String message, Node currentNode) {
417413
return ExceptionOperations.createRubyException(context, exceptionClass, errorMessage, currentNode, null);
418414
}
419415

416+
@TruffleBoundary
417+
public RubyException indexErrorOutOfString(int index, Node currentNode) {
418+
return indexError(StringUtils.format("index %d out of string", index), currentNode);
419+
}
420+
420421
@TruffleBoundary
421422
public RubyException indexTooSmallError(String type, int index, int length, Node currentNode) {
422423
return indexError(
@@ -442,7 +443,24 @@ public RubyException indexErrorInvalidArrayIndexException(InvalidArrayIndexExcep
442443
@TruffleBoundary
443444
public RubyException indexErrorInvalidBufferOffsetException(InvalidBufferOffsetException exception,
444445
Node currentNode) {
445-
return indexError("invalid buffer offset " + exception.getByteOffset(), currentNode);
446+
return indexError(
447+
"invalid buffer offset " + exception.getByteOffset() + " for buffer of length " + exception.getLength(),
448+
currentNode);
449+
}
450+
451+
// KeyError
452+
453+
@TruffleBoundary
454+
public RubyException keyError(String message, Node currentNode) {
455+
RubyClass exceptionClass = context.getCoreLibrary().keyErrorClass;
456+
RubyString errorMessage = StringOperations
457+
.createString(context, language, StringOperations.encodeRope(message, UTF8Encoding.INSTANCE));
458+
return ExceptionOperations.createRubyException(context, exceptionClass, errorMessage, currentNode, null);
459+
}
460+
461+
@TruffleBoundary
462+
public RubyException keyError(UnknownKeyException exception, Node currentNode) {
463+
return keyError(exception.getMessage(), currentNode);
446464
}
447465

448466
// StopIteration

src/main/java/org/truffleruby/core/fiber/FiberManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public void killOtherFibers() {
331331
context.getThreadManager().leaveAndEnter(truffleContext, null, () -> {
332332
doKillOtherFibers();
333333
return BlockingAction.SUCCESS;
334-
}, true);
334+
}, context.getThreadManager().isRubyManagedThread(Thread.currentThread()));
335335
}
336336

337337
private void doKillOtherFibers() {

src/main/java/org/truffleruby/debug/TruffleDebugNodes.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
import org.truffleruby.core.rope.CodeRange;
5656
import org.truffleruby.core.string.RubyString;
5757
import org.truffleruby.core.string.StringNodes.MakeStringNode;
58+
import org.truffleruby.core.thread.ThreadManager;
5859
import org.truffleruby.extra.ffi.Pointer;
5960
import org.truffleruby.interop.BoxedValue;
6061
import org.truffleruby.interop.ToJavaStringNode;
@@ -1002,4 +1003,15 @@ protected RubyString parseName(InternalMethod method) {
10021003

10031004
}
10041005

1006+
/** Creates a Truffle thread that is no {@link ThreadManager#isRubyManagedThread(java.lang.Thread)}}. */
1007+
@CoreMethod(names = "create_polyglot_thread", onSingleton = true, required = 1)
1008+
public abstract static class CreatePolyglotThread extends CoreMethodArrayArgumentsNode {
1009+
@Specialization
1010+
protected Object parseName(Object hostRunnable) {
1011+
Runnable runnable = (Runnable) getContext().getEnv().asHostObject(hostRunnable);
1012+
final Thread thread = getContext().getEnv().createThread(runnable);
1013+
return getContext().getEnv().asGuestValue(thread);
1014+
}
1015+
}
1016+
10051017
}

src/main/java/org/truffleruby/interop/InteropNodes.java

Lines changed: 182 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1998,6 +1998,188 @@ protected Object getMetaQualifiedName(Object metaObject,
19981998
}
19991999
// endregion
20002000

2001+
// region Hash entries
2002+
@CoreMethod(names = "has_hash_entries?", onSingleton = true, required = 1)
2003+
public abstract static class HasHashEntriesNode extends InteropCoreMethodArrayArgumentsNode {
2004+
@Specialization(limit = "getCacheLimit()")
2005+
protected boolean hasHashEntriesNode(Object receiver,
2006+
@CachedLibrary("receiver") InteropLibrary interop) {
2007+
return interop.hasHashEntries(receiver);
2008+
}
2009+
}
2010+
2011+
2012+
@CoreMethod(names = "hash_entries_iterator", onSingleton = true, required = 1)
2013+
public abstract static class HashEntriesIteratorNode extends InteropCoreMethodArrayArgumentsNode {
2014+
@Specialization(limit = "getCacheLimit()")
2015+
protected Object hashEntriesIterator(Object receiver,
2016+
@CachedLibrary("receiver") InteropLibrary interop,
2017+
@Cached TranslateInteropExceptionNode translateInteropException) {
2018+
try {
2019+
return interop.getHashEntriesIterator(receiver);
2020+
} catch (UnsupportedMessageException e) {
2021+
throw translateInteropException.execute(e);
2022+
}
2023+
}
2024+
}
2025+
2026+
@CoreMethod(names = "hash_entry_existing?", onSingleton = true, required = 2)
2027+
public abstract static class HashEntryExistingNode extends InteropCoreMethodArrayArgumentsNode {
2028+
@Specialization(limit = "getCacheLimit()")
2029+
protected boolean hashEntryExisting(Object receiver, Object key,
2030+
@CachedLibrary("receiver") InteropLibrary interop) {
2031+
return interop.isHashEntryExisting(receiver, key);
2032+
}
2033+
}
2034+
2035+
@CoreMethod(names = "hash_entry_insertable?", onSingleton = true, required = 2)
2036+
public abstract static class HashEntryInsertableNode extends InteropCoreMethodArrayArgumentsNode {
2037+
@Specialization(limit = "getCacheLimit()")
2038+
protected boolean hashEntryInsertable(Object receiver, Object key,
2039+
@CachedLibrary("receiver") InteropLibrary interop) {
2040+
return interop.isHashEntryInsertable(receiver, key);
2041+
}
2042+
}
2043+
2044+
@CoreMethod(names = "hash_entry_modifiable?", onSingleton = true, required = 2)
2045+
public abstract static class HashEntryModifiableNode extends InteropCoreMethodArrayArgumentsNode {
2046+
@Specialization(limit = "getCacheLimit()")
2047+
protected boolean hashEntryModifiable(Object receiver, Object key,
2048+
@CachedLibrary("receiver") InteropLibrary interop) {
2049+
return interop.isHashEntryModifiable(receiver, key);
2050+
}
2051+
}
2052+
2053+
@CoreMethod(names = "hash_entry_readable?", onSingleton = true, required = 2)
2054+
public abstract static class HashEntryReadableNode extends InteropCoreMethodArrayArgumentsNode {
2055+
@Specialization(limit = "getCacheLimit()")
2056+
protected boolean hashEntryReadable(Object receiver, Object key,
2057+
@CachedLibrary("receiver") InteropLibrary interop) {
2058+
return interop.isHashEntryReadable(receiver, key);
2059+
}
2060+
}
2061+
2062+
@CoreMethod(names = "hash_entry_removable?", onSingleton = true, required = 2)
2063+
public abstract static class HashEntryRemovableNode extends InteropCoreMethodArrayArgumentsNode {
2064+
@Specialization(limit = "getCacheLimit()")
2065+
protected boolean hashEntryRemovable(Object receiver, Object key,
2066+
@CachedLibrary("receiver") InteropLibrary interop) {
2067+
return interop.isHashEntryRemovable(receiver, key);
2068+
}
2069+
}
2070+
2071+
2072+
@CoreMethod(names = "hash_entry_writable?", onSingleton = true, required = 2)
2073+
public abstract static class HashEntryWritableNode extends InteropCoreMethodArrayArgumentsNode {
2074+
@Specialization(limit = "getCacheLimit()")
2075+
protected boolean hashEntryWritable(Object receiver, Object key,
2076+
@CachedLibrary("receiver") InteropLibrary interop) {
2077+
return interop.isHashEntryWritable(receiver, key);
2078+
}
2079+
}
2080+
2081+
@CoreMethod(names = "hash_keys_iterator", onSingleton = true, required = 1)
2082+
public abstract static class HashKeysIteratorNode extends InteropCoreMethodArrayArgumentsNode {
2083+
@Specialization(limit = "getCacheLimit()")
2084+
protected Object hashKeysIterator(Object receiver,
2085+
@CachedLibrary("receiver") InteropLibrary interop,
2086+
@Cached TranslateInteropExceptionNode translateInteropException) {
2087+
try {
2088+
return interop.getHashKeysIterator(receiver);
2089+
} catch (UnsupportedMessageException e) {
2090+
throw translateInteropException.execute(e);
2091+
}
2092+
}
2093+
}
2094+
2095+
@CoreMethod(names = "hash_size", onSingleton = true, required = 1)
2096+
public abstract static class HashSizeNode extends InteropCoreMethodArrayArgumentsNode {
2097+
@Specialization(limit = "getCacheLimit()")
2098+
protected long hashSize(Object receiver,
2099+
@CachedLibrary("receiver") InteropLibrary interop,
2100+
@Cached TranslateInteropExceptionNode translateInteropException) {
2101+
try {
2102+
return interop.getHashSize(receiver);
2103+
} catch (UnsupportedMessageException e) {
2104+
throw translateInteropException.execute(e);
2105+
}
2106+
}
2107+
}
2108+
2109+
@CoreMethod(names = "hash_values_iterator", onSingleton = true, required = 1)
2110+
public abstract static class HashValuesIteratorNode extends InteropCoreMethodArrayArgumentsNode {
2111+
@Specialization(limit = "getCacheLimit()")
2112+
protected Object hashValuesIterator(Object receiver,
2113+
@CachedLibrary("receiver") InteropLibrary interop,
2114+
@Cached TranslateInteropExceptionNode translateInteropException) {
2115+
try {
2116+
return interop.getHashValuesIterator(receiver);
2117+
} catch (UnsupportedMessageException e) {
2118+
throw translateInteropException.execute(e);
2119+
}
2120+
}
2121+
}
2122+
2123+
2124+
@CoreMethod(names = "read_hash_value", onSingleton = true, required = 2)
2125+
public abstract static class ReadHashValueNode extends InteropCoreMethodArrayArgumentsNode {
2126+
@Specialization(limit = "getCacheLimit()")
2127+
protected Object readHashValue(Object receiver, Object key,
2128+
@CachedLibrary("receiver") InteropLibrary interop,
2129+
@Cached TranslateInteropExceptionNode translateInteropException) {
2130+
try {
2131+
return interop.readHashValue(receiver, key);
2132+
} catch (InteropException e) {
2133+
throw translateInteropException.execute(e);
2134+
}
2135+
}
2136+
}
2137+
2138+
@CoreMethod(names = "read_hash_value_or_default", onSingleton = true, required = 3)
2139+
public abstract static class ReadHashValueOrDefaultNode extends InteropCoreMethodArrayArgumentsNode {
2140+
@Specialization(limit = "getCacheLimit()")
2141+
protected Object readHashValueOrDefault(Object receiver, Object key, Object defaultValue,
2142+
@CachedLibrary("receiver") InteropLibrary interop,
2143+
@Cached TranslateInteropExceptionNode translateInteropException) {
2144+
try {
2145+
return interop.readHashValueOrDefault(receiver, key, defaultValue);
2146+
} catch (UnsupportedMessageException e) {
2147+
throw translateInteropException.execute(e);
2148+
}
2149+
}
2150+
}
2151+
2152+
@CoreMethod(names = "remove_hash_entry", onSingleton = true, required = 2)
2153+
public abstract static class RemoveHashEntryNode extends InteropCoreMethodArrayArgumentsNode {
2154+
@Specialization(limit = "getCacheLimit()")
2155+
protected Object removeHashEntry(Object receiver, Object key,
2156+
@CachedLibrary("receiver") InteropLibrary interop,
2157+
@Cached TranslateInteropExceptionNode translateInteropException) {
2158+
try {
2159+
interop.removeHashEntry(receiver, key);
2160+
return nil;
2161+
} catch (InteropException e) {
2162+
throw translateInteropException.execute(e);
2163+
}
2164+
}
2165+
}
2166+
2167+
@CoreMethod(names = "write_hash_entry", onSingleton = true, required = 3)
2168+
public abstract static class WriteHashEntryNode extends InteropCoreMethodArrayArgumentsNode {
2169+
@Specialization(limit = "getCacheLimit()")
2170+
protected Object writeHashEntry(Object receiver, Object key, Object value,
2171+
@CachedLibrary("receiver") InteropLibrary interop,
2172+
@Cached TranslateInteropExceptionNode translateInteropException) {
2173+
try {
2174+
interop.writeHashEntry(receiver, key, value);
2175+
return value;
2176+
} catch (InteropException e) {
2177+
throw translateInteropException.execute(e);
2178+
}
2179+
}
2180+
}
2181+
// endregion
2182+
20012183
// region Identity
20022184
@CoreMethod(names = "identical?", onSingleton = true, required = 2)
20032185
public abstract static class IsIdenticalNode extends InteropCoreMethodArrayArgumentsNode {

src/main/java/org/truffleruby/interop/TranslateInteropExceptionNode.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
import com.oracle.truffle.api.interop.InvalidBufferOffsetException;
1313
import com.oracle.truffle.api.interop.StopIterationException;
14+
import com.oracle.truffle.api.interop.UnknownKeyException;
1415
import org.truffleruby.RubyContext;
1516
import org.truffleruby.RubyLanguage;
1617
import org.truffleruby.language.RubyBaseNode;
@@ -77,6 +78,13 @@ protected RuntimeException handle(
7778
exception);
7879
}
7980

81+
@Specialization
82+
protected RuntimeException handle(
83+
UnknownKeyException exception, boolean inInvokeMember, Object receiver, Object[] args,
84+
@CachedContext(RubyLanguage.class) RubyContext context) {
85+
return new RaiseException(context, context.getCoreExceptions().keyError(exception, this), exception);
86+
}
87+
8088
@Specialization
8189
protected RuntimeException handle(
8290
UnknownIdentifierException exception, boolean inInvokeMember, Object receiver, Object[] args,

src/main/java/org/truffleruby/language/loader/FeatureLoader.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import java.util.Map;
2121
import java.util.concurrent.locks.ReentrantLock;
2222

23-
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
2423
import org.jcodings.Encoding;
2524
import org.jcodings.specific.UTF8Encoding;
2625
import org.truffleruby.RubyContext;
@@ -40,7 +39,6 @@
4039
import org.truffleruby.language.RubyConstant;
4140
import org.truffleruby.language.control.RaiseException;
4241
import org.truffleruby.language.dispatch.DispatchNode;
43-
import org.truffleruby.language.globals.GlobalVariables;
4442
import org.truffleruby.language.library.RubyStringLibrary;
4543
import org.truffleruby.platform.NativeConfiguration;
4644
import org.truffleruby.platform.Platform;
@@ -79,8 +77,6 @@ public class FeatureLoader {
7977
private NativeFunction getcwd;
8078
private static final int PATH_MAX = 1024; // jnr-posix hard codes this value
8179

82-
@CompilationFinal private RubyArray loadedFeatures = null;
83-
8480
private static final String[] EXTENSIONS = new String[]{ TruffleRuby.EXTENSION, RubyLanguage.CEXT_EXTENSION };
8581

8682
public FeatureLoader(RubyContext context, RubyLanguage language) {
@@ -491,13 +487,4 @@ public Object loadCExtLibrary(String feature, String path, Node currentNode) {
491487
Metrics.printTime("after-load-cext-" + feature);
492488
}
493489
}
494-
495-
public Object getLoadedFeaturesLock() {
496-
if (loadedFeatures == null) {
497-
CompilerDirectives.transferToInterpreterAndInvalidate();
498-
GlobalVariables globals = context.getCoreLibrary().globalVariables;
499-
loadedFeatures = (RubyArray) globals.getStorage("$LOADED_FEATURES").getValue();
500-
}
501-
return loadedFeatures;
502-
}
503490
}

0 commit comments

Comments
 (0)