File tree Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Expand file tree Collapse file tree 3 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -129,7 +129,12 @@ JavaFullVersion JavaVersionAccess::get_java_version(char* prop_value) {
129129 if (version.major < 9 ) {
130130 version.major = 9 ;
131131 }
132- // format is 11.0.17+8
132+ char * peg_char = strchr (prop_value, ' +' );
133+ if (peg_char) {
134+ // terminate before the build specification
135+ *peg_char = ' \0 ' ;
136+ }
137+ // format is 11.0.17
133138 // this shortcut for parsing the update version should hold till Java 99
134139 version.update = atoi (prop_value + 5 );
135140 }
Original file line number Diff line number Diff line change @@ -240,6 +240,11 @@ void VMStructs::initOffsets() {
240240 if (strcmp (field, " _klass_offset" ) == 0 ) {
241241 _klass_offset_addr = *(int **)(entry + address_offset);
242242 }
243+ } else if (strcmp (type, " Thread" ) == 0 ) {
244+ // Since JDK 24, _osthread field belongs to Thread rather than JavaThread
245+ if (strcmp (field, " _osthread" ) == 0 ) {
246+ _thread_osthread_offset = *(int *)(entry + offset_offset);
247+ }
243248 } else if (strcmp (type, " JavaThread" ) == 0 ) {
244249 if (strcmp (field, " _osthread" ) == 0 ) {
245250 _thread_osthread_offset = *(int *)(entry + offset_offset);
Original file line number Diff line number Diff line change 235235 EXPECT_EQ (9 , hs_version1);
236236 }
237237
238+ TEST (JavaVersionAccess, testJavaVersionAccess_hs_24) {
239+ char runtime_prop_value_1[] = " 24+36-FR" ;
240+ char vm_prop_value_1[] = " 24+36-FR" ;
241+
242+ JavaFullVersion java_version1 = JavaVersionAccess::get_java_version (runtime_prop_value_1);
243+ int hs_version1 = JavaVersionAccess::get_hotspot_version (vm_prop_value_1);
244+ EXPECT_EQ (24 , java_version1.major );
245+ EXPECT_EQ (0 , java_version1.update );
246+ EXPECT_EQ (24 , hs_version1);
247+ }
248+
238249 int main (int argc, char **argv) {
239250 ::testing::InitGoogleTest (&argc, argv);
240251 return RUN_ALL_TESTS ();
You can’t perform that action at this time.
0 commit comments