--- old/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp 2017-10-24 11:20:59.749439001 +0530 +++ new/src/hotspot/share/gc/cms/compactibleFreeListSpace.cpp 2017-10-24 11:20:59.513439001 +0530 @@ -57,6 +57,7 @@ // Defaults are 0 so things will break badly if incorrectly initialized. size_t CompactibleFreeListSpace::IndexSetStart = 0; size_t CompactibleFreeListSpace::IndexSetStride = 0; +size_t CompactibleFreeListSpace::_min_chunk_size_in_bytes = 0; size_t MinChunkSize = 0; @@ -66,8 +67,8 @@ // MinChunkSize should be a multiple of MinObjAlignment and be large enough // for chunks to contain a FreeChunk. - size_t min_chunk_size_in_bytes = align_up(sizeof(FreeChunk), MinObjAlignmentInBytes); - MinChunkSize = min_chunk_size_in_bytes / BytesPerWord; + _min_chunk_size_in_bytes = align_up(sizeof(FreeChunk), MinObjAlignmentInBytes); + MinChunkSize = _min_chunk_size_in_bytes / BytesPerWord; assert(IndexSetStart == 0 && IndexSetStride == 0, "already set"); IndexSetStart = MinChunkSize; --- old/src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp 2017-10-24 11:21:00.421439001 +0530 +++ new/src/hotspot/share/gc/cms/compactibleFreeListSpace.hpp 2017-10-24 11:21:00.137439001 +0530 @@ -118,6 +118,7 @@ }; static size_t IndexSetStart; static size_t IndexSetStride; + static size_t _min_chunk_size_in_bytes; private: enum FitStrategyOptions { @@ -134,6 +135,7 @@ // A lock protecting the free lists and free blocks; // mutable because of ubiquity of locking even for otherwise const methods mutable Mutex _freelistLock; + // Locking verifier convenience function void assert_locked() const PRODUCT_RETURN; void assert_locked(const Mutex* lock) const PRODUCT_RETURN; --- old/src/hotspot/share/gc/cms/vmStructs_cms.hpp 2017-10-24 11:21:01.157439001 +0530 +++ new/src/hotspot/share/gc/cms/vmStructs_cms.hpp 2017-10-24 11:21:00.865439001 +0530 @@ -30,7 +30,8 @@ static_field) \ nonstatic_field(CompactibleFreeListSpace, _collector, CMSCollector*) \ nonstatic_field(CompactibleFreeListSpace, _bt, BlockOffsetArrayNonContigSpace) \ - \ + static_field(CompactibleFreeListSpace, _min_chunk_size_in_bytes, size_t) \ + nonstatic_field(CMSBitMap, _bmStartWord, HeapWord*) \ nonstatic_field(CMSBitMap, _bmWordSize, size_t) \ nonstatic_field(CMSBitMap, _shifter, const int) \ nonstatic_field(CMSBitMap, _bm, BitMapView) \ @@ -63,6 +64,7 @@ declare_toplevel_type(LinearAllocBlock) #define VM_INT_CONSTANTS_CMS(declare_constant) \ + declare_constant(CompactibleFreeListSpace::IndexSetSize) \ declare_constant(Generation::ConcurrentMarkSweep) \ #endif // SHARE_VM_GC_CMS_VMSTRUCTS_CMS_HPP --- old/src/hotspot/share/runtime/stackValue.cpp 2017-10-24 11:21:01.885439001 +0530 +++ new/src/hotspot/share/runtime/stackValue.cpp 2017-10-24 11:21:01.617439001 +0530 @@ -191,12 +191,12 @@ void StackValue::print_on(outputStream* st) const { switch(_type) { case T_INT: - st->print("%d (int) %f (float) %x (hex)", *(int *)&_i, *(float *)&_i, *(int *)&_i); + st->print("%d (int) %f (float) %x (hex)", *(int *)&_integer_value, *(float *)&_integer_value, *(int *)&_integer_value); break; case T_OBJECT: - _o()->print_value_on(st); - st->print(" <" INTPTR_FORMAT ">", p2i((address)_o())); + _handle_value()->print_value_on(st); + st->print(" <" INTPTR_FORMAT ">", p2i((address)_handle_value())); break; case T_CONFLICT: --- old/src/hotspot/share/runtime/stackValue.hpp 2017-10-24 11:21:02.741439001 +0530 +++ new/src/hotspot/share/runtime/stackValue.hpp 2017-10-24 11:21:02.425439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 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 @@ -31,63 +31,63 @@ class StackValue : public ResourceObj { private: BasicType _type; - intptr_t _i; // Blank java stack slot value - Handle _o; // Java stack slot value interpreted as a Handle + intptr_t _integer_value; // Blank java stack slot value + Handle _handle_value; // Java stack slot value interpreted as a Handle public: StackValue(intptr_t value) { - _type = T_INT; - _i = value; + _type = T_INT; + _integer_value = value; } StackValue(Handle value, intptr_t scalar_replaced = 0) { - _type = T_OBJECT; - _i = scalar_replaced; - _o = value; - assert(_i == 0 || _o.is_null(), "not null object should not be marked as scalar replaced"); + _type = T_OBJECT; + _integer_value = scalar_replaced; + _handle_value = value; + assert(_integer_value == 0 || _handle_value.is_null(), "not null object should not be marked as scalar replaced"); } StackValue() { - _type = T_CONFLICT; - _i = 0; + _type = T_CONFLICT; + _integer_value = 0; } // Only used during deopt- preserve object type. StackValue(intptr_t o, BasicType t) { assert(t == T_OBJECT, "should not be used"); - _type = t; - _i = o; + _type = t; + _integer_value = o; } Handle get_obj() const { assert(type() == T_OBJECT, "type check"); - return _o; + return _handle_value; } bool obj_is_scalar_replaced() const { assert(type() == T_OBJECT, "type check"); - return _i != 0; + return _integer_value != 0; } void set_obj(Handle value) { assert(type() == T_OBJECT, "type check"); - _o = value; + _handle_value = value; } intptr_t get_int() const { assert(type() == T_INT, "type check"); - return _i; + return _integer_value; } // For special case in deopt. intptr_t get_int(BasicType t) const { assert(t == T_OBJECT && type() == T_OBJECT, "type check"); - return _i; + return _integer_value; } void set_int(intptr_t value) { assert(type() == T_INT, "type check"); - _i = value; + _integer_value = value; } BasicType type() const { return _type; } @@ -95,11 +95,11 @@ bool equal(StackValue *value) { if (_type != value->_type) return false; if (_type == T_OBJECT) - return (_o == value->_o); + return (_handle_value == value->_handle_value); else { assert(_type == T_INT, "sanity check"); // [phh] compare only low addressed portions of intptr_t slots - return (*(int *)&_i == *(int *)&value->_i); + return (*(int *)&_integer_value == *(int *)&value->_integer_value); } } --- old/src/hotspot/share/runtime/vmStructs.cpp 2017-10-24 11:21:03.493439001 +0530 +++ new/src/hotspot/share/runtime/vmStructs.cpp 2017-10-24 11:21:03.185439001 +0530 @@ -2173,6 +2173,7 @@ declare_toplevel_type(vframeArray) \ declare_toplevel_type(vframeArrayElement) \ declare_toplevel_type(Annotations*) \ + declare_type(OopMapValue, StackObj) \ \ /***************/ \ /* Miscellaneous types */ \ --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/compiler/ImmutableOopMapPair.java 2017-10-24 11:21:04.297439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/compiler/ImmutableOopMapPair.java 2017-10-24 11:21:04.009439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 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 @@ -34,8 +34,8 @@ import java.util.Observer; public class ImmutableOopMapPair { - private static CIntegerField pcField; - private static CIntegerField offsetField; + private static CIntegerField pcOffsetField; + private static CIntegerField oopmapOffsetField; private static long classSize; static { @@ -57,18 +57,18 @@ } public int getPC() { - return (int) pcField.getValue(address); + return (int) pcOffsetField.getValue(address); } public int getOffset() { - return (int) offsetField.getValue(address); + return (int) oopmapOffsetField.getValue(address); } private static void initialize(TypeDataBase db) { Type type = db.lookupType("ImmutableOopMapPair"); - pcField = type.getCIntegerField("_pc_offset"); - offsetField = type.getCIntegerField("_oopmap_offset"); + pcOffsetField = type.getCIntegerField("_pc_offset"); + oopmapOffsetField = type.getCIntegerField("_oopmap_offset"); classSize = type.getSize(); } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java 2017-10-24 11:21:05.025439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/gc/cms/CompactibleFreeListSpace.java 2017-10-24 11:21:04.761439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 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 @@ -41,10 +41,11 @@ private static AddressField dictionaryField; private static long smallLinearAllocBlockFieldOffset; - private int heapWordSize; // 4 for 32bit, 8 for 64 bits - private int IndexSetStart; // for small indexed list - private int IndexSetSize; - private int IndexSetStride; + private int heapWordSize; // 4 for 32bit, 8 for 64 bits + private int IndexSetStart; // for small indexed list + private int IndexSetSize; + private int IndexSetStride; + private static long MinChunkSizeInBytes; static { VM.registerVMInitializedObserver(new Observer() { @@ -57,8 +58,6 @@ private static synchronized void initialize(TypeDataBase db) { long sizeofFreeChunk = db.lookupType("FreeChunk").getSize(); VM vm = VM.getVM(); - MinChunkSizeInBytes = numQuanta(sizeofFreeChunk, vm.getMinObjAlignmentInBytes()) * - vm.getMinObjAlignmentInBytes(); Type type = db.lookupType("CompactibleFreeListSpace"); collectorField = type.getAddressField("_collector"); @@ -66,6 +65,7 @@ dictionaryField = type.getAddressField("_dictionary"); indexedFreeListField = type.getAddressField("_indexedFreeList[0]"); smallLinearAllocBlockFieldOffset = type.getField("_smallLinearAllocBlock").getOffset(); + MinChunkSizeInBytes = (type.getCIntegerField("_min_chunk_size_in_bytes")).getValue(); } public CompactibleFreeListSpace(Address addr) { @@ -74,7 +74,7 @@ heapWordSize = vm.getHeapWordSize(); IndexSetStart = vm.getMinObjAlignmentInBytes() / heapWordSize; IndexSetStride = IndexSetStart; - IndexSetSize = 257; + IndexSetSize = vm.getIndexSetSize(); } // Accessing block offset table @@ -201,14 +201,8 @@ // Unlike corresponding VM code, we operate on byte size rather than // HeapWord size for convenience. - private static long numQuanta(long x, long y) { - return ((x+y-1)/y); - } - public static long adjustObjectSizeInBytes(long sizeInBytes) { return Oop.alignObjectSize(Math.max(sizeInBytes, MinChunkSizeInBytes)); } - // FIXME: should I read this directly from VM? - private static long MinChunkSizeInBytes; } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Arguments.java 2017-10-24 11:21:05.685439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/Arguments.java 2017-10-24 11:21:05.441439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 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 @@ -42,11 +42,11 @@ } public static String getJVMFlags() { - return buildString(jvmFlagsField, jvmFlagsCount); + return buildString(jvmFlagsArrayField, numJvmFlags); } public static String getJVMArgs() { - return buildString(jvmArgsField, jvmArgsCount); + return buildString(jvmArgsArrayField, numJvmArgs); } public static String getJavaCommand() { @@ -56,20 +56,20 @@ // Internals only below this point // Fields - private static AddressField jvmFlagsField; - private static AddressField jvmArgsField; + private static AddressField jvmFlagsArrayField; + private static AddressField jvmArgsArrayField; private static AddressField javaCommandField; - private static long jvmFlagsCount; - private static long jvmArgsCount; + private static long numJvmFlags; + private static long numJvmArgs; private static synchronized void initialize(TypeDataBase db) { Type argumentsType = db.lookupType("Arguments"); - jvmFlagsField = argumentsType.getAddressField("_jvm_flags_array"); - jvmArgsField = argumentsType.getAddressField("_jvm_args_array"); + jvmFlagsArrayField = argumentsType.getAddressField("_jvm_flags_array"); + jvmArgsArrayField = argumentsType.getAddressField("_jvm_args_array"); javaCommandField = argumentsType.getAddressField("_java_command"); - jvmArgsCount = argumentsType.getCIntegerField("_num_jvm_args").getValue(); - jvmFlagsCount = argumentsType.getCIntegerField("_num_jvm_flags").getValue(); + numJvmArgs = argumentsType.getCIntegerField("_num_jvm_args").getValue(); + numJvmFlags = argumentsType.getCIntegerField("_num_jvm_flags").getValue(); } private static String buildString(AddressField arrayField, long count) { --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CompilerThread.java 2017-10-24 11:21:06.321439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/CompilerThread.java 2017-10-24 11:21:06.073439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2011, 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 @@ -39,19 +39,19 @@ }); } - private static AddressField _env_field; + private static AddressField envField; private static synchronized void initialize(TypeDataBase db) throws WrongTypeException { Type type = db.lookupType("CompilerThread"); - _env_field = type.getAddressField("_env"); + envField = type.getAddressField("_env"); } private ciEnv _env; public synchronized ciEnv env() { if (_env == null) { - Address v = _env_field.getValue(this.getAddress()); + Address v = envField.getValue(this.getAddress()); if (v != null) { _env = new ciEnv(v); } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java 2017-10-24 11:21:06.977439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/VM.java 2017-10-24 11:21:06.733439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2016, 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 @@ -105,6 +105,7 @@ private int heapOopSize; private int klassPtrSize; private int oopSize; + private final int IndexSetSize; /** This is only present in a non-core build */ private CodeCache codeCache; /** This is only present in a C1 build */ @@ -376,6 +377,7 @@ bytesPerWord = db.lookupIntConstant("BytesPerWord").intValue(); heapWordSize = db.lookupIntConstant("HeapWordSize").intValue(); oopSize = db.lookupIntConstant("oopSize").intValue(); + IndexSetSize = db.lookupIntConstant("CompactibleFreeListSpace::IndexSetSize").intValue(); intType = db.lookupType("int"); uintType = db.lookupType("uint"); @@ -594,6 +596,10 @@ return heapOopSize; } + public int getIndexSetSize() { + return IndexSetSize; + } + public int getKlassPtrSize() { return klassPtrSize; } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java 2017-10-24 11:21:07.641439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_amd64/Win32AMD64JavaThreadPDAccess.java 2017-10-24 11:21:07.405439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 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 @@ -43,7 +43,7 @@ private static AddressField osThreadField; // Field from OSThread - private static Field osThreadThreadIdField; + private static Field threadIdField; // This is currently unneeded but is being kept in case we change // the currentFrameGuess algorithm @@ -64,7 +64,7 @@ osThreadField = type.getAddressField("_osthread"); type = db.lookupType("OSThread"); - osThreadThreadIdField = type.getField("_thread_id"); + threadIdField = type.getField("_thread_id"); } public Address getLastJavaFP(Address addr) { @@ -130,7 +130,7 @@ Address osThreadAddr = osThreadField.getValue(addr); // Get the address of the thread_id within the OSThread Address threadIdAddr = - osThreadAddr.addOffsetTo(osThreadThreadIdField.getOffset()); + osThreadAddr.addOffsetTo(threadIdField.getOffset()); JVMDebugger debugger = VM.getVM().getDebugger(); return debugger.getThreadForIdentifierAddress(threadIdAddr); } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java 2017-10-24 11:21:08.221439001 +0530 +++ new/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/win32_x86/Win32X86JavaThreadPDAccess.java 2017-10-24 11:21:07.989439001 +0530 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2013, 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 @@ -42,7 +42,7 @@ private static AddressField osThreadField; // Field from OSThread - private static Field osThreadThreadIdField; + private static Field threadIdField; // This is currently unneeded but is being kept in case we change // the currentFrameGuess algorithm @@ -63,7 +63,7 @@ osThreadField = type.getAddressField("_osthread"); type = db.lookupType("OSThread"); - osThreadThreadIdField = type.getField("_thread_id"); + threadIdField = type.getField("_thread_id"); } public Address getLastJavaFP(Address addr) { @@ -129,7 +129,7 @@ Address osThreadAddr = osThreadField.getValue(addr); // Get the address of the thread_id within the OSThread Address threadIdAddr = - osThreadAddr.addOffsetTo(osThreadThreadIdField.getOffset()); + osThreadAddr.addOffsetTo(threadIdField.getOffset()); JVMDebugger debugger = VM.getVM().getDebugger(); return debugger.getThreadForIdentifierAddress(threadIdAddr); } --- old/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime/JNIid.java 2017-10-24 11:21:08.805439001 +0530 +++ /dev/null 2017-10-23 11:49:42.897331000 +0530 @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2002, 2012, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -package sun.jvm.hotspot.runtime; - -import java.util.*; - -import sun.jvm.hotspot.debugger.*; -import sun.jvm.hotspot.oops.*; -import sun.jvm.hotspot.types.*; - -public class JNIid extends VMObject { - private static MetadataField holder; - private static AddressField next; - private static CIntegerField offset; - private static MetadataField resolvedMethod; - private static MetadataField resolvedReceiver; - - private ObjectHeap heap; - - static { - VM.registerVMInitializedObserver(new Observer() { - public void update(Observable o, Object data) { - initialize(VM.getVM().getTypeDataBase()); - } - }); - } - - private static synchronized void initialize(TypeDataBase db) { - - // FIXME: JNIid has been removed as part of redesign of JNI method, - // field ID generation. Please refer to src/share/vm/prims/jniId.hpp/.cpp - // For now, commenting out the below code. - - /*********************************************************** - Type type = db.lookupType("JNIid"); - - holder = type.getOopField("_holder"); - next = type.getAddressField("_next"); - offset = type.getCIntegerField("_offset"); - resolvedMethod = type.getOopField("_resolved_method"); - resolvedReceiver = type.getOopField("_resolved_receiver"); - ***********************************************************/ - } - - public JNIid(Address addr, ObjectHeap heap) { - super(addr); - this.heap = heap; - } - - public JNIid next() { - Address nextAddr = next.getValue(addr); - if (nextAddr == null) { - return null; - } - return new JNIid(nextAddr, heap); - } - - public Klass holder() { return (Klass) holder.getValue(addr); } - public int offset() { return (int) offset.getValue(addr); } - public Method method() { - return ((InstanceKlass) holder()).getMethods().at(offset()); - } - public Method resolvedMethod() { return (Method)resolvedMethod.getValue(addr); } - public Klass resolvedReceiver() { return (Klass) resolvedReceiver.getValue(addr); } -}