static bool compressedOOPSEnabled_is64bitHotSpot; static bool compressedOOPSEnabled_compressedOOPS; static bool compressedOOPSEnabled_checked; static bool compressedOOPSEnabled() { if (compressedOOPSEnabled_checked) ret compressedOOPSEnabled_compressedOOPS; S OS_ARCH = System.getProperty("os.arch"); S MANAGEMENT_FACTORY_CLASS = "java.lang.management.ManagementFactory"; S HOTSPOT_BEAN_CLASS = "com.sun.management.HotSpotDiagnosticMXBean"; S x = System.getProperty("sun.arch.data.model"); bool is64Bit = contains(or(x, OS_ARCH), "64"); if (is64Bit) { try { final Class<?> beanClazz = Class.forName(HOTSPOT_BEAN_CLASS); final Object hotSpotBean = Class.forName(MANAGEMENT_FACTORY_CLASS).getMethod("getPlatformMXBean", Class.class) .invoke(null, beanClazz); if (hotSpotBean != null) { compressedOOPSEnabled_is64bitHotSpot = true; final Method getVMOptionMethod = beanClazz.getMethod("getVMOption", String.class); try { final Object vmOption = getVMOptionMethod.invoke(hotSpotBean, "UseCompressedOops"); compressedOOPSEnabled_compressedOOPS = Boolean.parseBoolean(vmOption.getClass().getMethod("getValue").invoke(vmOption).toString()); } catch (ReflectiveOperationException | RuntimeException e) { compressedOOPSEnabled_is64bitHotSpot = false; } } } catch (ReflectiveOperationException | RuntimeException e) { compressedOOPSEnabled_is64bitHotSpot = false; } } compressedOOPSEnabled_checked = true; ret compressedOOPSEnabled_compressedOOPS; }
Began life as a copy of #1011522
download show line numbers debug dex old transpilations
Travelled to 3 computer(s): bhatertpkbcr, mowyntqkapby, mqqgnosmbjvj
No comments. add comment
Snippet ID: | #1035194 |
Snippet name: | compressedOOPSEnabled (backup) |
Eternal ID of this version: | #1035194/1 |
Text MD5: | 69b9c52daab97075ae1e6a0e942b7a30 |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-04-11 19:47:07 |
Source code size: | 1720 bytes / 38 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 114 / 124 |
Referenced in: | [show references] |