Skip to content

Commit c7bea5e

Browse files
tzezulagilles-duboscq
authored andcommitted
[GR-47044] Backport of: Implement internal resource bundling for polyglot isolate.
PullRequest: js/2913
2 parents 958e49a + ae41f9d commit c7bea5e

File tree

4 files changed

+106
-9
lines changed

4 files changed

+106
-9
lines changed

common.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"Jsonnet files should not include this file directly but use ci/common.jsonnet instead."
55
],
66

7-
"mx_version": "6.42.0",
7+
"mx_version": "6.45.0",
88

99
"COMMENT.jdks": "When adding or removing JDKs keep in sync with JDKs in ci/common.jsonnet",
1010
"jdks": {
@@ -35,12 +35,12 @@
3535
"labsjdk-ee-20-llvm": {"name": "labsjdk", "version": "ee-20.0.2+2-jvmci-23.1-b02-sulong", "platformspecific": true },
3636

3737
"oraclejdk21": {"name": "jpg-jdk", "version": "21", "build_id": "33", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]},
38-
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b13", "platformspecific": true },
39-
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b13-debug", "platformspecific": true },
40-
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b13-sulong", "platformspecific": true },
41-
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b13", "platformspecific": true },
42-
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b13-debug", "platformspecific": true },
43-
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b13-sulong", "platformspecific": true },
38+
"labsjdk-ce-21": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14", "platformspecific": true },
39+
"labsjdk-ce-21Debug": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14-debug", "platformspecific": true },
40+
"labsjdk-ce-21-llvm": {"name": "labsjdk", "version": "ce-21+35-jvmci-23.1-b14-sulong", "platformspecific": true },
41+
"labsjdk-ee-21": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14", "platformspecific": true },
42+
"labsjdk-ee-21Debug": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14-debug", "platformspecific": true },
43+
"labsjdk-ee-21-llvm": {"name": "labsjdk", "version": "ee-21+35-jvmci-23.1-b14-sulong", "platformspecific": true },
4444

4545
"oraclejdk22": {"name": "jpg-jdk", "version": "22", "build_id": "2", "release": true, "platformspecific": true, "extrabundles": ["static-libs"]}
4646
},

graal-js/mx.graal-js/mx_graal_js.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131

3232
import mx_graal_js_benchmark
3333
import mx, mx_sdk, mx_urlrewrites
34+
import mx_truffle
3435
from mx_gate import Tags, Task, add_gate_runner, prepend_gate_runner
3536

3637
import mx_unittest
@@ -133,7 +134,7 @@ def _graal_js_gate_runner(args, tasks):
133134

134135
with Task('TCK tests', tasks, tags=[GraalJsDefaultTags.all, GraalJsDefaultTags.tck, GraalJsDefaultTags.coverage], report=True) as t:
135136
if t:
136-
import mx_gate, mx_truffle
137+
import mx_gate
137138
jsonResultsFile = tempfile.NamedTemporaryFile(delete=False, suffix='.json.gz').name
138139
try:
139140
mx_truffle._tck(['--json-results=' + jsonResultsFile])
@@ -396,6 +397,16 @@ def is_included(path):
396397

397398
return mx.run([js_binary, '--js.intl-402'] + testfiles, nonZeroIsFatal=True)
398399

400+
401+
def mx_register_dynamic_suite_constituents(register_project, register_distribution):
402+
if register_distribution:
403+
layout_dist = mx.distribution('sdk:JS_ISOLATE_LAYOUT', fatalIfMissing=False)
404+
if layout_dist:
405+
language_dist = [d for d in _suite.dists if d.name == 'GRAALJS'][0]
406+
resource_project = [p for p in _suite.projects if p.name == 'com.oracle.truffle.js.isolate'][0]
407+
mx_truffle.register_polyglot_isolate_distributions(register_distribution, 'js', language_dist, layout_dist, resource_project)
408+
409+
399410
mx_sdk.register_graalvm_component(mx_sdk.GraalVmLanguage(
400411
suite=_suite,
401412
name='Graal.js',
@@ -435,6 +446,7 @@ def is_included(path):
435446
'-H:ReservedAuxiliaryImageBytes=2145482548',
436447
] if not mx.is_windows() else [],
437448
language='js',
449+
isolate_library_layout_distribution='JS_ISOLATE_LAYOUT'
438450
)
439451
],
440452
boot_jars=[],

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

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
{
2525
"name" : "regex",
2626
"subdir" : True,
27-
"version" : "ce7e2791bb11eee493e6c332efe73f589e289e5f",
27+
"version" : "c852ac898d74b897a4f4b875631ed0b280dc88ab",
2828
"urls" : [
2929
{"url" : "https://github.com/oracle/graal.git", "kind" : "git"},
3030
]
@@ -423,6 +423,18 @@
423423
"testProject" : True,
424424
},
425425

426+
"com.oracle.truffle.js.isolate": {
427+
"subDir" : "src",
428+
"sourceDirs" : ["src"],
429+
"dependencies" : [
430+
"truffle:TRUFFLE_API",
431+
],
432+
"annotationProcessors" : ["truffle:TRUFFLE_DSL_PROCESSOR"],
433+
"spotbugs" : "true",
434+
"javaCompliance" : "17+",
435+
"checkstyle" : "com.oracle.truffle.js",
436+
"workingSets" : "Truffle,JavaScript",
437+
},
426438
},
427439

428440
"distributions" : {
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
/*
2+
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
3+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4+
*
5+
* The Universal Permissive License (UPL), Version 1.0
6+
*
7+
* Subject to the condition set forth below, permission is hereby granted to any
8+
* person obtaining a copy of this software, associated documentation and/or
9+
* data (collectively the "Software"), free of charge and under any and all
10+
* copyright rights in the Software, and any and all patent rights owned or
11+
* freely licensable by each licensor hereunder covering either (i) the
12+
* unmodified Software as contributed to or provided by such licensor, or (ii)
13+
* the Larger Works (as defined below), to deal in both
14+
*
15+
* (a) the Software, and
16+
*
17+
* (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if
18+
* one is included with the Software each a "Larger Work" to which the Software
19+
* is contributed by such licensors),
20+
*
21+
* without restriction, including without limitation the rights to copy, create
22+
* derivative works of, display, perform, and distribute the Software and make,
23+
* use, sell, offer for sale, import, export, have made, and have sold the
24+
* Software and the Larger Work(s), and to sublicense the foregoing rights on
25+
* either these or other terms.
26+
*
27+
* This license is subject to the following condition:
28+
*
29+
* The above copyright notice and either this complete permission notice or at a
30+
* minimum a reference to the UPL must be included in all copies or substantial
31+
* portions of the Software.
32+
*
33+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
34+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
35+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
36+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
37+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
38+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
39+
* SOFTWARE.
40+
*/
41+
package com.oracle.truffle.js.isolate;
42+
43+
import com.oracle.truffle.api.CompilerDirectives;
44+
import com.oracle.truffle.api.InternalResource;
45+
46+
import java.io.IOException;
47+
import java.nio.file.Path;
48+
49+
@InternalResource.Id(value = PolyglotIsolateResource.ID, componentId = "engine", optional = true)
50+
public final class PolyglotIsolateResource implements InternalResource {
51+
52+
static final String ID = "js-isolate";
53+
54+
@Override
55+
public void unpackFiles(Env env, Path targetDirectory) throws IOException {
56+
Path base = basePath(env);
57+
env.unpackResourceFiles(base.resolve("files"), targetDirectory, base);
58+
}
59+
60+
@Override
61+
public String versionHash(Env env) {
62+
try {
63+
Path base = basePath(env);
64+
return env.readResourceLines(base.resolve("sha256")).get(0);
65+
} catch (IOException ioe) {
66+
throw CompilerDirectives.shouldNotReachHere(ioe);
67+
}
68+
}
69+
70+
private static Path basePath(Env env) {
71+
return Path.of("META-INF", "resources", "engine", ID, env.getOS().toString(), env.getCPUArchitecture().toString(), "libvm");
72+
}
73+
}

0 commit comments

Comments
 (0)