1
- # Copyright (c) 2018, Oracle and/or its affiliates.
1
+ # Copyright (c) 2018, 2019, Oracle and/or its affiliates.
2
2
# Copyright (c) 2013, Regents of the University of California
3
3
#
4
4
# All rights reserved.
30
30
from os .path import join
31
31
32
32
import mx
33
+ import mx_subst
33
34
import mx_benchmark
34
35
from mx_benchmark import StdOutRule , java_vm_registry , Vm , GuestVm , VmBenchmarkSuite , AveragingBenchmarkMixin
35
36
from mx_graalpython_bench_param import HARNESS_PATH
55
56
PYTHON_VM_REGISTRY_NAME = "Python"
56
57
CONFIGURATION_DEFAULT = "default"
57
58
CONFIGURATION_EXPERIMENTAL_SPLITTING = "experimental_splitting"
59
+ CONFIGURATION_SANDBOXED = "sandboxed"
58
60
59
61
DEFAULT_ITERATIONS = 10
60
62
@@ -187,13 +189,14 @@ def name(self):
187
189
188
190
class GraalPythonVm (GuestVm ):
189
191
def __init__ (self , config_name = CONFIGURATION_DEFAULT , distributions = None , cp_suffix = None , cp_prefix = None ,
190
- host_vm = None , extra_vm_args = None ):
192
+ host_vm = None , extra_vm_args = None , extra_polyglot_args = None ):
191
193
super (GraalPythonVm , self ).__init__ (host_vm = host_vm )
192
194
self ._config_name = config_name
193
195
self ._distributions = distributions
194
196
self ._cp_suffix = cp_suffix
195
197
self ._cp_prefix = cp_prefix
196
198
self ._extra_vm_args = extra_vm_args
199
+ self ._extra_polyglot_args = extra_polyglot_args
197
200
198
201
def hosting_registry (self ):
199
202
return java_vm_registry
@@ -211,10 +214,15 @@ def run(self, cwd, args):
211
214
assert isinstance (self ._distributions , list ), "distributions must be either None or a list"
212
215
dists += self ._distributions
213
216
217
+ extra_polyglot_args = self ._extra_polyglot_args if isinstance (self ._extra_polyglot_args , list ) else []
214
218
if mx .suite ("sulong" , fatalIfMissing = False ):
215
219
dists .append ('SULONG' )
216
220
if mx .suite ("sulong-managed" , fatalIfMissing = False ):
217
221
dists .append ('SULONG_MANAGED' )
222
+ extra_polyglot_args += [mx_subst .path_substitutions .substitute ('--llvm.libraryPath=<path:SULONG_MANAGED_LIBS>' )]
223
+ else :
224
+ extra_polyglot_args += [mx_subst .path_substitutions .substitute ('--llvm.libraryPath=<path:SULONG_LIBS>' )]
225
+
218
226
219
227
vm_args = mx .get_runtime_jvm_args (dists , cp_suffix = self ._cp_suffix , cp_prefix = self ._cp_prefix )
220
228
if isinstance (self ._extra_vm_args , list ):
@@ -223,7 +231,7 @@ def run(self, cwd, args):
223
231
"-Dpython.home=%s" % join (SUITE .dir , "graalpython" ),
224
232
"com.oracle.graal.python.shell.GraalPythonMain"
225
233
]
226
- cmd = truffle_options + vm_args + args
234
+ cmd = truffle_options + vm_args + extra_polyglot_args + args
227
235
return self .host_vm ().run (cwd , cmd )
228
236
229
237
def name (self ):
@@ -234,7 +242,8 @@ def config_name(self):
234
242
235
243
def with_host_vm (self , host_vm ):
236
244
return self .__class__ (config_name = self ._config_name , distributions = self ._distributions ,
237
- cp_suffix = self ._cp_suffix , cp_prefix = self ._cp_prefix , host_vm = host_vm )
245
+ cp_suffix = self ._cp_suffix , cp_prefix = self ._cp_prefix , host_vm = host_vm ,
246
+ extra_vm_args = self ._extra_vm_args , extra_polyglot_args = self ._extra_polyglot_args )
238
247
239
248
240
249
# ----------------------------------------------------------------------------------------------------------------------
0 commit comments