def get_graal_jdk(): """ Gets a Graal JDK which adds support for handling the -G format of Graal options. """ jvmci_jdk = get_jvmci_jdk() if JVMCI_VERSION < 9: from mx_jvmci import check_VM_exists, JVMCI8JDKConfig # pylint: disable=no-name-in-module vmbuild = jvmci_jdk.vmbuild check_VM_exists(get_vm(), jvmci_jdk.home, vmbuild) jdk = _graal_jdks.get(vmbuild) if jdk is None: class GraalJDK8Config(JVMCI8JDKConfig): def __init__(self, vmbuild): # pylint: disable=super-init-not-called JVMCI8JDKConfig.__init__(self, vmbuild) def parseVmArgs(self, args, addDefaultArgs=True): return JVMCI8JDKConfig.parseVmArgs(self, _buildGOptionsArgs(args), addDefaultArgs=addDefaultArgs) jdk = GraalJDK8Config(vmbuild) _graal_jdks[vmbuild] = jdk else: jdk = _graal_jdks.get('default') if jdk is None: from mx_jvmci import JVMCI9JDKConfig # pylint: disable=no-name-in-module class GraalJDK9Config(JVMCI9JDKConfig): def __init__(self, debugLevel): JVMCI9JDKConfig.__init__(self, debugLevel) def parseVmArgs(self, args, addDefaultArgs=True): return JVMCI9JDKConfig.parseVmArgs(self, _buildGOptionsArgs(args), addDefaultArgs=addDefaultArgs) jdk = GraalJDK9Config(jvmci_jdk.debugLevel) _graal_jdks['default'] = jdk return jdk