Skip to content

Commit 4c33901

Browse files
woessgilles-duboscq
authored andcommitted
[GR-43819] [GR-48463] [GR-48534] [GR-48537] [GR-48544] Batch backport to 23.1.
PullRequest: js/2923
2 parents 31d2175 + 635ec25 commit 4c33901

File tree

9 files changed

+83
-19
lines changed

9 files changed

+83
-19
lines changed

graal-js/mx.graal-js/suite.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@
254254
"subDir" : "src",
255255
"sourceDirs" : ["src"],
256256
"dependencies" : [
257-
"sdk:GRAAL_SDK",
257+
"sdk:POLYGLOT",
258258
"mx:JUNIT",
259259
"GRAALJS",
260260
"com.oracle.truffle.js.snapshot",
@@ -275,7 +275,7 @@
275275
"subDir" : "src",
276276
"sourceDirs" : ["src"],
277277
"dependencies" : [
278-
"sdk:GRAAL_SDK",
278+
"sdk:POLYGLOT",
279279
"mx:JUNIT",
280280
"GRAALJS",
281281
"TRUFFLE_JS_TESTS",
@@ -310,7 +310,7 @@
310310
"sourceDirs" : ["src"],
311311
"dependencies" : [
312312
"mx:JUNIT",
313-
"sdk:GRAAL_SDK",
313+
"sdk:POLYGLOT",
314314
],
315315
"annotationProcessors" : ["truffle:TRUFFLE_DSL_PROCESSOR"],
316316
"checkstyle" : "com.oracle.truffle.js",
@@ -325,7 +325,7 @@
325325
"sourceDirs" : ["src"],
326326
"dependencies" : [
327327
"mx:JUNIT",
328-
"sdk:GRAAL_SDK",
328+
"sdk:POLYGLOT",
329329
"com.oracle.truffle.js.test",
330330
],
331331
"requires" : [
@@ -343,7 +343,7 @@
343343
"subDir" : "src",
344344
"sourceDirs" : ["src"],
345345
"dependencies" : [
346-
"sdk:GRAAL_SDK",
346+
"sdk:POLYGLOT",
347347
],
348348
"requires" : [
349349
"java.scripting",
@@ -360,7 +360,7 @@
360360
"sourceDirs" : ["src"],
361361
"dependencies" : [
362362
"com.oracle.truffle.js.scriptengine",
363-
"sdk:GRAAL_SDK",
363+
"sdk:POLYGLOT",
364364
"mx:JUNIT",
365365
"GRAALJS",
366366
],
@@ -379,7 +379,7 @@
379379
"subDir" : "src",
380380
"sourceDirs" : ["src"],
381381
"dependencies" : [
382-
"sdk:GRAAL_SDK",
382+
"sdk:POLYGLOT",
383383
"GRAALJS",
384384
"mx:JMH_1_21"
385385
],
@@ -471,7 +471,7 @@
471471
"distDependencies" : [
472472
"regex:TREGEX",
473473
"truffle:TRUFFLE_API",
474-
"sdk:GRAAL_SDK",
474+
"sdk:POLYGLOT",
475475
"truffle:TRUFFLE_ICU4J",
476476
],
477477
"exclude" : [
@@ -540,7 +540,7 @@
540540
"subDir" : "src",
541541
"dependencies" : ["com.oracle.truffle.js.scriptengine"],
542542
"distDependencies" : [
543-
"sdk:GRAAL_SDK"
543+
"sdk:POLYGLOT"
544544
],
545545
"description" : "Graal JavaScript ScriptEngine",
546546
"maven" : {
@@ -555,7 +555,7 @@
555555
"dependencies" : ["com.oracle.truffle.js.factory.processor"],
556556
"distDependencies" : [
557557
"truffle:TRUFFLE_API",
558-
"sdk:GRAAL_SDK"
558+
"sdk:POLYGLOT"
559559
],
560560
"maven" : False,
561561
"overlaps" : ["GRAALJS"],
@@ -594,7 +594,7 @@
594594
"dependencies" : ["com.oracle.truffle.js.scriptengine.test"],
595595
"distDependencies" : [
596596
"mx:JUNIT",
597-
"sdk:GRAAL_SDK",
597+
"sdk:POLYGLOT",
598598
"GRAALJS",
599599
"GRAALJS_SCRIPTENGINE",
600600
],
@@ -700,7 +700,7 @@
700700
"mx:JUNIT"
701701
],
702702
"distDependencies" : [
703-
"sdk:GRAAL_SDK",
703+
"sdk:POLYGLOT",
704704
"GRAALJS"
705705
],
706706
"maven" : False,
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
/**
9+
* @option debug-builtin
10+
*/
11+
12+
load("assert.js");
13+
14+
var array = new Uint8Array(8);
15+
Debug.typedArrayDetachBuffer(array.buffer);
16+
17+
assertThrows(function() {
18+
Object.getOwnPropertyDescriptor(SharedArrayBuffer.prototype, 'byteLength').get.call(array);
19+
}, TypeError);
20+
21+
assertSameContent([], Object.getOwnPropertyNames(array));
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
/*
2+
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
load("assert.js");
9+
10+
var array = [1,2,4];
11+
delete array[1];
12+
array.splice(2,0,3);
13+
array[2] = '3';
14+
assertSameContent([1,,'3',4], array);
15+
16+
var array = new Array(10);
17+
array[0] = 0;
18+
array[2] = 2;
19+
array.splice(1,0,1);
20+
array[1] = '1';
21+
assertSameContent([0,'1',,2,,,,,,,,], array);
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright (c) 2023, 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
6+
*/
7+
8+
load("assert.js");
9+
10+
var array = new Array(8);
11+
array[0] = '1';
12+
array[2] = 3;
13+
array.splice(3,0,4,5);
14+
assertSameContent(['1',,3,4,5,,,,,,], array);

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/array/dyn/AbstractWritableArray.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,8 +680,12 @@ ScriptArray addRangeImplContiguous(JSDynamicObject object, long offset, int size
680680
int copySize = (lastIndex - effectiveOffset);
681681
if (copySize > 0) {
682682
System.arraycopy(array, effectiveOffset, array, (effectiveOffset + size), copySize);
683+
fillWithHoles(array, effectiveOffset, effectiveOffset + size);
684+
if (isHolesType()) {
685+
arraySetHoleCount(object, arrayGetHoleCount(object) + size);
686+
}
687+
arraySetUsedLength(object, usedLength + size);
683688
}
684-
arraySetUsedLength(object, usedLength + size);
685689
return this;
686690
} else {
687691
return addRangeGrow(object, array, arrayLength, usedLength, lengthInt(object), (int) (offset - indexOffset), size, arrayOffset, indexOffset);
@@ -703,6 +707,7 @@ private ScriptArray addRangeGrow(JSDynamicObject object, Object array, int array
703707
arraySetArray(object, newArray);
704708
arraySetUsedLength(object, usedLength + size);
705709
if (isHolesType()) {
710+
fillWithHoles(newArray, offset, offset + size);
706711
arraySetHoleCount(object, arrayGetHoleCount(object) + size);
707712
}
708713
return this;

graal-js/src/com.oracle.truffle.js/src/com/oracle/truffle/js/runtime/builtins/JSArrayBufferView.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,8 +441,11 @@ public List<Object> getOwnPropertyKeys(JSDynamicObject thisObj, boolean strings,
441441
if (!strings) {
442442
return super.getOwnPropertyKeys(thisObj, strings, symbols);
443443
}
444-
List<Object> indices = typedArrayGetArrayType(thisObj).ownPropertyKeys(thisObj);
445444
List<Object> keys = ordinaryOwnPropertyKeys(thisObj, strings, symbols);
445+
if (hasDetachedBuffer(thisObj)) {
446+
return keys;
447+
}
448+
List<Object> indices = typedArrayGetArrayType(thisObj).ownPropertyKeys(thisObj);
446449
return IteratorUtil.concatLists(indices, keys);
447450
}
448451

graal-js/test/maven-demo/pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,8 @@
165165
<overWrite>true</overWrite>
166166
</artifactItem>
167167
<artifactItem>
168-
<groupId>org.graalvm.sdk</groupId>
169-
<artifactId>graal-sdk</artifactId>
168+
<groupId>org.graalvm.polyglot</groupId>
169+
<artifactId>polyglot</artifactId>
170170
<version>${graalvm.version}</version>
171171
<type>jar</type>
172172
<overWrite>true</overWrite>

graal-js/test/maven-demo/src/main/java/module-info.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
* SOFTWARE.
4040
*/
4141
module com.mycompany.app {
42-
requires org.graalvm.sdk;
42+
requires org.graalvm.polyglot;
4343
requires java.scripting;
4444

4545
exports com.mycompany.app;

graal-nodejs/mx.graal-nodejs/mx_graal_nodejs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ def mx_post_parse_cmd_line(args):
601601
mx_graal_nodejs_benchmark.register_nodejs_vms()
602602

603603
def _is_wasm_available():
604-
return ('wasm', True) in mx.get_dynamic_imports()
604+
return any(wasm_suite in mx.get_dynamic_imports() for wasm_suite in [('wasm', True), ('wasm-enterprise', True)])
605605

606606
mx_sdk.register_graalvm_component(mx_sdk.GraalVmLanguage(
607607
suite=_suite,
@@ -648,7 +648,7 @@ def _is_wasm_available():
648648
standalone_dependencies={
649649
'GraalVM license files': ('', ['GRAALVM-README.md']),
650650
'Graal.nodejs license files': ('', []),
651-
**({'GraalWasm' : ('', ['LICENSE_WASM.txt'])} if _is_wasm_available() else {}),
651+
**({'GraalWasm' : ('', ['LICENSE_WASM.txt', 'bin/<exe:wasm>', 'lib/<lib:wasmvm>'])} if _is_wasm_available() else {}),
652652
},
653653
standalone_dependencies_enterprise={
654654
'GraalVM enterprise license files': ('', ['GRAALVM-README.md']),

0 commit comments

Comments
 (0)