OpenJDK / jdk-updates / jdk12u
changeset 53439:049140127bc8
Merge
author | robm |
---|---|
date | Mon, 18 Feb 2019 08:31:32 -0800 |
parents | e0086f0b4e52 43149dd3b76d |
children | 8de385e12c61 |
files | |
diffstat | 48 files changed, 554 insertions(+), 180 deletions(-) [+] |
line wrap: on
line diff
--- a/make/hotspot/symbols/symbols-unix Mon Feb 18 07:45:57 2019 -0800 +++ b/make/hotspot/symbols/symbols-unix Mon Feb 18 08:31:32 2019 -0800 @@ -81,7 +81,6 @@ JVM_GetClassInterfaces JVM_GetClassMethodsCount JVM_GetClassModifiers -JVM_GetClassName JVM_GetClassNameUTF JVM_GetClassSignature JVM_GetClassSigners @@ -133,6 +132,7 @@ JVM_HasReferencePendingList JVM_HoldsLock JVM_IHashCode +JVM_InitClassName JVM_InitStackTraceElement JVM_InitStackTraceElementArray JVM_InitializeFromArchive
--- a/src/hotspot/share/classfile/javaClasses.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/classfile/javaClasses.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1344,6 +1344,26 @@ java_class->obj_field_put(_module_offset, module); } +oop java_lang_Class::name(Handle java_class, TRAPS) { + assert(_name_offset != 0, "must be set"); + oop o = java_class->obj_field(_name_offset); + if (o == NULL) { + o = StringTable::intern(java_lang_Class::as_external_name(java_class()), THREAD); + java_class->obj_field_put(_name_offset, o); + } + return o; +} + +oop java_lang_Class::source_file(oop java_class) { + assert(_source_file_offset != 0, "must be set"); + return java_class->obj_field(_source_file_offset); +} + +void java_lang_Class::set_source_file(oop java_class, oop source_file) { + assert(_source_file_offset != 0, "must be set"); + java_class->obj_field_put(_source_file_offset, source_file); +} + oop java_lang_Class::create_basic_type_mirror(const char* basic_type_name, BasicType type, TRAPS) { // This should be improved by adding a field at the Java level or by // introducing a new VM klass (see comment in ClassFileParser) @@ -1521,7 +1541,8 @@ macro(classRedefinedCount_offset, k, "classRedefinedCount", int_signature, false) ; \ macro(_class_loader_offset, k, "classLoader", classloader_signature, false); \ macro(_component_mirror_offset, k, "componentType", class_signature, false); \ - macro(_module_offset, k, "module", module_signature, false) + macro(_module_offset, k, "module", module_signature, false); \ + macro(_name_offset, k, "name", string_signature, false); \ void java_lang_Class::compute_offsets() { if (offsets_computed) { @@ -2567,12 +2588,14 @@ int version, int bci, Symbol* name, TRAPS) { assert(element->is_a(SystemDictionary::StackTraceElement_klass()), "sanity check"); + ResourceMark rm(THREAD); + HandleMark hm(THREAD); + // Fill in class name - ResourceMark rm(THREAD); - const char* str = holder->external_name(); - oop classname = StringTable::intern(str, CHECK); + Handle java_class(THREAD, holder->java_mirror()); + oop classname = java_lang_Class::name(java_class, CHECK); java_lang_StackTraceElement::set_declaringClass(element(), classname); - java_lang_StackTraceElement::set_declaringClassObject(element(), holder->java_mirror()); + java_lang_StackTraceElement::set_declaringClassObject(element(), java_class()); oop loader = holder->class_loader(); if (loader != NULL) { @@ -2606,10 +2629,26 @@ } else { // Fill in source file name and line number. Symbol* source = Backtrace::get_source_file_name(holder, version); - if (ShowHiddenFrames && source == NULL) - source = vmSymbols::unknown_class_name(); - oop filename = StringTable::intern(source, CHECK); - java_lang_StackTraceElement::set_fileName(element(), filename); + oop source_file = java_lang_Class::source_file(java_class()); + if (source != NULL) { + // Class was not redefined. We can trust its cache if set, + // else we have to initialize it. + if (source_file == NULL) { + source_file = StringTable::intern(source, CHECK); + java_lang_Class::set_source_file(java_class(), source_file); + } + } else { + // Class was redefined. Dump the cache if it was set. + if (source_file != NULL) { + source_file = NULL; + java_lang_Class::set_source_file(java_class(), source_file); + } + if (ShowHiddenFrames) { + source = vmSymbols::unknown_class_name(); + source_file = StringTable::intern(source, CHECK); + } + } + java_lang_StackTraceElement::set_fileName(element(), source_file); int line_number = Backtrace::get_line_number(method, bci); java_lang_StackTraceElement::set_lineNumber(element(), line_number); @@ -3980,6 +4019,8 @@ int java_lang_Class::_component_mirror_offset; int java_lang_Class::_init_lock_offset; int java_lang_Class::_signers_offset; +int java_lang_Class::_name_offset; +int java_lang_Class::_source_file_offset; GrowableArray<Klass*>* java_lang_Class::_fixup_mirror_list = NULL; GrowableArray<Klass*>* java_lang_Class::_fixup_module_field_list = NULL; int java_lang_Throwable::backtrace_offset;
--- a/src/hotspot/share/classfile/javaClasses.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/classfile/javaClasses.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -219,7 +219,8 @@ macro(java_lang_Class, oop_size, int_signature, false) \ macro(java_lang_Class, static_oop_field_count, int_signature, false) \ macro(java_lang_Class, protection_domain, object_signature, false) \ - macro(java_lang_Class, signers, object_signature, false) + macro(java_lang_Class, signers, object_signature, false) \ + macro(java_lang_Class, source_file, object_signature, false) \ class java_lang_Class : AllStatic { friend class VMStructs; @@ -240,6 +241,8 @@ static int _class_loader_offset; static int _module_offset; static int _component_mirror_offset; + static int _name_offset; + static int _source_file_offset; static bool offsets_computed; static int classRedefinedCount_offset; @@ -310,6 +313,11 @@ static void set_module(oop java_class, oop module); static oop module(oop java_class); + static oop name(Handle java_class, TRAPS); + + static oop source_file(oop java_class); + static void set_source_file(oop java_class, oop source_file); + static int oop_size(oop java_class); static int oop_size_raw(oop java_class); static void set_oop_size(HeapWord* java_class, int size);
--- a/src/hotspot/share/classfile/vmSymbols.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/classfile/vmSymbols.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -425,6 +425,7 @@ template(static_oop_field_count_name, "static_oop_field_count") \ template(protection_domain_name, "protection_domain") \ template(signers_name, "signers_name") \ + template(source_file_name, "source_file") \ template(loader_data_name, "loader_data") \ template(vmdependencies_name, "vmdependencies") \ template(last_cleanup_name, "last_cleanup") \
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -161,12 +161,8 @@ { size_t last = _last_heap_print; if ((used - last >= _step_heap_print) && Atomic::cmpxchg(used, &_last_heap_print, last) == last) { - log_info(gc)("Heap: " SIZE_FORMAT "M reserved, " SIZE_FORMAT "M (%.2f%%) committed, " SIZE_FORMAT "M (%.2f%%) used", - max_capacity() / M, - capacity() / M, - capacity() * 100.0 / max_capacity(), - used / M, - used * 100.0 / max_capacity()); + print_heap_info(used); + print_metaspace_info(); } } @@ -268,13 +264,26 @@ } void EpsilonHeap::collect(GCCause::Cause cause) { - log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause)); + switch (cause) { + case GCCause::_metadata_GC_threshold: + case GCCause::_metadata_GC_clear_soft_refs: + // Receiving these causes means the VM itself entered the safepoint for metadata collection. + // While Epsilon does not do GC, it has to perform sizing adjustments, otherwise we would + // re-enter the safepoint again very soon. + + assert(SafepointSynchronize::is_at_safepoint(), "Expected at safepoint"); + log_info(gc)("GC request for \"%s\" is handled", GCCause::to_string(cause)); + MetaspaceGC::compute_new_size(); + print_metaspace_info(); + break; + default: + log_info(gc)("GC request for \"%s\" is ignored", GCCause::to_string(cause)); + } _monitoring_support->update_counters(); } void EpsilonHeap::do_full_collection(bool clear_all_soft_refs) { - log_info(gc)("Full GC request for \"%s\" is ignored", GCCause::to_string(gc_cause())); - _monitoring_support->update_counters(); + collect(gc_cause()); } void EpsilonHeap::safe_object_iterate(ObjectClosure *cl) { @@ -289,13 +298,46 @@ st->print_cr("Allocation space:"); _space->print_on(st); + + MetaspaceUtils::print_on(st); } void EpsilonHeap::print_tracing_info() const { - Log(gc) log; - size_t allocated_kb = used() / K; - log.info("Total allocated: " SIZE_FORMAT " KB", - allocated_kb); - log.info("Average allocation rate: " SIZE_FORMAT " KB/sec", - (size_t)(allocated_kb * NANOSECS_PER_SEC / os::elapsed_counter())); + print_heap_info(used()); + print_metaspace_info(); } + +void EpsilonHeap::print_heap_info(size_t used) const { + size_t reserved = max_capacity(); + size_t committed = capacity(); + + if (reserved != 0) { + log_info(gc)("Heap: " SIZE_FORMAT "%s reserved, " SIZE_FORMAT "%s (%.2f%%) committed, " + SIZE_FORMAT "%s (%.2f%%) used", + byte_size_in_proper_unit(reserved), proper_unit_for_byte_size(reserved), + byte_size_in_proper_unit(committed), proper_unit_for_byte_size(committed), + committed * 100.0 / reserved, + byte_size_in_proper_unit(used), proper_unit_for_byte_size(used), + used * 100.0 / reserved); + } else { + log_info(gc)("Heap: no reliable data"); + } +} + +void EpsilonHeap::print_metaspace_info() const { + size_t reserved = MetaspaceUtils::reserved_bytes(); + size_t committed = MetaspaceUtils::committed_bytes(); + size_t used = MetaspaceUtils::used_bytes(); + + if (reserved != 0) { + log_info(gc, metaspace)("Metaspace: " SIZE_FORMAT "%s reserved, " SIZE_FORMAT "%s (%.2f%%) committed, " + SIZE_FORMAT "%s (%.2f%%) used", + byte_size_in_proper_unit(reserved), proper_unit_for_byte_size(reserved), + byte_size_in_proper_unit(committed), proper_unit_for_byte_size(committed), + committed * 100.0 / reserved, + byte_size_in_proper_unit(used), proper_unit_for_byte_size(used), + used * 100.0 / reserved); + } else { + log_info(gc, metaspace)("Metaspace: no reliable data"); + } +}
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/epsilon/epsilonHeap.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -147,6 +147,10 @@ virtual void print_on(outputStream* st) const; virtual void print_tracing_info() const; +private: + void print_heap_info(size_t used) const; + void print_metaspace_info() const; + }; #endif // SHARE_VM_GC_EPSILON_COLLECTEDHEAP_HPP
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahBarrierSetC2.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -22,9 +22,11 @@ */ #include "precompiled.hpp" +#include "gc/shared/barrierSet.hpp" #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahRuntime.hpp" +#include "gc/shenandoah/shenandoahThreadLocalData.hpp" #include "gc/shenandoah/c2/shenandoahBarrierSetC2.hpp" #include "gc/shenandoah/c2/shenandoahSupport.hpp" #include "opto/arraycopynode.hpp"
--- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -30,6 +30,7 @@ #include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahRuntime.hpp" +#include "gc/shenandoah/shenandoahThreadLocalData.hpp" #include "opto/arraycopynode.hpp" #include "opto/block.hpp" #include "opto/callnode.hpp"
--- a/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/heuristics/shenandoahTraversalHeuristics.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -24,7 +24,9 @@ #include "precompiled.hpp" #include "gc/shenandoah/heuristics/shenandoahTraversalHeuristics.hpp" +#include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" +#include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" #include "logging/log.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahArguments.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2018, 2019, Red Hat, Inc. 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 @@ -27,7 +27,7 @@ #include "gc/shared/workerPolicy.hpp" #include "gc/shenandoah/shenandoahArguments.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" +#include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahTaskqueue.hpp" #include "utilities/defaultStream.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -25,7 +25,6 @@ #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahBrooksPointer.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "code/codeCache.hpp" #include "code/nmethod.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahCodeRoots.hpp" #include "memory/resourceArea.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahCodeRoots.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -77,8 +77,8 @@ bool has_cset_oops(ShenandoahHeap* heap); - void assert_alive_and_correct() PRODUCT_RETURN; - void assert_same_oops(GrowableArray<oop*>* oops) PRODUCT_RETURN; + void assert_alive_and_correct() NOT_DEBUG_RETURN; + void assert_same_oops(GrowableArray<oop*>* oops) NOT_DEBUG_RETURN; static bool find_with_nmethod(void* nm, ShenandoahNMethod* other) { return other->_nm == nm;
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -27,7 +27,6 @@ #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" -#include "gc/shared/weakProcessor.hpp" #include "gc/shared/weakProcessor.inline.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/referenceProcessor.hpp" @@ -38,9 +37,7 @@ #include "gc/shenandoah/shenandoahMarkCompact.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" -#include "gc/shenandoah/shenandoahOopClosures.hpp" #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" -#include "gc/shenandoah/shenandoahTaskqueue.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahUtils.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.inline.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2015, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -29,7 +29,7 @@ #include "gc/shenandoah/shenandoahBarrierSet.inline.hpp" #include "gc/shenandoah/shenandoahConcurrentMark.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" -#include "gc/shenandoah/shenandoahStringDedup.hpp" +#include "gc/shenandoah/shenandoahStringDedup.inline.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "memory/iterator.inline.hpp" #include "oops/oop.inline.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahControlThread.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -47,7 +47,7 @@ _degen_point(ShenandoahHeap::_degenerated_outside_cycle), _allocs_seen(0) { - create_and_start(); + create_and_start(ShenandoahCriticalControlThreadPriority ? CriticalPriority : NearMaxPriority); _periodic_task.enroll(); _periodic_satb_flush_task.enroll(); } @@ -377,19 +377,19 @@ // Complete marking under STW, and start evacuation heap->vmop_entry_final_mark(); + // Final mark might have reclaimed some immediate garbage, kick cleanup to reclaim + // the space. This would be the last action if there is nothing to evacuate. + heap->entry_cleanup(); + + { + ShenandoahHeapLocker locker(heap->lock()); + heap->free_set()->log_status(); + } + // Continue the cycle with evacuation and optional update-refs. // This may be skipped if there is nothing to evacuate. // If so, evac_in_progress would be unset by collection set preparation code. if (heap->is_evacuation_in_progress()) { - // Final mark had reclaimed some immediate garbage, kick cleanup to reclaim the space - // for the rest of the cycle, and report current state of free set. - heap->entry_cleanup(); - - { - ShenandoahHeapLocker locker(heap->lock()); - heap->free_set()->log_status(); - } - // Concurrently evacuate heap->entry_evac(); if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_evac)) return; @@ -403,14 +403,15 @@ if (check_cancellation_or_degen(ShenandoahHeap::_degenerated_updaterefs)) return; heap->vmop_entry_final_updaterefs(); + + // Update references freed up collection set, kick the cleanup to reclaim the space. + heap->entry_cleanup(); + } else { heap->vmop_entry_final_evac(); } } - // Reclaim space after cycle - heap->entry_cleanup(); - // Cycle is complete heap->heuristics()->record_success_concurrent(); heap->shenandoah_policy()->record_success_concurrent();
--- a/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahFreeSet.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -42,9 +42,9 @@ size_t _capacity; size_t _used; - void assert_bounds() const PRODUCT_RETURN; - void assert_heaplock_owned_by_current_thread() const PRODUCT_RETURN; - void assert_heaplock_not_owned_by_current_thread() const PRODUCT_RETURN; + void assert_bounds() const NOT_DEBUG_RETURN; + void assert_heaplock_owned_by_current_thread() const NOT_DEBUG_RETURN; + void assert_heaplock_not_owned_by_current_thread() const NOT_DEBUG_RETURN; bool is_mutator_free(size_t idx) const; bool is_collector_free(size_t idx) const;
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -35,7 +35,6 @@ #include "gc/shenandoah/shenandoahBrooksPointer.hpp" #include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" -#include "gc/shenandoah/shenandoahConcurrentMark.hpp" #include "gc/shenandoah/shenandoahConcurrentMark.inline.hpp" #include "gc/shenandoah/shenandoahControlThread.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" @@ -49,7 +48,6 @@ #include "gc/shenandoah/shenandoahMetrics.hpp" #include "gc/shenandoah/shenandoahMonitoringSupport.hpp" #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" -#include "gc/shenandoah/shenandoahPacer.hpp" #include "gc/shenandoah/shenandoahPacer.inline.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" @@ -1930,13 +1928,6 @@ _workers->run_task(&unlink_task); } - if (ShenandoahStringDedup::is_enabled()) { - ShenandoahGCPhase phase(full_gc ? - ShenandoahPhaseTimings::full_gc_purge_string_dedup : - ShenandoahPhaseTimings::purge_string_dedup); - ShenandoahStringDedup::parallel_cleanup(); - } - { ShenandoahGCPhase phase(full_gc ? ShenandoahPhaseTimings::full_gc_purge_cldg :
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -163,9 +163,9 @@ return &_lock; } - void assert_heaplock_owned_by_current_thread() PRODUCT_RETURN; - void assert_heaplock_not_owned_by_current_thread() PRODUCT_RETURN; - void assert_heaplock_or_safepoint() PRODUCT_RETURN; + void assert_heaplock_owned_by_current_thread() NOT_DEBUG_RETURN; + void assert_heaplock_not_owned_by_current_thread() NOT_DEBUG_RETURN; + void assert_heaplock_or_safepoint() NOT_DEBUG_RETURN; // ---------- Initialization, termination, identification, printing routines // @@ -231,7 +231,7 @@ public: uint max_workers(); - void assert_gc_workers(uint nworker) PRODUCT_RETURN; + void assert_gc_workers(uint nworker) NOT_DEBUG_RETURN; WorkGang* workers() const; WorkGang* get_safepoint_workers();
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegion.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -25,7 +25,6 @@ #include "memory/allocation.hpp" #include "gc/shenandoah/shenandoahBrooksPointer.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeapRegionSet.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -22,9 +22,7 @@ */ #include "precompiled.hpp" -#include "gc/shenandoah/shenandoahHeapRegionSet.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahUtils.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkCompact.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2014, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -32,13 +32,11 @@ #include "gc/shenandoah/shenandoahPhaseTimings.hpp" #include "gc/shenandoah/shenandoahMarkCompact.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp" -#include "gc/shenandoah/shenandoahTaskqueue.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "gc/shenandoah/shenandoahVerifier.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahMetrics.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2013, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -23,7 +23,6 @@ #include "precompiled.hpp" #include "gc/shenandoah/shenandoahMetrics.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahHeapRegion.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahPacer.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahPacer.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahPhaseTimings.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -89,7 +89,6 @@ f(purge_class_unload, " Unload Classes") \ f(purge_par, " Parallel Cleanup") \ f(purge_cldg, " CLDG") \ - f(purge_string_dedup, " String Dedup") \ f(complete_liveness, " Complete Liveness") \ f(prepare_evac, " Prepare Evacuation") \ f(recycle_regions, " Recycle regions") \ @@ -255,7 +254,6 @@ f(full_gc_purge_class_unload, " Unload Classes") \ f(full_gc_purge_par, " Parallel Cleanup") \ f(full_gc_purge_cldg, " CLDG") \ - f(full_gc_purge_string_dedup, " String Dedup") \ f(full_gc_calculate_addresses, " Calculate Addresses") \ f(full_gc_calculate_addresses_regular, " Regular Objects") \ f(full_gc_calculate_addresses_humong, " Humongous Objects") \
--- a/src/hotspot/share/gc/shenandoah/shenandoahStrDedupQueue.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahStrDedupQueue.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -26,9 +26,8 @@ #include "gc/shared/stringdedup/stringDedup.hpp" #include "gc/shared/stringdedup/stringDedupThread.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" -#include "gc/shenandoah/shenandoahStrDedupQueue.hpp" #include "gc/shenandoah/shenandoahStrDedupQueue.inline.hpp" -#include "gc/shenandoah/shenandoahStringDedup.hpp" +#include "gc/shenandoah/shenandoahStringDedup.inline.hpp" #include "logging/log.hpp" #include "runtime/mutex.hpp" #include "runtime/mutexLocker.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -23,12 +23,9 @@ #include "precompiled.hpp" -#include "gc/shared/stringdedup/stringDedup.hpp" #include "gc/shared/stringdedup/stringDedup.inline.hpp" #include "gc/shared/workgroup.hpp" -#include "gc/shenandoah/shenandoahCollectionSet.hpp" #include "gc/shenandoah/shenandoahCollectionSet.inline.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" @@ -113,14 +110,6 @@ } }; -void ShenandoahStringDedup::parallel_cleanup() { - assert(SafepointSynchronize::is_at_safepoint(), "Must be at a safepoint"); - log_debug(gc, stringdedup)("String dedup cleanup"); - ShenandoahIsMarkedNextClosure cl; - - unlink_or_oops_do(&cl, NULL, true); -} - // // Task for parallel unlink_or_oops_do() operation on the deduplication queue // and table.
--- a/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -24,7 +24,6 @@ #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_HPP #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_HPP -#include "classfile/javaClasses.inline.hpp" #include "gc/shared/stringdedup/stringDedup.hpp" #include "memory/iterator.hpp" @@ -42,13 +41,7 @@ static void parallel_oops_do(OopClosure* cl, uint worker_id); static void oops_do_slow(OopClosure* cl); - // Parallel cleanup string dedup queues/table - static void parallel_cleanup(); - - static inline bool is_candidate(oop obj) { - return java_lang_String::is_instance_inlined(obj) && - java_lang_String::value(obj) != NULL; - } + static inline bool is_candidate(oop obj); private: static void unlink_or_oops_do(BoolObjectClosure* is_alive, OopClosure* keep_alive,
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/gc/shenandoah/shenandoahStringDedup.inline.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -0,0 +1,35 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * + * 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. + * + */ + +#ifndef SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP +#define SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP + +#include "classfile/javaClasses.inline.hpp" +#include "gc/shenandoah/shenandoahStringDedup.hpp" + +bool ShenandoahStringDedup::is_candidate(oop obj) { + return java_lang_String::is_instance_inlined(obj) && + java_lang_String::value(obj) != NULL; +} + +#endif // SHARE_GC_SHENANDOAH_SHENANDOAHSTRINGDEDUP_INLINE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2016, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -23,8 +23,8 @@ #include "precompiled.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" -#include "gc/shenandoah/shenandoahTaskqueue.hpp" +#include "gc/shenandoah/shenandoahHeap.inline.hpp" +#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2016, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -25,7 +25,6 @@ #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHTASKQUEUE_HPP #include "gc/shared/owstTaskTerminator.hpp" #include "gc/shared/taskqueue.hpp" -#include "gc/shared/taskqueue.inline.hpp" #include "memory/allocation.hpp" #include "runtime/mutex.hpp" #include "runtime/thread.hpp" @@ -46,11 +45,7 @@ // Attempt to pop from the queue. Returns true on success. inline bool pop(E &t); - inline void clear() { - _buf_empty = true; - taskqueue_t::set_empty(); - taskqueue_t::overflow_stack()->clear(); - } + inline void clear(); inline bool is_empty() const { return _buf_empty && taskqueue_t::is_empty();
--- a/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.inline.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahTaskqueue.inline.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2016, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -24,11 +24,12 @@ #ifndef SHARE_VM_GC_SHENANDOAH_SHENANDOAHTASKQUEUE_INLINE_HPP #define SHARE_VM_GC_SHENANDOAH_SHENANDOAHTASKQUEUE_INLINE_HPP +#include "gc/shared/taskqueue.inline.hpp" #include "gc/shenandoah/shenandoahTaskqueue.hpp" +#include "utilities/stack.inline.hpp" template <class E, MEMFLAGS F, unsigned int N> -bool BufferedOverflowTaskQueue<E, F, N>::pop(E &t) -{ +bool BufferedOverflowTaskQueue<E, F, N>::pop(E &t) { if (!_buf_empty) { t = _elem; _buf_empty = true; @@ -43,8 +44,7 @@ } template <class E, MEMFLAGS F, unsigned int N> -inline bool BufferedOverflowTaskQueue<E, F, N>::push(E t) -{ +inline bool BufferedOverflowTaskQueue<E, F, N>::push(E t) { if (_buf_empty) { _elem = t; _buf_empty = false; @@ -56,4 +56,12 @@ return true; } +template <class E, MEMFLAGS F, unsigned int N> +void BufferedOverflowTaskQueue<E, F, N>::clear() { + _buf_empty = true; + taskqueue_t::set_empty(); + taskqueue_t::overflow_stack()->clear(); +} + + #endif // SHARE_VM_GC_SHENANDOAH_SHENANDOAHTASKQUEUE_INLINE_HPP
--- a/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahTraversalGC.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2018, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -28,7 +28,6 @@ #include "gc/shared/referenceProcessor.hpp" #include "gc/shared/referenceProcessorPhaseTimes.hpp" #include "gc/shared/workgroup.hpp" -#include "gc/shared/weakProcessor.hpp" #include "gc/shared/weakProcessor.inline.hpp" #include "gc/shenandoah/shenandoahBarrierSet.hpp" #include "gc/shenandoah/shenandoahCodeRoots.hpp" @@ -36,16 +35,13 @@ #include "gc/shenandoah/shenandoahCollectorPolicy.hpp" #include "gc/shenandoah/shenandoahFreeSet.hpp" #include "gc/shenandoah/shenandoahPhaseTimings.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" -#include "gc/shenandoah/shenandoahHeapRegionSet.hpp" #include "gc/shenandoah/shenandoahHeapRegionSet.inline.hpp" #include "gc/shenandoah/shenandoahHeuristics.hpp" #include "gc/shenandoah/shenandoahMarkingContext.inline.hpp" #include "gc/shenandoah/shenandoahOopClosures.inline.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" #include "gc/shenandoah/shenandoahStringDedup.hpp" -#include "gc/shenandoah/shenandoahTaskqueue.hpp" #include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahTimingTracker.hpp" #include "gc/shenandoah/shenandoahTraversalGC.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2019, Red Hat, Inc. All rights reserved. * * 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 @@ -26,10 +26,9 @@ #include "gc/shenandoah/shenandoahAsserts.hpp" #include "gc/shenandoah/shenandoahBrooksPointer.hpp" #include "gc/shenandoah/shenandoahPhaseTimings.hpp" -#include "gc/shenandoah/shenandoahHeap.hpp" #include "gc/shenandoah/shenandoahHeap.inline.hpp" #include "gc/shenandoah/shenandoahRootProcessor.hpp" -#include "gc/shenandoah/shenandoahTaskqueue.hpp" +#include "gc/shenandoah/shenandoahTaskqueue.inline.hpp" #include "gc/shenandoah/shenandoahUtils.hpp" #include "gc/shenandoah/shenandoahVerifier.hpp" #include "memory/allocation.hpp"
--- a/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/shenandoah/shenandoah_globals.hpp Mon Feb 18 08:31:32 2019 -0800 @@ -185,6 +185,9 @@ "adjustment. Lower values make adjustments faster, at the " \ "expense of higher perf overhead. Time is in milliseconds.") \ \ + experimental(bool, ShenandoahCriticalControlThreadPriority, false, \ + "Shenandoah control thread runs at critical scheduling priority.")\ + \ diagnostic(bool, ShenandoahVerify, false, \ "Verify the Shenandoah garbage collector") \ \
--- a/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/z/c2/zBarrierSetC2.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -32,6 +32,7 @@ #include "opto/node.hpp" #include "opto/type.hpp" #include "utilities/macros.hpp" +#include "gc/z/zBarrierSet.hpp" #include "gc/z/c2/zBarrierSetC2.hpp" #include "gc/z/zThreadLocalData.hpp" #include "gc/z/zBarrierSetRuntime.hpp"
--- a/src/hotspot/share/gc/z/zTracer.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/gc/z/zTracer.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, 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 @@ -27,6 +27,7 @@ #include "gc/shared/gcId.hpp" #include "gc/shared/gcLocker.hpp" #include "jfr/jfrEvents.hpp" +#include "runtime/safepoint.hpp" #include "runtime/safepointVerifiers.hpp" #if INCLUDE_JFR #include "jfr/metadata/jfrSerializer.hpp"
--- a/src/hotspot/share/include/jvm.h Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/include/jvm.h Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -63,7 +63,7 @@ * class. */ -#define JVM_INTERFACE_VERSION 5 +#define JVM_INTERFACE_VERSION 6 JNIEXPORT jint JNICALL JVM_GetInterfaceVersion(void); @@ -450,7 +450,7 @@ */ JNIEXPORT jstring JNICALL -JVM_GetClassName(JNIEnv *env, jclass cls); +JVM_InitClassName(JNIEnv *env, jclass cls); JNIEXPORT jobjectArray JNICALL JVM_GetClassInterfaces(JNIEnv *env, jclass cls);
--- a/src/hotspot/share/prims/jvm.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/prims/jvm.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -1058,21 +1058,14 @@ // Reflection support ////////////////////////////////////////////////////////////////////////////// -JVM_ENTRY(jstring, JVM_GetClassName(JNIEnv *env, jclass cls)) +JVM_ENTRY(jstring, JVM_InitClassName(JNIEnv *env, jclass cls)) assert (cls != NULL, "illegal class"); - JVMWrapper("JVM_GetClassName"); + JVMWrapper("JVM_InitClassName"); JvmtiVMObjectAllocEventCollector oam; ResourceMark rm(THREAD); - const char* name; - if (java_lang_Class::is_primitive(JNIHandles::resolve(cls))) { - name = type2name(java_lang_Class::primitive_type(JNIHandles::resolve(cls))); - } else { - // Consider caching interned string in Klass - Klass* k = java_lang_Class::as_Klass(JNIHandles::resolve(cls)); - assert(k->is_klass(), "just checking"); - name = k->external_name(); - } - oop result = StringTable::intern((char*) name, CHECK_NULL); + HandleMark hm(THREAD); + Handle java_class(THREAD, JNIHandles::resolve(cls)); + oop result = java_lang_Class::name(java_class, CHECK_NULL); return (jstring) JNIHandles::make_local(env, result); JVM_END
--- a/src/hotspot/share/runtime/os.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/src/hotspot/share/runtime/os.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2019, 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 @@ -217,7 +217,8 @@ OSReturn os::set_priority(Thread* thread, ThreadPriority p) { debug_only(Thread::check_for_dangling_thread_pointer(thread);) - if (p >= MinPriority && p <= MaxPriority) { + if ((p >= MinPriority && p <= MaxPriority) || + (p == CriticalPriority && thread->is_ConcurrentGC_thread())) { int priority = java_to_os_priority[p]; return set_native_priority(thread, priority); } else {
--- a/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java Mon Feb 18 07:45:57 2019 -0800 +++ b/src/java.base/share/classes/com/sun/crypto/provider/GaloisCounterMode.java Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2019, 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 @@ -61,6 +61,9 @@ // can only be returned by the doFinal(...) call. private static final int MAX_BUF_SIZE = Integer.MAX_VALUE; + // data size when buffer is divided up to aid in intrinsics + private static final int TRIGGERLEN = 65536; // 64k + // buffer for AAD data; if null, meaning update has been called private ByteArrayOutputStream aadBuffer = new ByteArrayOutputStream(); private int sizeOfAAD = 0; @@ -380,12 +383,10 @@ // Utility to process the last block; used by encryptFinal and decryptFinal void doLastBlock(byte[] in, int inOfs, int len, byte[] out, int outOfs, boolean isEncrypt) throws IllegalBlockSizeException { - // process data in 'in' - gctrPAndC.doFinal(in, inOfs, len, out, outOfs); - processed += len; - byte[] ct; int ctOfs; + int ilen = len; // internal length + if (isEncrypt) { ct = out; ctOfs = outOfs; @@ -393,14 +394,38 @@ ct = in; ctOfs = inOfs; } + + // Divide up larger data sizes to trigger CTR & GHASH intrinsic quicker + if (len > TRIGGERLEN) { + int i = 0; + int tlen; // incremental lengths + // 96bit CTR x86 intrinsic + final int plen = AES_BLOCK_SIZE * 6; + // arbitrary formula to aid intrinsic without reaching buffer end + final int count = len / 1024; + + while (count > i) { + tlen = gctrPAndC.update(in, inOfs, plen, out, outOfs); + ghashAllToS.update(ct, ctOfs, tlen); + inOfs += tlen; + outOfs += tlen; + ctOfs += tlen; + i++; + } + ilen -= count * plen; + processed += count * plen; + } + + gctrPAndC.doFinal(in, inOfs, ilen, out, outOfs); + processed += ilen; + int lastLen = len % AES_BLOCK_SIZE; if (lastLen != 0) { ghashAllToS.update(ct, ctOfs, len - lastLen); - byte[] padded = - expandToOneBlock(ct, (ctOfs + len - lastLen), lastLen); - ghashAllToS.update(padded); + ghashAllToS.update( + expandToOneBlock(ct, (ctOfs + len - lastLen), lastLen)); } else { - ghashAllToS.update(ct, ctOfs, len); + ghashAllToS.update(ct, ctOfs, ilen); } } @@ -562,16 +587,20 @@ System.arraycopy(in, inOfs + len - tagLenBytes, tag, 0, tagLenBytes); len -= tagLenBytes; - if (len > 0) { - ibuffer.write(in, inOfs, len); + // If decryption is in-place or there is buffered "ibuffer" data, copy + // the "in" byte array into the ibuffer before proceeding. + if (in == out || ibuffer.size() > 0) { + if (len > 0) { + ibuffer.write(in, inOfs, len); + } + + // refresh 'in' to all buffered-up bytes + in = ibuffer.toByteArray(); + inOfs = 0; + len = in.length; + ibuffer.reset(); } - // refresh 'in' to all buffered-up bytes - in = ibuffer.toByteArray(); - inOfs = 0; - len = in.length; - ibuffer.reset(); - if (len > 0) { doLastBlock(in, inOfs, len, out, outOfs, false); }
--- a/src/java.base/share/classes/java/lang/Class.java Mon Feb 18 07:45:57 2019 -0800 +++ b/src/java.base/share/classes/java/lang/Class.java Mon Feb 18 08:31:32 2019 -0800 @@ -795,14 +795,13 @@ */ public String getName() { String name = this.name; - if (name == null) - this.name = name = getName0(); - return name; + return name != null ? name : initClassName(); } - // cache the name to reduce the number of calls into the VM + // Cache the name to reduce the number of calls into the VM. + // This field would be set by VM itself during initClassName call. private transient String name; - private native String getName0(); + private native String initClassName(); /** * Returns the class loader for the class. Some implementations may use
--- a/src/java.base/share/native/libjava/Class.c Mon Feb 18 07:45:57 2019 -0800 +++ b/src/java.base/share/native/libjava/Class.c Mon Feb 18 08:31:32 2019 -0800 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2019, 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 @@ -52,7 +52,7 @@ #define BA "[B" static JNINativeMethod methods[] = { - {"getName0", "()" STR, (void *)&JVM_GetClassName}, + {"initClassName", "()" STR, (void *)&JVM_InitClassName}, {"getSuperclass", "()" CLS, NULL}, {"getInterfaces0", "()[" CLS, (void *)&JVM_GetClassInterfaces}, {"isInterface", "()Z", (void *)&JVM_IsInterface},
--- a/test/hotspot/gtest/utilities/test_globalDefinitions.cpp Mon Feb 18 07:45:57 2019 -0800 +++ b/test/hotspot/gtest/utilities/test_globalDefinitions.cpp Mon Feb 18 08:31:32 2019 -0800 @@ -103,7 +103,7 @@ EXPECT_STREQ("M", exact_unit_for_byte_size(M)); EXPECT_STREQ("B", exact_unit_for_byte_size(M + 1)); EXPECT_STREQ("K", exact_unit_for_byte_size(M + K)); -#ifdef LP64 +#ifdef _LP64 EXPECT_STREQ("B", exact_unit_for_byte_size(G - 1)); EXPECT_STREQ("G", exact_unit_for_byte_size(G)); EXPECT_STREQ("B", exact_unit_for_byte_size(G + 1)); @@ -123,7 +123,7 @@ EXPECT_EQ(1u, byte_size_in_exact_unit(M)); EXPECT_EQ(M + 1, byte_size_in_exact_unit(M + 1)); EXPECT_EQ(K + 1, byte_size_in_exact_unit(M + K)); -#ifdef LP64 +#ifdef _LP64 EXPECT_EQ(G - 1, byte_size_in_exact_unit(G - 1)); EXPECT_EQ(1u, byte_size_in_exact_unit(G)); EXPECT_EQ(G + 1, byte_size_in_exact_unit(G + 1));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/gc/cms/TestCriticalPriority.java Mon Feb 18 08:31:32 2019 -0800 @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. 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. + */ + +/* + * @test TestCriticalPriority + * @key gc + * @bug 8217378 + * @requires vm.gc.ConcMarkSweep & !vm.graal.enabled + * @summary Test critical priority is accepted + * @run main/othervm -XX:+UseConcMarkSweepGC -XX:+UnlockExperimentalVMOptions -XX:+UseCriticalCMSThreadPriority TestCriticalPriority + */ + +public class TestCriticalPriority { + public static void main(String args[]) throws Exception { + // The failure would be detected before entering main(). + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/gc/epsilon/TestClasses.java Mon Feb 18 08:31:32 2019 -0800 @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. 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. + */ + +/** + * @test TestClasses + * @key gc + * @requires vm.gc.Epsilon & !vm.graal.enabled + * @summary Epsilon is able to allocate a lot of classes + * + * @modules java.base/jdk.internal.org.objectweb.asm + * java.base/jdk.internal.misc + * + * @run main/othervm -Xmx128m -XX:MetaspaceSize=1m -XX:MaxMetaspaceSize=64m -XX:+UnlockExperimentalVMOptions -XX:+UseEpsilonGC -Xlog:gc -Xlog:gc+metaspace TestClasses + */ + +import jdk.internal.org.objectweb.asm.ClassWriter; +import jdk.internal.org.objectweb.asm.Opcodes; + +import java.util.*; +import java.io.*; +import java.nio.*; +import java.nio.file.*; + +public class TestClasses { + + static final int COUNT = 32*1024; + + static volatile Object sink; + + static class MyClassLoader extends ClassLoader { + public byte[] createClass(String name) { + ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS | ClassWriter.COMPUTE_FRAMES); + cw.visit(Opcodes.V1_8, Opcodes.ACC_PUBLIC | Opcodes.ACC_SUPER, name, null, "java/lang/Object", null); + return cw.toByteArray(); + } + + public Class<?> loadClass(String name) throws ClassNotFoundException { + if (!name.startsWith("Dummy")) { + return super.loadClass(name); + } + byte[] cls = createClass(name); + return defineClass(name, cls, 0, cls.length, null); + } + } + + public static void main(String[] args) throws Exception { + ClassLoader cl = new MyClassLoader(); + for (int c = 0; c < COUNT; c++) { + Class<?> clazz = Class.forName("Dummy" + c, true, cl); + if (clazz.getClassLoader() != cl) { + throw new IllegalStateException("Should have loaded by target loader"); + } + sink = c; + } + } +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/gc/shenandoah/options/TestCriticalControlThreadPriority.java Mon Feb 18 08:31:32 2019 -0800 @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. All rights reserved. + * + * 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. + * + */ + +/* + * @test TestCriticalControlThreadPriority + * @summary Check that ShenandoahCriticalControlThreadPriority works + * @bug 8217343 + * @key gc + * @requires vm.gc.Shenandoah + * + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:-ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority + * @run main/othervm -XX:+UnlockExperimentalVMOptions -XX:+UseShenandoahGC -XX:+ShenandoahCriticalControlThreadPriority -Xmx1g TestCriticalControlThreadPriority + */ + +public class TestCriticalControlThreadPriority { + + public static void main(String[] args) throws Exception { + // checking the initialization before entering main() + } + +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test/hotspot/jtreg/runtime/StackTrace/StackTraceClassCache.java Mon Feb 18 08:31:32 2019 -0800 @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2019, Red Hat, Inc. 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. + */ + +/* + * @test + * @bug 8216302 + * @summary Check that stack trace contains proper strings even with class caching + * @modules java.base/java.lang:open + * @compile StackTraceClassCache.java + * @run main StackTraceClassCache + */ + +import java.lang.reflect.*; + +public class StackTraceClassCache { + public static void main(String... args) throws Exception { + Outer.Inner o = new Outer().new Inner(); + Class cl = o.getClass(); + + // Check out of the box class name + try { + o.work(); + } catch (Exception e) { + checkException(e, 42); + } + + // Clear and populate class caches via getName + clearNameCache(cl); + cl.getName(); + try { + o.work(); + } catch (Exception e) { + checkException(e, 51); + } + + // Clear and populate class caches via stack trace + clearNameCache(cl); + try { + o.work(); + } catch (Exception e) { + checkException(e, 59); + } + } + + static void checkException(Exception e, int line) throws Exception { + StackTraceElement[] fs = e.getStackTrace(); + + if (fs.length < 2) { + throw new IllegalStateException("Exception should have at least two frames", e); + } + + assertCorrect("StackTraceClassCache$Outer$Inner.work(StackTraceClassCache.java:95)", fs[0].toString(), e); + assertCorrect("StackTraceClassCache.main(StackTraceClassCache.java:" + line + ")", fs[1].toString(), e); + } + + static void assertCorrect(String expected, String actual, Exception e) throws Exception { + if (!expected.equals(actual)) { + throw new IllegalStateException("Expected: " + expected + "; Actual: " + actual, e); + } + } + + static void clearNameCache(Class cl) { + try { + Field f = Class.class.getDeclaredField("name"); + f.setAccessible(true); + f.set(cl, null); + } catch (Exception e) { + throw new IllegalStateException(e); + } + } + + static class Outer { + class Inner { + void work() throws Exception { + throw new Exception("Sample exception"); + } + } + } + +}