370 def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):
371 run_vm(vmArgs + [mainClass] + mainClassArgs)
372
373 mx_unittest.set_vm_launcher('JVMCI VM launcher', _unittest_vm_launcher)
374
375 def _jvmci_gate_runner(args, tasks):
376 # Build release server VM now so we can run the unit tests
377 with Task('BuildHotSpotJVMCIHosted: release', tasks) as t:
378 if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'release'])
379
380 # Run unit tests in hosted mode
381 with VM(jvmVariant='server', debugLevel='release', jvmciMode='hosted'):
382 with Task('JVMCI UnitTests: hosted-release', tasks) as t:
383 if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast'])
384
385 # Build the other VM flavors
386 with Task('BuildHotSpotJVMCIOthers: fastdebug', tasks) as t:
387 if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'fastdebug'])
388
389 with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t:
390 if t and platform.processor() != 'sparc':
391 buildxml = mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
392 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
393
394 mx_gate.add_gate_runner(_suite, _jvmci_gate_runner)
395 mx_gate.add_gate_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM')
396
397 def _igvJdk():
398 v8u20 = mx.VersionSpec("1.8.0_20")
399 v8u40 = mx.VersionSpec("1.8.0_40")
400 v8 = mx.VersionSpec("1.8")
401 def _igvJdkVersionCheck(version):
402 return version >= v8 and (version < v8u20 or version >= v8u40)
403 return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="building & running IGV").home
404
405 def _igvBuildEnv():
406 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
407 env = dict(os.environ)
408 proxy = os.environ.get('http_proxy')
409 if not (proxy is None) and len(proxy) > 0:
410 if '://' in proxy:
469 zf = zipfile.ZipFile(archive, 'r')
470 zf.extractall(libpath)
471
472 if not exists(executable):
473 mx.abort('C1Visualizer binary does not exist: ' + executable)
474
475 if mx.get_os() != 'windows':
476 # Make sure that execution is allowed. The zip file does not always specfiy that correctly
477 os.chmod(executable, 0777)
478
479 mx.run([executable])
480
481 def hsdis(args, copyToDir=None):
482 """download the hsdis library
483
484 This is needed to support HotSpot's assembly dumping features.
485 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
486 flavor = 'intel'
487 if 'att' in args:
488 flavor = 'att'
489 if mx.get_arch() == "sparcv9":
490 flavor = "sparcv9"
491 lib = mx.add_lib_suffix('hsdis-' + mx.get_arch())
492 path = join(_suite.dir, 'lib', lib)
493
494 sha1s = {
495 'att/hsdis-amd64.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72',
496 'att/hsdis-amd64.so' : '58919ba085d4ef7a513f25bae75e7e54ee73c049',
497 'intel/hsdis-amd64.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30',
498 'intel/hsdis-amd64.so' : '844ed9ffed64fe9599638f29a8450c50140e3192',
499 'intel/hsdis-amd64.dylib' : 'fdb13ef0d7d23d93dacaae9c98837bea0d4fc5a2',
500 'sparcv9/hsdis-sparcv9.so': '970640a9af0bd63641f9063c11275b371a59ee60',
501 }
502
503 flavoredLib = flavor + "/" + lib
504 if flavoredLib not in sha1s:
505 mx.logv("hsdis not supported on this plattform or architecture")
506 return
507
508 if not exists(path):
509 sha1 = sha1s[flavoredLib]
510 sha1path = path + '.sha1'
511 mx.download_file_with_sha1('hsdis', path, ['https://lafo.ssw.uni-linz.ac.at/pub/hsdis/' + flavoredLib], sha1, sha1path, True, True, sources=False)
512 if copyToDir is not None and exists(copyToDir):
513 shutil.copy(path, copyToDir)
514
515 def hcfdis(args):
516 """disassemble HexCodeFiles embedded in text files
517
518 Run a tool over the input files to convert all embedded HexCodeFiles
519 to a disassembled format."""
520
562 def jol(args):
563 """Java Object Layout"""
564 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True)
565 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s))
566
567 if len(candidates) > 0:
568 candidates = mx.select_items(sorted(candidates))
569 else:
570 # mx.findclass can be mistaken, don't give up yet
571 candidates = args
572
573 run_vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates)
574
575 def _get_openjdk_os():
576 # See: common/autoconf/platform.m4
577 os = mx.get_os()
578 if 'darwin' in os:
579 os = 'macosx'
580 elif 'linux' in os:
581 os = 'linux'
582 elif 'solaris' in os:
583 os = 'solaris'
584 elif 'cygwin' in os or 'mingw' in os:
585 os = 'windows'
586 return os
587
588 def _get_openjdk_cpu():
589 cpu = mx.get_arch()
590 if cpu == 'amd64':
591 cpu = 'x86_64'
592 elif cpu == 'sparcv9':
593 cpu = 'sparcv9'
594 return cpu
595
596 def _get_openjdk_os_cpu():
597 return _get_openjdk_os() + '-' + _get_openjdk_cpu()
598
599 def _get_jdk_dir():
600 suiteParentDir = dirname(_suite.dir)
601 # suitParentDir is now something like: /some_prefix/jdk10-hs/open/src
602 pathComponents = suiteParentDir.split(os.sep)
603 for i in range(0, len(pathComponents)):
604 if pathComponents[i] in ["open", "src"]:
605 del pathComponents[i:]
606 break
607 return os.path.join(os.sep, *pathComponents)
608
609 def _get_jdk_build_dir(debugLevel=None):
610 """
611 Gets the directory into which the JDK is built. This directory contains
612 the exploded JDK under jdk/ and the JDK image under images/jdk/.
613 """
|
370 def _unittest_vm_launcher(vmArgs, mainClass, mainClassArgs):
371 run_vm(vmArgs + [mainClass] + mainClassArgs)
372
373 mx_unittest.set_vm_launcher('JVMCI VM launcher', _unittest_vm_launcher)
374
375 def _jvmci_gate_runner(args, tasks):
376 # Build release server VM now so we can run the unit tests
377 with Task('BuildHotSpotJVMCIHosted: release', tasks) as t:
378 if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'release'])
379
380 # Run unit tests in hosted mode
381 with VM(jvmVariant='server', debugLevel='release', jvmciMode='hosted'):
382 with Task('JVMCI UnitTests: hosted-release', tasks) as t:
383 if t: unittest(['--suite', 'jvmci', '--enable-timing', '--verbose', '--fail-fast'])
384
385 # Build the other VM flavors
386 with Task('BuildHotSpotJVMCIOthers: fastdebug', tasks) as t:
387 if t: _runmultimake(['--jdk-jvm-variants', 'server', '--jdk-debug-levels', 'fastdebug'])
388
389 with Task('CleanAndBuildIdealGraphVisualizer', tasks, disableJacoco=True) as t:
390 if t:
391 buildxml = mx._cygpathU2W(join(_suite.dir, 'src', 'share', 'tools', 'IdealGraphVisualizer', 'build.xml'))
392 mx.run(['ant', '-f', buildxml, '-q', 'clean', 'build'], env=_igvBuildEnv())
393
394 mx_gate.add_gate_runner(_suite, _jvmci_gate_runner)
395 mx_gate.add_gate_argument('-g', '--only-build-jvmci', action='store_false', dest='buildNonJVMCI', help='only build the JVMCI VM')
396
397 def _igvJdk():
398 v8u20 = mx.VersionSpec("1.8.0_20")
399 v8u40 = mx.VersionSpec("1.8.0_40")
400 v8 = mx.VersionSpec("1.8")
401 def _igvJdkVersionCheck(version):
402 return version >= v8 and (version < v8u20 or version >= v8u40)
403 return mx.get_jdk(_igvJdkVersionCheck, versionDescription='>= 1.8 and < 1.8.0u20 or >= 1.8.0u40', purpose="building & running IGV").home
404
405 def _igvBuildEnv():
406 # When the http_proxy environment variable is set, convert it to the proxy settings that ant needs
407 env = dict(os.environ)
408 proxy = os.environ.get('http_proxy')
409 if not (proxy is None) and len(proxy) > 0:
410 if '://' in proxy:
469 zf = zipfile.ZipFile(archive, 'r')
470 zf.extractall(libpath)
471
472 if not exists(executable):
473 mx.abort('C1Visualizer binary does not exist: ' + executable)
474
475 if mx.get_os() != 'windows':
476 # Make sure that execution is allowed. The zip file does not always specfiy that correctly
477 os.chmod(executable, 0777)
478
479 mx.run([executable])
480
481 def hsdis(args, copyToDir=None):
482 """download the hsdis library
483
484 This is needed to support HotSpot's assembly dumping features.
485 By default it downloads the Intel syntax version, use the 'att' argument to install AT&T syntax."""
486 flavor = 'intel'
487 if 'att' in args:
488 flavor = 'att'
489 lib = mx.add_lib_suffix('hsdis-' + mx.get_arch())
490 path = join(_suite.dir, 'lib', lib)
491
492 sha1s = {
493 'att/hsdis-amd64.dll' : 'bcbd535a9568b5075ab41e96205e26a2bac64f72',
494 'att/hsdis-amd64.so' : '58919ba085d4ef7a513f25bae75e7e54ee73c049',
495 'intel/hsdis-amd64.dll' : '6a388372cdd5fe905c1a26ced614334e405d1f30',
496 'intel/hsdis-amd64.so' : '844ed9ffed64fe9599638f29a8450c50140e3192',
497 'intel/hsdis-amd64.dylib' : 'fdb13ef0d7d23d93dacaae9c98837bea0d4fc5a2',
498 }
499
500 flavoredLib = flavor + "/" + lib
501 if flavoredLib not in sha1s:
502 mx.logv("hsdis not supported on this plattform or architecture")
503 return
504
505 if not exists(path):
506 sha1 = sha1s[flavoredLib]
507 sha1path = path + '.sha1'
508 mx.download_file_with_sha1('hsdis', path, ['https://lafo.ssw.uni-linz.ac.at/pub/hsdis/' + flavoredLib], sha1, sha1path, True, True, sources=False)
509 if copyToDir is not None and exists(copyToDir):
510 shutil.copy(path, copyToDir)
511
512 def hcfdis(args):
513 """disassemble HexCodeFiles embedded in text files
514
515 Run a tool over the input files to convert all embedded HexCodeFiles
516 to a disassembled format."""
517
559 def jol(args):
560 """Java Object Layout"""
561 joljar = mx.library('JOL_INTERNALS').get_path(resolve=True)
562 candidates = mx.findclass(args, logToConsole=False, matcher=lambda s, classname: s == classname or classname.endswith('.' + s) or classname.endswith('$' + s))
563
564 if len(candidates) > 0:
565 candidates = mx.select_items(sorted(candidates))
566 else:
567 # mx.findclass can be mistaken, don't give up yet
568 candidates = args
569
570 run_vm(['-javaagent:' + joljar, '-cp', os.pathsep.join([mx.classpath(), joljar]), "org.openjdk.jol.MainObjectInternals"] + candidates)
571
572 def _get_openjdk_os():
573 # See: common/autoconf/platform.m4
574 os = mx.get_os()
575 if 'darwin' in os:
576 os = 'macosx'
577 elif 'linux' in os:
578 os = 'linux'
579 elif 'cygwin' in os or 'mingw' in os:
580 os = 'windows'
581 return os
582
583 def _get_openjdk_cpu():
584 cpu = mx.get_arch()
585 if cpu == 'amd64':
586 cpu = 'x86_64'
587 return cpu
588
589 def _get_openjdk_os_cpu():
590 return _get_openjdk_os() + '-' + _get_openjdk_cpu()
591
592 def _get_jdk_dir():
593 suiteParentDir = dirname(_suite.dir)
594 # suitParentDir is now something like: /some_prefix/jdk10-hs/open/src
595 pathComponents = suiteParentDir.split(os.sep)
596 for i in range(0, len(pathComponents)):
597 if pathComponents[i] in ["open", "src"]:
598 del pathComponents[i:]
599 break
600 return os.path.join(os.sep, *pathComponents)
601
602 def _get_jdk_build_dir(debugLevel=None):
603 """
604 Gets the directory into which the JDK is built. This directory contains
605 the exploded JDK under jdk/ and the JDK image under images/jdk/.
606 """
|