Skip to content

Commit de8da6c

Browse files
committed
[GR-41451] When available, add LibGraal to java.base.jmod.
PullRequest: graal/12851
2 parents beba41a + 0605e78 commit de8da6c

File tree

6 files changed

+182
-169
lines changed

6 files changed

+182
-169
lines changed

compiler/mx.compiler/mx_compiler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1344,7 +1344,6 @@ def _jvmci_jars():
13441344
'compiler:GRAAL_PROCESSOR',
13451345
],
13461346
jvmci_jars=_jvmci_jars(),
1347-
graal_compiler='graal',
13481347
stability="supported",
13491348
),
13501349
mx_sdk_vm.GraalVmComponent(

sdk/mx.sdk/mx_sdk_vm.py

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -201,12 +201,14 @@ def __init__(self, destination, jar_distributions, main_class, build_args, langu
201201

202202

203203
class LibraryConfig(AbstractNativeImageConfig):
204-
def __init__(self, destination, jar_distributions, build_args, jvm_library=False, use_modules=None, home_finder=False, **kwargs):
204+
def __init__(self, destination, jar_distributions, build_args, jvm_library=False, use_modules=None, add_to_module=None, home_finder=False, **kwargs):
205205
"""
206206
:param bool jvm_library
207+
:param str add_to_module: the simple name of a module that should be modified to include this native library. It must not be a path or end with `.jmod`
207208
"""
208209
super(LibraryConfig, self).__init__(destination, jar_distributions, build_args, use_modules=use_modules, home_finder=home_finder, **kwargs)
209210
self.jvm_library = jvm_library
211+
self.add_to_module = add_to_module
210212

211213

212214
class LanguageLibraryConfig(LibraryConfig):
@@ -422,15 +424,12 @@ class GraalVmJreComponent(GraalVmComponent):
422424

423425

424426
class GraalVmJvmciComponent(GraalVmJreComponent):
425-
def __init__(self, suite, name, short_name, license_files, third_party_license_files, jvmci_jars,
426-
graal_compiler=None, **kwargs):
427+
def __init__(self, suite, name, short_name, license_files, third_party_license_files, jvmci_jars, **kwargs):
427428
"""
428429
:type jvmci_jars: list[str]
429-
:type graal_compiler: str
430430
"""
431431
super(GraalVmJvmciComponent, self).__init__(suite, name, short_name, license_files, third_party_license_files,
432432
**kwargs)
433-
self.graal_compiler = graal_compiler
434433
self.jvmci_jars = jvmci_jars or []
435434

436435
assert isinstance(self.jvmci_jars, list)
@@ -611,12 +610,6 @@ def jlink_has_save_jlink_argfiles(jdk):
611610
"""
612611
return _probe_jlink_info(jdk, '.supports_save_jlink_argfiles')
613612

614-
def jlink_has_copy_files(jdk):
615-
"""
616-
Determines if the jlink executable in `jdk` supports ``--copy-files``.
617-
"""
618-
return _probe_jlink_info(jdk, '.supports_copy_files')
619-
620613
def _jdk_omits_warning_for_jlink_set_ThreadPriorityPolicy(jdk): # pylint: disable=invalid-name
621614
"""
622615
Determines if the `jdk` suppresses a warning about ThreadPriorityPolicy when it
@@ -972,17 +965,6 @@ def jlink_new_jdk(jdk, dst_jdk_dir, module_dists, ignore_dists,
972965
jlink.append('--add-modules=' + ','.join(_get_image_root_modules(root_module_names, module_names, jdk_modules.keys(), use_upgrade_module_path)))
973966
jlink_persist.append('--add-modules=jdk.internal.vm.ci')
974967

975-
if jlink_has_copy_files(jdk):
976-
import mx_sdk_vm_impl
977-
libgraal_component = mx_sdk_vm_impl._get_libgraal_component()
978-
if libgraal_component is not None:
979-
# Only bake --copy-files into the args of <dst_jdk_dir>/bin/jlink
980-
# if libgraal will be in <dst_jdk_dir>/lib
981-
libgraal = f'lib/{mx.add_lib_suffix(mx.add_lib_prefix("jvmcicompiler"))}'
982-
if mx.get_os() == 'windows':
983-
libgraal = libgraal.replace('lib/', 'bin/')
984-
jlink_persist.append(f'--copy-files={libgraal}')
985-
986968
module_path = patched_java_base + os.pathsep + jmods_dir
987969
if modules and not use_upgrade_module_path:
988970
module_path = os.pathsep.join((m.get_jmod_path(respect_stripping=True) for m in modules)) + os.pathsep + module_path

0 commit comments

Comments
 (0)