--- old/src/hotspot/share/runtime/vmStructs.cpp 2017-09-26 23:43:30.135258806 +0900 +++ new/src/hotspot/share/runtime/vmStructs.cpp 2017-09-26 23:43:29.939256732 +0900 @@ -2726,8 +2726,12 @@ /* JVMCI */ \ /****************/ \ \ - declare_preprocessor_constant("INCLUDE_JVMCI", INCLUDE_JVMCI) - + declare_preprocessor_constant("INCLUDE_JVMCI", INCLUDE_JVMCI) \ + \ + /****************/ \ + /* VMRegImpl */ \ + /****************/ \ + declare_constant(VMRegImpl::stack_slot_size) //-------------------------------------------------------------------------------- // VM_LONG_CONSTANTS --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/VMRegImpl.java 2017-09-26 23:43:30.724265036 +0900 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/code/VMRegImpl.java 2017-09-26 23:43:30.510262772 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -37,6 +37,7 @@ private static int stack0Val; private static Address stack0Addr; private static AddressField regNameField; + private static int stackSlotSize; static { VM.registerVMInitializedObserver(new Observer() { @@ -53,6 +54,7 @@ stack0Val = (int) stack0Addr.hashCode(); stack0 = new VMReg(stack0Val); regNameField = type.getAddressField("regName[0]"); + stackSlotSize = db.lookupIntConstant("VMRegImpl::stack_slot_size"); } public static VMReg getStack0() { @@ -67,4 +69,8 @@ long addrSize = VM.getVM().getAddressSize(); return CStringUtilities.getString(regName.getAddressAt(index * addrSize)); } + + public static int getStackSlotSize() { + return stackSlotSize; + } } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Frame.java 2017-09-26 23:43:31.250270599 +0900 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Frame.java 2017-09-26 23:43:31.052268505 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -430,7 +430,7 @@ // If it is passed in a register, it got spilled in the stub frame. return regMap.getLocation(reg); } else { - long spOffset = VM.getVM().getAddressSize() * reg.minus(stack0); + long spOffset = reg.reg2Stack() * VM.getVM().getVMRegImplInfo().getStackSlotSize(); return getUnextendedSP().addOffsetTo(spOffset); } } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMReg.java 2017-09-26 23:43:31.750275888 +0900 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VMReg.java 2017-09-26 23:43:31.557273847 +0900 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -84,4 +84,8 @@ public boolean greaterThanOrEqual(VMReg arg) { return value >= arg.value; } public int minus(VMReg arg) { return value - arg.value; } + + public int reg2Stack() { + return value - VM.getVM().getVMRegImplInfo().getStack0().getValue(); + } }