@@ -125,44 +125,41 @@ def feature(self):
125125
126126@total_ordering
127127class JVMCIVersionCheckVersion (object ):
128- def __init__ (self , jdk_version , jvmci_major , jvmci_minor , jvmci_build ):
128+ def __init__ (self , jdk_version , release_name , jvmci_build ):
129129 """
130130 Python version of jdk.graal.compiler.hotspot.JVMCIVersionCheck.Version
131131
132132 jdk_version is a JavaLangRuntimeVersion
133133 jvmci_major and jvmci_minor might be 0 if not needed (JDK 22+)
134134 """
135135 assert isinstance (jdk_version , JavaLangRuntimeVersion )
136- assert isinstance (jvmci_major , int )
137- assert isinstance (jvmci_minor , int )
138136 assert isinstance (jvmci_build , int )
139137 self .jdk_version = jdk_version
140- self .jvmci_major = jvmci_major
141- self .jvmci_minor = jvmci_minor
138+ self .release_name = release_name
142139 self .jvmci_build = jvmci_build
143140
144- def _as_tuple (self ):
145- return (self .jdk_version , self .jvmci_major , self .jvmci_minor , self .jvmci_build )
146-
147141 def __eq__ (self , other ):
148142 if not isinstance (other , JVMCIVersionCheckVersion ):
149143 return False
150- return self ._as_tuple ( ) == other ._as_tuple ( )
144+ return ( self .jdk_version , self . release_name , self . jvmci_build ) == ( other .jdk_version , other . release_name , other . jvmci_build )
151145
152146 def __lt__ (self , other ):
153147 if not isinstance (other , JVMCIVersionCheckVersion ):
154148 return NotImplemented
155- return self ._as_tuple () < other ._as_tuple ()
149+ if self .release_name != other .release_name :
150+ # cannot compare versions with different release_names
151+ return NotImplemented
152+ return (self .jdk_version , self .jvmci_build ) < (other .jdk_version , other .jvmci_build )
156153
157154 def __str__ (self ):
158- jdk_version , jvmci_major , jvmci_minor , jvmci_build = self ._as_tuple ( )
159- if jvmci_major == 0 :
155+ jdk_version , release_name , jvmci_build = ( self .jdk_version , self . release_name , self . jvmci_build )
156+ if not release_name :
160157 if jvmci_build == 0 :
161158 return f'(openjdk|oraclejdk)-{ jdk_version } '
162159 else :
163160 return f'labsjdk-(ce|ee)-{ jdk_version } -jvmci-b{ jvmci_build :02d} '
164161 else :
165- return f'labsjdk-(ce|ee)-{ jdk_version } -jvmci-{ jvmci_major } . { jvmci_minor } -b{ jvmci_build :02d} '
162+ return f'labsjdk-(ce|ee)-{ jdk_version } -jvmci-{ release_name } -b{ jvmci_build :02d} '
166163
167164
168165_jdk_jvmci_version = None
@@ -181,8 +178,8 @@ def _capture_jvmci_version(args=None):
181178 _run_jvmci_version_check (args , jdk = jdk , out = out )
182179 if out .data :
183180 try :
184- (jdk_version , jvmci_major , jvmci_minor , jvmci_build ) = out .data .split (',' )
185- return JVMCIVersionCheckVersion (JavaLangRuntimeVersion (jdk_version ), int ( jvmci_major ), int ( jvmci_minor ) , int (jvmci_build ))
181+ (jdk_version , release_name , jvmci_build ) = out .data .split (',' )
182+ return JVMCIVersionCheckVersion (JavaLangRuntimeVersion (jdk_version ), None if release_name == "null" else release_name , int (jvmci_build ))
186183 except ValueError :
187184 mx .warn (f'Could not parse jvmci version from JVMCIVersionCheck output:\n { out .data } ' )
188185 return None
@@ -1224,7 +1221,7 @@ def _check_latest_jvmci_version():
12241221 the JVMCI version of the JVMCI JDKs in the "jdks" section of the
12251222 ``common.json`` file and issues a warning if not.
12261223 """
1227- jvmci_re = re .compile (r'(?:ce|ee)-(?P<jdk_version>.+)-jvmci(?:-(?P<jvmci_major>\d+)\.(?P<jvmci_minor>\d +))?-b(?P<jvmci_build>\d+)' )
1224+ jvmci_re = re .compile (r'(?:ce|ee)-(?P<jdk_version>.+)-jvmci(?:-(?P<release_name>. +))?-b(?P<jvmci_build>\d+)' )
12281225 common_path = os .path .normpath (join (_suite .dir , '..' , 'common.json' ))
12291226
12301227 if _jdk_jvmci_version is None :
@@ -1242,13 +1239,13 @@ def get_latest_jvmci_version():
12421239 match = jvmci_re .match (version )
12431240 if not match :
12441241 mx .abort (f'Cannot parse version { version } ' )
1245- (jdk_version , jvmci_major , jvmci_minor , jvmci_build ) = match .groups (default = 0 )
1242+ (jdk_version , release_name , jvmci_build ) = match .groups (default = None )
12461243 if _jdk_jvmci_version .jvmci_build == 0 :
12471244 # jvmci_build == 0 indicates an OpenJDK version has been specified in JVMCIVersionCheck.java.
12481245 # The JDK does not know the jvmci_build number that might have been specified in common.json,
12491246 # as it is only a repackaged JDK. Thus, we reset the jvmci_build because we cannot validate it.
12501247 jvmci_build = 0
1251- current = JVMCIVersionCheckVersion (JavaLangRuntimeVersion (jdk_version ), int ( jvmci_major ), int ( jvmci_minor ) , int (jvmci_build ))
1248+ current = JVMCIVersionCheckVersion (JavaLangRuntimeVersion (jdk_version ), release_name , int (jvmci_build ))
12521249 if current .jdk_version .feature () == _jdk_jvmci_version .jdk_version .feature ():
12531250 # only compare the same major versions
12541251 if latest == 'not found' :
@@ -1284,12 +1281,18 @@ def get_latest_jvmci_version():
12841281 msg += ' suppress this error.'
12851282 mx .abort (msg )
12861283
1287- if success and _jdk_jvmci_version < latest :
1288- msg = f'JVMCI version of JAVA_HOME is older than in { common_path } : { _jdk_jvmci_version } < { latest } '
1289- msg += os .linesep + 'This poses the risk of hitting JVMCI bugs that have already been fixed.'
1290- msg += os .linesep + f'Consider using { latest } , which you can get via:'
1291- msg += os .linesep + f'mx fetch-jdk --configuration { common_path } '
1292- mx .abort_or_warn (msg , version_check_setting == 'strict' )
1284+ if success :
1285+ msg_suffix = os .linesep + 'This poses the risk of hitting JVMCI bugs that have already been fixed.'
1286+ msg_suffix += os .linesep + f'Consider using { latest } , which you can get via:'
1287+ msg_suffix += os .linesep + f'mx fetch-jdk --configuration { common_path } '
1288+ try :
1289+ if _jdk_jvmci_version < latest :
1290+ msg = f'JVMCI version of JAVA_HOME is older than in { common_path } : { _jdk_jvmci_version } < { latest } ' + msg_suffix
1291+ mx .abort_or_warn (msg , version_check_setting == 'strict' )
1292+ except TypeError :
1293+ msg = f'JVMCI version of JAVA_HOME incompatible with the version specified in { common_path } : { _jdk_jvmci_version } vs. { latest } ' + msg_suffix
1294+ mx .abort_or_warn (msg , version_check_setting == 'strict' )
1295+
12931296
12941297class GraalArchiveParticipant :
12951298 providersRE = re .compile (r'(?:META-INF/versions/([1-9][0-9]*)/)?META-INF/providers/(.+)' )
0 commit comments