diff mx/mx_graal.py @ 16395:ad431bf0de07

added support to load classes from graal.jar with a separate class loader
author Doug Simon <doug.simon@oracle.com>
date Thu, 03 Jul 2014 16:30:28 +0200
parents 0dd27c6472d7
children 9fe3cb463079
line wrap: on
line diff
--- a/mx/mx_graal.py	Thu Jul 03 14:31:34 2014 +0200
+++ b/mx/mx_graal.py	Thu Jul 03 16:30:28 2014 +0200
@@ -459,6 +459,7 @@
 
     if installGraalJar:
         _installGraalJarInJdks(mx.distribution('GRAAL'))
+        _installGraalJarInJdks(mx.distribution('GRAAL_LOADER'))
 
     if vmToCheck is not None:
         jvmCfg = _vmCfgInJdk(jdk)
@@ -497,7 +498,8 @@
 
 def _installGraalJarInJdks(graalDist):
     graalJar = graalDist.path
-    _update_graalRuntime_inline_hpp(graalJar)
+    if graalJar.endswith('graal.jar'):
+        _update_graalRuntime_inline_hpp(graalJar)
     jdks = _jdksDir()
 
     if exists(jdks):
@@ -649,6 +651,7 @@
             assert os.path.isdir(opts2.export_dir), '{} is not a directory'.format(opts2.export_dir)
 
         shutil.copy(mx.distribution('GRAAL').path, opts2.export_dir)
+        shutil.copy(mx.distribution('GRAAL_LOADER').path, opts2.export_dir)
         graalOptions = join(_graal_home, 'graal.options')
         if exists(graalOptions):
             shutil.copy(graalOptions, opts2.export_dir)
@@ -1050,14 +1053,17 @@
             prefixArgs.append('-XX:-DisableExplicitGC')
         with open(testfile) as fp:
             testclasses = [l.rstrip() for l in fp.readlines()]
-            
-        # Remove entries from class path that are in graal.jar
+
+        # Remove entries from class path that are in graal.jar and
+        # run the VM in a mode where application/test classes can
+        # access core Graal classes.
         cp = prefixCp + coreCp + os.pathsep + projectsCp
         if isGraalEnabled(_get_vm()):
             graalDist = mx.distribution('GRAAL')
             graalJarCp = set([d.output_dir() for d in graalDist.sorted_deps()])
             cp = os.pathsep.join([e for e in cp.split(os.pathsep) if e not in graalJarCp])
-        
+            vmArgs = vmArgs + ['-XX:-UseGraalClassLoader']
+
         if len(testclasses) == 1:
             # Execute Junit directly when one test is being run. This simplifies
             # replaying the VM execution in a native debugger (e.g., gdb).
@@ -2185,3 +2191,4 @@
     _vm_prefix = opts.vm_prefix
 
     mx.distribution('GRAAL').add_update_listener(_installGraalJarInJdks)
+    mx.distribution('GRAAL_LOADER').add_update_listener(_installGraalJarInJdks)