Hi Andrew, Thanks for looking at this.
On Tue, 2020-05-12 at 14:07 +0100, Andrew Haley wrote: > On 5/7/20 4:09 PM, Severin Gehwolf wrote: > > jvm_version_info.jvm_version currently holds this quadruplet: > > > > Most significant 8 bits => major version, followed by 8 bits => minor > > version, followed by 8 bits => micro version, followed by 8 bits => > > build version. Note that JVM minor version represents the update > > version as passed in via configure and the micro version is currently > > not used (always 0). See vm_version.cpp lines 100-102 where only major, > > minor and build number are ever been set. Knowing this, we can still > > preserve the same behavior after patch by defining JVM_VERSION_MICRO to > > 0 for any version. > > This is tricky. JVM_GetVersionInfo is a function exported by > libjvm.so, and the version is simply encoded as > > unsigned int Abstract_VM_Version::jvm_version() { > return ((Abstract_VM_Version::vm_major_version() & 0xFF) << 24) | > ((Abstract_VM_Version::vm_minor_version() & 0xFF) << 16) | > (Abstract_VM_Version::vm_build_number() & 0xFF); > } > > I guess we could argue that this is for JVM-JDK internal use only, and > no-one else cares. > > Or we could encode it in a different way such that at least we have a > jvm_version that is monotonically increasing, perhaps by (ab)using the > lower 8 bits of the version, the vm_build_number. But I guess I'm > being paranoid, and no tools are going to care about minor versions > anyway,even if they do call JVM_GetVersionInfo. Yes, this is indeed tricky. The trouble is that Abstract_VM_Version::vm_build_number() actually holds the configured JDK build number, we can't really use it. It's already being used. (gdb) 99 100 _vm_major_version = atoi(vm_major_ver); 101 _vm_minor_version = atoi(vm_minor_ver); 102 _vm_build_number = atoi(vm_build_num); 103 104 os::free(vm_version); 105 _initialized = true; 106 } 107 108 #if defined(_LP64) (gdb) p _vm_build_number $1 = 2 The only bits which seem unused are bits 8 through 16 of this unsigned int. So even if JVM_GetVersionInfo *is* being used somewhere in the wild, it *should* continue to work. Hence, the proposal to now also use those unused bits for the minor version. Thoughts? Thanks, Severin