Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
Created November 10, 2011 06:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rednaxelafx/1354299 to your computer and use it in GitHub Desktop.
Save rednaxelafx/1354299 to your computer and use it in GitHub Desktop.
Add compressed oops to VM info string, for HotSpot 20.0
OpenJDK Client VM (build 20.0-b11-internal, mixed mode, sharing)
OpenJDK 64-Bit Server VM (build 20.0-b11-internal, mixed mode, compressed oops)
diff -r f0f676c5a2c6 src/share/vm/runtime/vm_version.cpp
--- a/src/share/vm/runtime/vm_version.cpp Tue Mar 15 19:30:16 2011 -0700
+++ b/src/share/vm/runtime/vm_version.cpp Thu Nov 10 14:41:05 2011 +0800
@@ -137,18 +137,46 @@
#endif
}
+enum {
+ mode_bits = 2,
+ sharing_bits = 1,
+ coops_bits = 1
+};
+
+enum {
+ mode_shift = 0,
+ sharing_shift = mode_bits,
+ coops_shift = sharing_shift + sharing_bits
+};
+
+const char* unknown_info = "unknown VM";
+
+const char* info_strs[] = { // coops | sharing | mode
+ "interpreted mode", // 0 | 0 | 00
+ "mixed mode", // 0 | 0 | 01
+ "compiled mode", // 0 | 0 | 10
+ unknown_info, // 0 | 0 | 11
+ "interpreted mode, sharing", // 0 | 1 | 00
+ "mixed mode, sharing", // 0 | 1 | 01
+ "compiled mode, sharing", // 0 | 1 | 10
+ unknown_info, // 0 | 1 | 11
+ "interpreted mode, compressed oops", // 1 | 0 | 00
+ "mixed mode, compressed oops", // 1 | 0 | 01
+ "compiled mode, compressed oops", // 1 | 0 | 10
+ unknown_info, // 1 | 0 | 11
+ "interpreted mode, sharing, compressed oops", // 1 | 1 | 00
+ "mixed mode, sharing, compressed oops", // 1 | 1 | 01
+ "compiled mode, sharing, compressed oops", // 1 | 1 | 10
+ unknown_info // 1 | 1 | 11
+};
const char* Abstract_VM_Version::vm_info_string() {
- switch (Arguments::mode()) {
- case Arguments::_int:
- return UseSharedSpaces ? "interpreted mode, sharing" : "interpreted mode";
- case Arguments::_mixed:
- return UseSharedSpaces ? "mixed mode, sharing" : "mixed mode";
- case Arguments::_comp:
- return UseSharedSpaces ? "compiled mode, sharing" : "compiled mode";
- };
- ShouldNotReachHere();
- return "";
+ int index = Arguments::mode() << mode_shift
+ | (UseSharedSpaces ? 1 : 0) << sharing_shift
+ | (UseCompressedOops ? 1 : 0) << coops_shift;
+ const char* info_str = info_strs[index];
+ if (unknown_info == info_str) ShouldNotReachHere();
+ return info_str;
}
// NOTE: do *not* use stringStream. this function is called by
diff -r f0f676c5a2c6 src/share/vm/utilities/vmError.cpp
--- a/src/share/vm/utilities/vmError.cpp Tue Mar 15 19:30:16 2011 -0700
+++ b/src/share/vm/utilities/vmError.cpp Thu Nov 10 14:41:05 2011 +0800
@@ -434,12 +434,11 @@
st->print_cr("#");
JDK_Version::current().to_string(buf, sizeof(buf));
st->print_cr("# JRE version: %s", buf);
- st->print_cr("# Java VM: %s (%s %s %s %s)",
+ st->print_cr("# Java VM: %s (%s %s %s)",
Abstract_VM_Version::vm_name(),
Abstract_VM_Version::vm_release(),
Abstract_VM_Version::vm_info_string(),
- Abstract_VM_Version::vm_platform_string(),
- UseCompressedOops ? "compressed oops" : ""
+ Abstract_VM_Version::vm_platform_string()
);
STEP(60, "(printing problematic frame)")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment