comparison mx/mx_graal.py @ 15916:6aa352b260f4

removed use of ServiceLoader in runtime initialization
author Doug Simon <doug.simon@oracle.com>
date Mon, 26 May 2014 18:55:06 +0200
parents db776f9bea7c
children 7c84f0ce7cae
comparison
equal deleted inserted replaced
15915:d1e9a44b14cc 15916:6aa352b260f4
482 else: 482 else:
483 toDelete = join(jreLibDir, 'graal.options') 483 toDelete = join(jreLibDir, 'graal.options')
484 if exists(toDelete): 484 if exists(toDelete):
485 os.unlink(toDelete) 485 os.unlink(toDelete)
486 486
487 def _update_HotSpotOptions_inline_hpp(graalJar): 487 def _update_graalRuntime_inline_hpp(graalJar):
488 p = mx.project('com.oracle.graal.hotspot') 488 p = mx.project('com.oracle.graal.hotspot.codegen')
489 mainClass = 'com.oracle.graal.hotspot.HotSpotOptionsLoader' 489 mainClass = 'com.oracle.graal.hotspot.codegen.GenGraalRuntimeInlineHpp'
490 assert exists(join(p.source_dirs()[0], mainClass.replace('.', os.sep) + '.java')) 490 if exists(join(p.output_dir(), mainClass.replace('.', os.sep) + '.class')):
491 491 hsSrcGenDir = join(mx.project('com.oracle.graal.hotspot').source_gen_dir(), 'hotspot')
492 def mainClassExists():
493 with zipfile.ZipFile(graalJar, 'r') as zf:
494 mainClassFile = mainClass.replace('.', '/') + '.class'
495 return mainClassFile in zf.namelist()
496
497 if mainClassExists():
498 hsSrcGenDir = join(p.source_gen_dir(), 'hotspot')
499 if not exists(hsSrcGenDir): 492 if not exists(hsSrcGenDir):
500 os.makedirs(hsSrcGenDir) 493 os.makedirs(hsSrcGenDir)
494
501 tmp = StringIO.StringIO() 495 tmp = StringIO.StringIO()
502 mx.run_java(['-cp', graalJar, mainClass], out=tmp.write) 496 mx.run_java(['-cp', '{}{}{}'.format(graalJar, os.pathsep, p.output_dir()), mainClass], out=tmp.write)
503 mx.update_file(join(hsSrcGenDir, 'HotSpotOptions.inline.hpp'), tmp.getvalue()) 497 mx.update_file(join(hsSrcGenDir, 'graalRuntime.inline.hpp'), tmp.getvalue())
504 498
505 def _installGraalJarInJdks(graalDist): 499 def _installGraalJarInJdks(graalDist):
506 graalJar = graalDist.path 500 graalJar = graalDist.path
507 _update_HotSpotOptions_inline_hpp(graalJar) 501 _update_graalRuntime_inline_hpp(graalJar)
508 jdks = _jdksDir() 502 jdks = _jdksDir()
509 503
510 if exists(jdks): 504 if exists(jdks):
511 for e in os.listdir(jdks): 505 for e in os.listdir(jdks):
512 jreLibDir = join(jdks, e, 'jre', 'lib') 506 jreLibDir = join(jdks, e, 'jre', 'lib')