# HG changeset patch # User stefank # Date 1521827652 -3600 # Node ID 898ef81cbc0e59dc921f465269d5dfb2ea04cb68 # Parent 4dd58ecc991225ca65943ef29968b4ba0f1a0a67 8200106: Move NoSafepointVerifier out from gcLocker.hpp Reviewed-by: coleenp diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/os/posix/os_posix.cpp --- a/src/hotspot/os/posix/os_posix.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/os/posix/os_posix.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -23,6 +23,7 @@ */ #include "jvm.h" +#include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "utilities/globalDefinitions.hpp" #include "runtime/frame.inline.hpp" @@ -30,6 +31,7 @@ #include "runtime/os.hpp" #include "services/memTracker.hpp" #include "utilities/align.hpp" +#include "utilities/formatBuffer.hpp" #include "utilities/macros.hpp" #include "utilities/vmError.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/aot/aotCodeHeap.cpp --- a/src/hotspot/share/aot/aotCodeHeap.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/aot/aotCodeHeap.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -29,8 +29,8 @@ #include "classfile/javaAssertions.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.hpp" +#include "gc/shared/collectedHeap.hpp" #include "gc/g1/heapRegion.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/abstractInterpreter.hpp" #include "jvmci/compilerRuntime.hpp" #include "jvmci/jvmciRuntime.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/aot/aotCompiledMethod.cpp --- a/src/hotspot/share/aot/aotCompiledMethod.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/aot/aotCompiledMethod.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -32,7 +32,6 @@ #include "compiler/compilerOracle.hpp" #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/collectedHeap.hpp" -#include "gc/shared/gcLocker.hpp" #include "jvmci/compilerRuntime.hpp" #include "jvmci/jvmciRuntime.hpp" #include "oops/method.inline.hpp" @@ -40,6 +39,7 @@ #include "runtime/handles.inline.hpp" #include "runtime/java.hpp" #include "runtime/os.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "utilities/xmlstream.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/asm/codeBuffer.cpp --- a/src/hotspot/share/asm/codeBuffer.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/asm/codeBuffer.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -25,10 +25,10 @@ #include "precompiled.hpp" #include "asm/codeBuffer.hpp" #include "compiler/disassembler.hpp" -#include "gc/shared/gcLocker.hpp" #include "oops/methodData.hpp" #include "oops/oop.inline.hpp" #include "runtime/icache.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/align.hpp" #include "utilities/copy.hpp" #include "utilities/xmlstream.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/ci/ciEnv.cpp --- a/src/hotspot/share/ci/ciEnv.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/ci/ciEnv.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -57,6 +57,7 @@ #include "runtime/init.hpp" #include "runtime/reflection.hpp" #include "runtime/jniHandles.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/thread.inline.hpp" #include "trace/tracing.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/classFileParser.cpp --- a/src/hotspot/share/classfile/classFileParser.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/classFileParser.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -37,7 +37,6 @@ #include "classfile/verificationType.hpp" #include "classfile/verifier.hpp" #include "classfile/vmSymbols.hpp" -#include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.hpp" @@ -62,6 +61,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/perfData.hpp" #include "runtime/reflection.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/signature.hpp" #include "runtime/timer.hpp" #include "services/classLoadingService.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/classLoaderData.cpp --- a/src/hotspot/share/classfile/classLoaderData.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/classLoaderData.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -56,7 +56,6 @@ #include "classfile/packageEntry.hpp" #include "classfile/systemDictionary.hpp" #include "code/codeCache.hpp" -#include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.inline.hpp" @@ -74,6 +73,7 @@ #include "runtime/mutex.hpp" #include "runtime/orderAccess.hpp" #include "runtime/safepoint.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/synchronizer.hpp" #include "utilities/growableArray.hpp" #include "utilities/macros.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/dictionary.cpp --- a/src/hotspot/share/classfile/dictionary.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/dictionary.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -29,7 +29,6 @@ #include "classfile/protectionDomainCache.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/systemDictionaryShared.hpp" -#include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/iterator.hpp" @@ -38,6 +37,7 @@ #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/orderAccess.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/hashtable.inline.hpp" // Optimization: if any dictionary needs resizing, we set this flag, diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/javaClasses.cpp --- a/src/hotspot/share/classfile/javaClasses.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/javaClasses.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -58,6 +58,7 @@ #include "runtime/javaCalls.hpp" #include "runtime/jniHandles.inline.hpp" #include "runtime/safepoint.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vframe.inline.hpp" #include "utilities/align.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/stringTable.cpp --- a/src/hotspot/share/classfile/stringTable.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/stringTable.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -29,7 +29,6 @@ #include "classfile/stringTable.hpp" #include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.inline.hpp" -#include "gc/shared/gcLocker.inline.hpp" #include "logging/log.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" @@ -41,6 +40,7 @@ #include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/safepointVerifiers.hpp" #include "services/diagnosticCommand.hpp" #include "utilities/hashtable.inline.hpp" #include "utilities/macros.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/symbolTable.cpp --- a/src/hotspot/share/classfile/symbolTable.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/symbolTable.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -29,7 +29,7 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "gc/shared/collectedHeap.inline.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "memory/allocation.inline.hpp" #include "memory/filemap.hpp" #include "memory/metaspaceClosure.hpp" @@ -37,6 +37,7 @@ #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/safepointVerifiers.hpp" #include "services/diagnosticCommand.hpp" #include "utilities/hashtable.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/systemDictionary.cpp --- a/src/hotspot/share/classfile/systemDictionary.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/systemDictionary.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -43,7 +43,6 @@ #include "classfile/vmSymbols.hpp" #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" -#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/interpreter.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/verificationType.cpp --- a/src/hotspot/share/classfile/verificationType.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/verificationType.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,6 +27,7 @@ #include "classfile/systemDictionaryShared.hpp" #include "classfile/verificationType.hpp" #include "classfile/verifier.hpp" +#include "logging/log.hpp" #include "runtime/handles.inline.hpp" VerificationType VerificationType::from_tag(u1 tag) { diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/verifier.cpp --- a/src/hotspot/share/classfile/verifier.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/verifier.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -49,6 +49,7 @@ #include "runtime/jniHandles.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/os.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/thread.hpp" #include "services/threadService.hpp" #include "utilities/align.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/classfile/verifier.hpp --- a/src/hotspot/share/classfile/verifier.hpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/classfile/verifier.hpp Fri Mar 23 18:54:12 2018 +0100 @@ -26,7 +26,6 @@ #define SHARE_VM_CLASSFILE_VERIFIER_HPP #include "classfile/verificationType.hpp" -#include "gc/shared/gcLocker.hpp" #include "oops/klass.hpp" #include "oops/method.hpp" #include "runtime/handles.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/code/codeCache.cpp --- a/src/hotspot/share/code/codeCache.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/code/codeCache.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -32,7 +32,6 @@ #include "code/nmethod.hpp" #include "code/pcDesc.hpp" #include "compiler/compileBroker.hpp" -#include "gc/shared/gcLocker.hpp" #include "memory/allocation.inline.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" @@ -47,6 +46,7 @@ #include "runtime/icache.hpp" #include "runtime/java.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sweeper.hpp" #include "services/memoryService.hpp" #include "trace/tracing.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/code/dependencies.hpp --- a/src/hotspot/share/code/dependencies.hpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/code/dependencies.hpp Fri Mar 23 18:54:12 2018 +0100 @@ -32,6 +32,7 @@ #include "code/compressedStream.hpp" #include "code/nmethod.hpp" #include "memory/resourceArea.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/growableArray.hpp" #include "utilities/hashtable.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/code/nmethod.cpp --- a/src/hotspot/share/code/nmethod.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/code/nmethod.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -37,7 +37,6 @@ #include "compiler/compilerDirectives.hpp" #include "compiler/directivesParser.hpp" #include "compiler/disassembler.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/bytecode.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" @@ -53,6 +52,7 @@ #include "runtime/jniHandles.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/os.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/sweeper.hpp" #include "runtime/vmThread.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/compiler/compileBroker.cpp --- a/src/hotspot/share/compiler/compileBroker.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/compiler/compileBroker.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -50,6 +50,7 @@ #include "runtime/interfaceSupport.inline.hpp" #include "runtime/javaCalls.hpp" #include "runtime/os.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/sweeper.hpp" #include "runtime/timerTrace.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/cms/cmsCollectorPolicy.cpp --- a/src/hotspot/share/gc/cms/cmsCollectorPolicy.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/cms/cmsCollectorPolicy.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -28,7 +28,7 @@ #include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/cardTableRS.hpp" #include "gc/shared/collectorPolicy.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/generationSpec.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp --- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -44,7 +44,7 @@ #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/collectorCounters.hpp" #include "gc/shared/collectorPolicy.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/cms/vmCMSOperations.cpp --- a/src/hotspot/share/gc/cms/vmCMSOperations.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/cms/vmCMSOperations.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,7 +27,7 @@ #include "gc/cms/concurrentMarkSweepGeneration.inline.hpp" #include "gc/cms/concurrentMarkSweepThread.hpp" #include "gc/cms/vmCMSOperations.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/isGCActiveMark.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/g1/g1CollectedHeap.cpp --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -62,7 +62,7 @@ #include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcId.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/g1/g1StringDedupQueue.cpp --- a/src/hotspot/share/gc/g1/g1StringDedupQueue.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/g1/g1StringDedupQueue.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,11 +27,11 @@ #include "gc/g1/g1CollectedHeap.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/g1/g1StringDedupQueue.hpp" -#include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" #include "runtime/atomic.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/stack.inline.hpp" G1StringDedupQueue* G1StringDedupQueue::_queue = NULL; diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/g1/g1StringDedupTable.cpp --- a/src/hotspot/share/gc/g1/g1StringDedupTable.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/g1/g1StringDedupTable.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -29,13 +29,13 @@ #include "gc/g1/g1CollectedHeap.inline.hpp" #include "gc/g1/g1StringDedup.hpp" #include "gc/g1/g1StringDedupTable.hpp" -#include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "memory/padded.inline.hpp" #include "oops/arrayOop.inline.hpp" #include "oops/oop.inline.hpp" #include "oops/typeArrayOop.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/safepointVerifiers.hpp" // // List of deduplication table entries. Links table diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp --- a/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/parallel/parallelScavengeHeap.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -38,7 +38,7 @@ #include "gc/parallel/psScavenge.hpp" #include "gc/parallel/vmPSOperations.hpp" #include "gc/shared/gcHeapSummary.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcWhen.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/parallel/psMarkSweep.cpp --- a/src/hotspot/share/gc/parallel/psMarkSweep.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/parallel/psMarkSweep.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -39,7 +39,7 @@ #include "gc/shared/gcCause.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcId.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/parallel/psOldGen.cpp --- a/src/hotspot/share/gc/parallel/psOldGen.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/parallel/psOldGen.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -30,7 +30,7 @@ #include "gc/parallel/psMarkSweepDecorator.hpp" #include "gc/parallel/psOldGen.hpp" #include "gc/shared/cardTableBarrierSet.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/spaceDecorator.hpp" #include "logging/log.hpp" #include "oops/oop.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/parallel/psParallelCompact.cpp --- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -44,7 +44,7 @@ #include "gc/shared/gcCause.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcId.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/parallel/psScavenge.cpp --- a/src/hotspot/share/gc/parallel/psScavenge.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/parallel/psScavenge.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -36,7 +36,7 @@ #include "gc/shared/gcCause.hpp" #include "gc/shared/gcHeapSummary.hpp" #include "gc/shared/gcId.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/parallel/vmPSOperations.cpp --- a/src/hotspot/share/gc/parallel/vmPSOperations.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/parallel/vmPSOperations.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,7 +27,7 @@ #include "gc/parallel/psMarkSweep.hpp" #include "gc/parallel/psScavenge.hpp" #include "gc/parallel/vmPSOperations.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "utilities/dtrace.hpp" // The following methods are used by the parallel scavenge collector diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/serial/defNewGeneration.cpp --- a/src/hotspot/share/gc/serial/defNewGeneration.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -29,7 +29,7 @@ #include "gc/shared/cardTableRS.hpp" #include "gc/shared/collectorCounters.hpp" #include "gc/shared/gcHeapSummary.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/collectorPolicy.cpp --- a/src/hotspot/share/gc/shared/collectorPolicy.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/collectorPolicy.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -26,7 +26,7 @@ #include "gc/shared/adaptiveSizePolicy.hpp" #include "gc/shared/cardTableRS.hpp" #include "gc/shared/collectorPolicy.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/generationSpec.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/gcLocker.cpp --- a/src/hotspot/share/gc/shared/gcLocker.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/gcLocker.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -24,10 +24,11 @@ #include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "memory/resourceArea.hpp" #include "logging/log.hpp" #include "runtime/atomic.hpp" +#include "runtime/safepoint.hpp" #include "runtime/thread.inline.hpp" #include "runtime/threadSMR.hpp" @@ -85,6 +86,10 @@ } } +bool GCLocker::is_at_safepoint() { + return SafepointSynchronize::is_at_safepoint(); +} + bool GCLocker::check_active_before_gc() { assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint"); if (is_active() && !_needs_gc) { @@ -145,87 +150,3 @@ JNICritical_lock->notify_all(); } } - -// Implementation of NoGCVerifier - -#ifdef ASSERT - -NoGCVerifier::NoGCVerifier(bool verifygc) { - _verifygc = verifygc; - if (_verifygc) { - CollectedHeap* h = Universe::heap(); - assert(!h->is_gc_active(), "GC active during NoGCVerifier"); - _old_invocations = h->total_collections(); - } -} - - -NoGCVerifier::~NoGCVerifier() { - if (_verifygc) { - CollectedHeap* h = Universe::heap(); - assert(!h->is_gc_active(), "GC active during NoGCVerifier"); - if (_old_invocations != h->total_collections()) { - fatal("collection in a NoGCVerifier secured function"); - } - } -} - -PauseNoGCVerifier::PauseNoGCVerifier(NoGCVerifier * ngcv) { - _ngcv = ngcv; - if (_ngcv->_verifygc) { - // if we were verifying, then make sure that nothing is - // wrong before we "pause" verification - CollectedHeap* h = Universe::heap(); - assert(!h->is_gc_active(), "GC active during NoGCVerifier"); - if (_ngcv->_old_invocations != h->total_collections()) { - fatal("collection in a NoGCVerifier secured function"); - } - } -} - - -PauseNoGCVerifier::~PauseNoGCVerifier() { - if (_ngcv->_verifygc) { - // if we were verifying before, then reenable verification - CollectedHeap* h = Universe::heap(); - assert(!h->is_gc_active(), "GC active during NoGCVerifier"); - _ngcv->_old_invocations = h->total_collections(); - } -} - - -// JRT_LEAF rules: -// A JRT_LEAF method may not interfere with safepointing by -// 1) acquiring or blocking on a Mutex or JavaLock - checked -// 2) allocating heap memory - checked -// 3) executing a VM operation - checked -// 4) executing a system call (including malloc) that could block or grab a lock -// 5) invoking GC -// 6) reaching a safepoint -// 7) running too long -// Nor may any method it calls. -JRTLeafVerifier::JRTLeafVerifier() - : NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC()) -{ -} - -JRTLeafVerifier::~JRTLeafVerifier() -{ -} - -bool JRTLeafVerifier::should_verify_GC() { - switch (JavaThread::current()->thread_state()) { - case _thread_in_Java: - // is in a leaf routine, there must be no safepoint. - return true; - case _thread_in_native: - // A native thread is not subject to safepoints. - // Even while it is in a leaf routine, GC is ok - return false; - default: - // Leaf routines cannot be called from other contexts. - ShouldNotReachHere(); - return false; - } -} -#endif diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/gcLocker.hpp --- a/src/hotspot/share/gc/shared/gcLocker.hpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/gcLocker.hpp Fri Mar 23 18:54:12 2018 +0100 @@ -25,10 +25,11 @@ #ifndef SHARE_VM_GC_SHARED_GCLOCKER_HPP #define SHARE_VM_GC_SHARED_GCLOCKER_HPP -#include "gc/shared/collectedHeap.hpp" -#include "gc/shared/genCollectedHeap.hpp" -#include "memory/universe.hpp" -#include "oops/oop.hpp" +#include "memory/allocation.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/macros.hpp" + +class JavaThread; // The direct lock/unlock calls do not force a collection if an unlock // decrements the count to zero. Avoid calling these if at all possible. @@ -65,10 +66,13 @@ } static void log_debug_jni(const char* msg); + + static bool is_at_safepoint(); + public: // Accessors static bool is_active() { - assert(SafepointSynchronize::is_at_safepoint(), "only read at safepoint"); + assert(GCLocker::is_at_safepoint(), "only read at safepoint"); return is_active_internal(); } static bool needs_gc() { return _needs_gc; } @@ -135,196 +139,10 @@ // falls into the slow path, or is resumed from the safepoints in // the method, which only exist in the slow path. So when _needs_gc // is set, the slow path is always taken, till _needs_gc is cleared. - static void lock_critical(JavaThread* thread); - static void unlock_critical(JavaThread* thread); + inline static void lock_critical(JavaThread* thread); + inline static void unlock_critical(JavaThread* thread); static address needs_gc_address() { return (address) &_needs_gc; } }; - -// A NoGCVerifier object can be placed in methods where one assumes that -// no garbage collection will occur. The destructor will verify this property -// unless the constructor is called with argument false (not verifygc). -// -// The check will only be done in debug mode and if verifygc true. - -class NoGCVerifier: public StackObj { - friend class PauseNoGCVerifier; - - protected: - bool _verifygc; - unsigned int _old_invocations; - - public: -#ifdef ASSERT - NoGCVerifier(bool verifygc = true); - ~NoGCVerifier(); -#else - NoGCVerifier(bool verifygc = true) {} - ~NoGCVerifier() {} -#endif -}; - -// A PauseNoGCVerifier is used to temporarily pause the behavior -// of a NoGCVerifier object. If we are not in debug mode or if the -// NoGCVerifier object has a _verifygc value of false, then there -// is nothing to do. - -class PauseNoGCVerifier: public StackObj { - private: - NoGCVerifier * _ngcv; - - public: -#ifdef ASSERT - PauseNoGCVerifier(NoGCVerifier * ngcv); - ~PauseNoGCVerifier(); -#else - PauseNoGCVerifier(NoGCVerifier * ngcv) {} - ~PauseNoGCVerifier() {} -#endif -}; - - -// A NoSafepointVerifier object will throw an assertion failure if -// the current thread passes a possible safepoint while this object is -// instantiated. A safepoint, will either be: an oop allocation, blocking -// on a Mutex or JavaLock, or executing a VM operation. -// -// If StrictSafepointChecks is turned off, it degrades into a NoGCVerifier -// -class NoSafepointVerifier : public NoGCVerifier { - friend class PauseNoSafepointVerifier; - - private: - bool _activated; - Thread *_thread; - public: -#ifdef ASSERT - NoSafepointVerifier(bool activated = true, bool verifygc = true ) : - NoGCVerifier(verifygc), - _activated(activated) { - _thread = Thread::current(); - if (_activated) { - _thread->_allow_allocation_count++; - _thread->_allow_safepoint_count++; - } - } - - ~NoSafepointVerifier() { - if (_activated) { - _thread->_allow_allocation_count--; - _thread->_allow_safepoint_count--; - } - } -#else - NoSafepointVerifier(bool activated = true, bool verifygc = true) : NoGCVerifier(verifygc){} - ~NoSafepointVerifier() {} -#endif -}; - -// A PauseNoSafepointVerifier is used to temporarily pause the -// behavior of a NoSafepointVerifier object. If we are not in debug -// mode then there is nothing to do. If the NoSafepointVerifier -// object has an _activated value of false, then there is nothing to -// do for safepoint and allocation checking, but there may still be -// something to do for the underlying NoGCVerifier object. - -class PauseNoSafepointVerifier : public PauseNoGCVerifier { - private: - NoSafepointVerifier * _nsv; - - public: -#ifdef ASSERT - PauseNoSafepointVerifier(NoSafepointVerifier * nsv) - : PauseNoGCVerifier(nsv) { - - _nsv = nsv; - if (_nsv->_activated) { - _nsv->_thread->_allow_allocation_count--; - _nsv->_thread->_allow_safepoint_count--; - } - } - - ~PauseNoSafepointVerifier() { - if (_nsv->_activated) { - _nsv->_thread->_allow_allocation_count++; - _nsv->_thread->_allow_safepoint_count++; - } - } -#else - PauseNoSafepointVerifier(NoSafepointVerifier * nsv) - : PauseNoGCVerifier(nsv) {} - ~PauseNoSafepointVerifier() {} -#endif -}; - -// A SkipGCALot object is used to elide the usual effect of gc-a-lot -// over a section of execution by a thread. Currently, it's used only to -// prevent re-entrant calls to GC. -class SkipGCALot : public StackObj { - private: - bool _saved; - Thread* _t; - - public: -#ifdef ASSERT - SkipGCALot(Thread* t) : _t(t) { - _saved = _t->skip_gcalot(); - _t->set_skip_gcalot(true); - } - - ~SkipGCALot() { - assert(_t->skip_gcalot(), "Save-restore protocol invariant"); - _t->set_skip_gcalot(_saved); - } -#else - SkipGCALot(Thread* t) { } - ~SkipGCALot() { } -#endif -}; - -// JRT_LEAF currently can be called from either _thread_in_Java or -// _thread_in_native mode. In _thread_in_native, it is ok -// for another thread to trigger GC. The rest of the JRT_LEAF -// rules apply. -class JRTLeafVerifier : public NoSafepointVerifier { - static bool should_verify_GC(); - public: -#ifdef ASSERT - JRTLeafVerifier(); - ~JRTLeafVerifier(); -#else - JRTLeafVerifier() {} - ~JRTLeafVerifier() {} -#endif -}; - -// A NoAllocVerifier object can be placed in methods where one assumes that -// no allocation will occur. The destructor will verify this property -// unless the constructor is called with argument false (not activated). -// -// The check will only be done in debug mode and if activated. -// Note: this only makes sense at safepoints (otherwise, other threads may -// allocate concurrently.) - -class NoAllocVerifier : public StackObj { - private: - bool _activated; - - public: -#ifdef ASSERT - NoAllocVerifier(bool activated = true) { - _activated = activated; - if (_activated) Thread::current()->_allow_allocation_count++; - } - - ~NoAllocVerifier() { - if (_activated) Thread::current()->_allow_allocation_count--; - } -#else - NoAllocVerifier(bool activated = true) {} - ~NoAllocVerifier() {} -#endif -}; - #endif // SHARE_VM_GC_SHARED_GCLOCKER_HPP diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/gcLocker.inline.hpp --- a/src/hotspot/share/gc/shared/gcLocker.inline.hpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/gcLocker.inline.hpp Fri Mar 23 18:54:12 2018 +0100 @@ -26,8 +26,9 @@ #define SHARE_VM_GC_SHARED_GCLOCKER_INLINE_HPP #include "gc/shared/gcLocker.hpp" +#include "runtime/thread.hpp" -inline void GCLocker::lock_critical(JavaThread* thread) { +void GCLocker::lock_critical(JavaThread* thread) { if (!thread->in_critical()) { if (needs_gc()) { // jni_lock call calls enter_critical under the lock so that the @@ -40,7 +41,7 @@ thread->enter_critical(); } -inline void GCLocker::unlock_critical(JavaThread* thread) { +void GCLocker::unlock_critical(JavaThread* thread) { if (thread->in_last_critical()) { if (needs_gc()) { // jni_unlock call calls exit_critical under the lock so that diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/genCollectedHeap.cpp --- a/src/hotspot/share/gc/shared/genCollectedHeap.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/genCollectedHeap.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -36,7 +36,7 @@ #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/collectorCounters.hpp" #include "gc/shared/gcId.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcPolicyCounters.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/gcTraceTime.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/generation.cpp --- a/src/hotspot/share/gc/shared/generation.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/generation.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,7 +27,7 @@ #include "gc/shared/blockOffsetTable.inline.hpp" #include "gc/shared/cardTableRS.hpp" #include "gc/shared/collectedHeap.inline.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/gcTimer.hpp" #include "gc/shared/gcTrace.hpp" #include "gc/shared/genCollectedHeap.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/gc/shared/vmGCOperations.cpp --- a/src/hotspot/share/gc/shared/vmGCOperations.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/gc/shared/vmGCOperations.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,7 +27,7 @@ #include "classfile/javaClasses.hpp" #include "gc/shared/allocTracer.hpp" #include "gc/shared/gcId.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/vmGCOperations.hpp" #include "interpreter/oopMapCache.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/interpreter/linkResolver.cpp --- a/src/hotspot/share/interpreter/linkResolver.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/interpreter/linkResolver.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -32,7 +32,6 @@ #include "classfile/vmSymbols.hpp" #include "compiler/compileBroker.hpp" #include "gc/shared/collectedHeap.inline.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/bytecode.hpp" #include "interpreter/interpreterRuntime.hpp" #include "interpreter/linkResolver.hpp" @@ -53,6 +52,7 @@ #include "runtime/frame.inline.hpp" #include "runtime/handles.inline.hpp" #include "runtime/reflection.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/signature.hpp" #include "runtime/thread.inline.hpp" #include "runtime/vmThread.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/interpreter/rewriter.cpp --- a/src/hotspot/share/interpreter/rewriter.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/interpreter/rewriter.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -23,7 +23,6 @@ */ #include "precompiled.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/bytecodes.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/rewriter.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/memory/metaspace.cpp --- a/src/hotspot/share/memory/metaspace.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/memory/metaspace.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -25,7 +25,6 @@ #include "aot/aotLoader.hpp" #include "gc/shared/collectedHeap.hpp" #include "gc/shared/collectorPolicy.hpp" -#include "gc/shared/gcLocker.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" #include "memory/allocation.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/memory/metaspaceShared.cpp --- a/src/hotspot/share/memory/metaspaceShared.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/memory/metaspaceShared.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -35,7 +35,6 @@ #include "classfile/systemDictionary.hpp" #include "classfile/systemDictionaryShared.hpp" #include "code/codeCache.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/bytecodes.hpp" #include "logging/log.hpp" @@ -56,6 +55,7 @@ #include "prims/jvmtiRedefineClasses.hpp" #include "runtime/handles.inline.hpp" #include "runtime/os.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/signature.hpp" #include "runtime/timerTrace.hpp" #include "runtime/vmThread.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/memory/universe.cpp --- a/src/hotspot/share/memory/universe.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/memory/universe.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -35,7 +35,7 @@ #include "gc/shared/cardTableBarrierSet.hpp" #include "gc/shared/collectedHeap.inline.hpp" #include "gc/shared/gcArguments.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/generation.hpp" #include "gc/shared/gcTraceTime.inline.hpp" #include "gc/shared/space.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/oops/arrayKlass.cpp --- a/src/hotspot/share/oops/arrayKlass.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/oops/arrayKlass.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,7 +27,6 @@ #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" #include "gc/shared/collectedHeap.inline.hpp" -#include "gc/shared/gcLocker.hpp" #include "jvmtifiles/jvmti.h" #include "memory/metaspaceClosure.hpp" #include "memory/resourceArea.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/oops/constMethod.cpp --- a/src/hotspot/share/oops/constMethod.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/oops/constMethod.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -23,7 +23,6 @@ */ #include "precompiled.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/interpreter.hpp" #include "memory/heapInspection.hpp" #include "memory/metadataFactory.hpp" @@ -31,6 +30,7 @@ #include "memory/resourceArea.hpp" #include "oops/constMethod.hpp" #include "oops/method.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/align.hpp" // Static initialization diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/oops/klassVtable.cpp --- a/src/hotspot/share/oops/klassVtable.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/oops/klassVtable.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -26,7 +26,6 @@ #include "jvm.h" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/linkResolver.hpp" #include "logging/log.hpp" #include "logging/logStream.hpp" @@ -40,6 +39,7 @@ #include "oops/oop.inline.hpp" #include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/copy.hpp" inline InstanceKlass* klassVtable::ik() const { diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/oops/method.cpp --- a/src/hotspot/share/oops/method.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/oops/method.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -28,7 +28,6 @@ #include "code/codeCache.hpp" #include "code/debugInfoRec.hpp" #include "gc/shared/collectedHeap.inline.hpp" -#include "gc/shared/gcLocker.hpp" #include "gc/shared/generation.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/bytecodeTracer.hpp" @@ -58,6 +57,7 @@ #include "runtime/init.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/relocator.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" #include "utilities/align.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/oops/methodData.cpp --- a/src/hotspot/share/oops/methodData.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/oops/methodData.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -25,7 +25,6 @@ #include "precompiled.hpp" #include "classfile/systemDictionary.hpp" #include "compiler/compilerOracle.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/bytecode.hpp" #include "interpreter/bytecodeStream.hpp" #include "interpreter/linkResolver.hpp" @@ -39,6 +38,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/handles.inline.hpp" #include "runtime/orderAccess.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/align.hpp" #include "utilities/copy.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/opto/runtime.cpp --- a/src/hotspot/share/opto/runtime.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/opto/runtime.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -38,7 +38,7 @@ #include "gc/g1/heapRegion.hpp" #include "gc/shared/barrierSet.hpp" #include "gc/shared/collectedHeap.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "interpreter/bytecode.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/linkResolver.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/opto/type.cpp --- a/src/hotspot/share/opto/type.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/opto/type.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -28,7 +28,6 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "compiler/compileLog.hpp" -#include "gc/shared/gcLocker.hpp" #include "libadt/dict.hpp" #include "memory/oopFactory.hpp" #include "memory/resourceArea.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/jni.cpp --- a/src/hotspot/share/prims/jni.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/jni.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -71,6 +71,7 @@ #include "runtime/jniHandles.inline.hpp" #include "runtime/orderAccess.inline.hpp" #include "runtime/reflection.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" #include "runtime/thread.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/jvmtiExport.cpp --- a/src/hotspot/share/prims/jvmtiExport.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/jvmtiExport.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -54,6 +54,7 @@ #include "runtime/objectMonitor.hpp" #include "runtime/objectMonitor.inline.hpp" #include "runtime/os.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/thread.inline.hpp" #include "runtime/threadSMR.hpp" #include "runtime/vframe.inline.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/jvmtiRedefineClasses.cpp --- a/src/hotspot/share/prims/jvmtiRedefineClasses.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/jvmtiRedefineClasses.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -30,7 +30,6 @@ #include "classfile/verifier.hpp" #include "code/codeCache.hpp" #include "compiler/compileBroker.hpp" -#include "gc/shared/gcLocker.hpp" #include "interpreter/oopMapCache.hpp" #include "interpreter/rewriter.hpp" #include "logging/logStream.hpp" @@ -50,6 +49,7 @@ #include "runtime/handles.inline.hpp" #include "runtime/jniHandles.inline.hpp" #include "runtime/relocator.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/bitMap.inline.hpp" #include "utilities/events.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/jvmtiThreadState.cpp --- a/src/hotspot/share/prims/jvmtiThreadState.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/jvmtiThreadState.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -23,12 +23,12 @@ */ #include "precompiled.hpp" -#include "gc/shared/gcLocker.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "memory/resourceArea.hpp" #include "prims/jvmtiEventController.inline.hpp" #include "prims/jvmtiImpl.hpp" #include "prims/jvmtiThreadState.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/vframe.hpp" // marker for when the stack depth has been reset and is now unknown. diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/methodHandles.cpp --- a/src/hotspot/share/prims/methodHandles.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/methodHandles.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -44,6 +44,7 @@ #include "runtime/jniHandles.inline.hpp" #include "runtime/timerTrace.hpp" #include "runtime/reflection.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/signature.hpp" #include "runtime/stubRoutines.hpp" #include "utilities/exceptions.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/resolvedMethodTable.cpp --- a/src/hotspot/share/prims/resolvedMethodTable.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/resolvedMethodTable.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -24,7 +24,6 @@ #include "precompiled.hpp" #include "classfile/javaClasses.hpp" -#include "gc/shared/gcLocker.hpp" #include "memory/allocation.hpp" #include "memory/resourceArea.hpp" #include "oops/access.inline.hpp" @@ -34,6 +33,7 @@ #include "prims/resolvedMethodTable.hpp" #include "runtime/handles.inline.hpp" #include "runtime/mutexLocker.hpp" +#include "runtime/safepointVerifiers.hpp" #include "utilities/hashtable.inline.hpp" #include "utilities/macros.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/prims/whitebox.cpp --- a/src/hotspot/share/prims/whitebox.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/prims/whitebox.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -32,6 +32,7 @@ #include "code/codeCache.hpp" #include "compiler/methodMatcher.hpp" #include "compiler/directivesParser.hpp" +#include "gc/shared/genCollectedHeap.hpp" #include "jvmtifiles/jvmtiEnv.hpp" #include "memory/metadataFactory.hpp" #include "memory/metaspaceShared.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/deoptimization.cpp --- a/src/hotspot/share/runtime/deoptimization.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/deoptimization.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -48,6 +48,7 @@ #include "runtime/deoptimization.hpp" #include "runtime/frame.inline.hpp" #include "runtime/interfaceSupport.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/signature.hpp" #include "runtime/stubRoutines.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/interfaceSupport.cpp --- a/src/hotspot/share/runtime/interfaceSupport.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/interfaceSupport.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -35,6 +35,7 @@ #include "runtime/orderAccess.inline.hpp" #include "runtime/os.inline.hpp" #include "runtime/thread.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/vframe.hpp" #include "runtime/vmThread.hpp" #include "utilities/preserveException.hpp" @@ -298,3 +299,40 @@ } #endif } + +#ifdef ASSERT +// JRT_LEAF rules: +// A JRT_LEAF method may not interfere with safepointing by +// 1) acquiring or blocking on a Mutex or JavaLock - checked +// 2) allocating heap memory - checked +// 3) executing a VM operation - checked +// 4) executing a system call (including malloc) that could block or grab a lock +// 5) invoking GC +// 6) reaching a safepoint +// 7) running too long +// Nor may any method it calls. +JRTLeafVerifier::JRTLeafVerifier() + : NoSafepointVerifier(true, JRTLeafVerifier::should_verify_GC()) +{ +} + +JRTLeafVerifier::~JRTLeafVerifier() +{ +} + +bool JRTLeafVerifier::should_verify_GC() { + switch (JavaThread::current()->thread_state()) { + case _thread_in_Java: + // is in a leaf routine, there must be no safepoint. + return true; + case _thread_in_native: + // A native thread is not subject to safepoints. + // Even while it is in a leaf routine, GC is ok + return false; + default: + // Leaf routines cannot be called from other contexts. + ShouldNotReachHere(); + return false; + } +} +#endif // ASSERT diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/interfaceSupport.inline.hpp --- a/src/hotspot/share/runtime/interfaceSupport.inline.hpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/interfaceSupport.inline.hpp Fri Mar 23 18:54:12 2018 +0100 @@ -25,12 +25,12 @@ #ifndef SHARE_VM_RUNTIME_INTERFACESUPPORT_INLINE_HPP #define SHARE_VM_RUNTIME_INTERFACESUPPORT_INLINE_HPP -#include "gc/shared/gcLocker.hpp" #include "runtime/handles.inline.hpp" #include "runtime/mutexLocker.hpp" #include "runtime/orderAccess.hpp" #include "runtime/os.hpp" #include "runtime/safepointMechanism.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/thread.hpp" #include "runtime/vm_operations.hpp" #include "utilities/globalDefinitions.hpp" @@ -356,6 +356,24 @@ // VM-internal runtime interface support +// Definitions for JRT (Java (Compiler/Shared) Runtime) + +// JRT_LEAF currently can be called from either _thread_in_Java or +// _thread_in_native mode. In _thread_in_native, it is ok +// for another thread to trigger GC. The rest of the JRT_LEAF +// rules apply. +class JRTLeafVerifier : public NoSafepointVerifier { + static bool should_verify_GC(); + public: +#ifdef ASSERT + JRTLeafVerifier(); + ~JRTLeafVerifier(); +#else + JRTLeafVerifier() {} + ~JRTLeafVerifier() {} +#endif +}; + #ifdef ASSERT class RuntimeHistogramElement : public HistogramElement { @@ -436,9 +454,6 @@ #define IRT_END } - -// Definitions for JRT (Java (Compiler/Shared) Runtime) - #define JRT_ENTRY(result_type, header) \ result_type header { \ ThreadInVMfromJava __tiv(thread); \ diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/safepoint.cpp --- a/src/hotspot/share/runtime/safepoint.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/safepoint.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -33,7 +33,7 @@ #include "code/pcDesc.hpp" #include "code/scopeDesc.hpp" #include "gc/shared/collectedHeap.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/strongRootsScope.hpp" #include "gc/shared/workgroup.hpp" #include "interpreter/interpreter.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/safepointVerifiers.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/runtime/safepointVerifiers.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -0,0 +1,78 @@ +/* + * 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 + * 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. + * + */ + +#include "precompiled.hpp" +#include "runtime/safepointVerifiers.hpp" +#include "gc/shared/collectedHeap.hpp" +#include "memory/universe.hpp" +#include "utilities/debug.hpp" + +// Implementation of NoGCVerifier + +#ifdef ASSERT + +NoGCVerifier::NoGCVerifier(bool verifygc) { + _verifygc = verifygc; + if (_verifygc) { + CollectedHeap* h = Universe::heap(); + assert(!h->is_gc_active(), "GC active during NoGCVerifier"); + _old_invocations = h->total_collections(); + } +} + + +NoGCVerifier::~NoGCVerifier() { + if (_verifygc) { + CollectedHeap* h = Universe::heap(); + assert(!h->is_gc_active(), "GC active during NoGCVerifier"); + if (_old_invocations != h->total_collections()) { + fatal("collection in a NoGCVerifier secured function"); + } + } +} + +PauseNoGCVerifier::PauseNoGCVerifier(NoGCVerifier * ngcv) { + _ngcv = ngcv; + if (_ngcv->_verifygc) { + // if we were verifying, then make sure that nothing is + // wrong before we "pause" verification + CollectedHeap* h = Universe::heap(); + assert(!h->is_gc_active(), "GC active during NoGCVerifier"); + if (_ngcv->_old_invocations != h->total_collections()) { + fatal("collection in a NoGCVerifier secured function"); + } + } +} + + +PauseNoGCVerifier::~PauseNoGCVerifier() { + if (_ngcv->_verifygc) { + // if we were verifying before, then reenable verification + CollectedHeap* h = Universe::heap(); + assert(!h->is_gc_active(), "GC active during NoGCVerifier"); + _ngcv->_old_invocations = h->total_collections(); + } +} + +#endif diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/safepointVerifiers.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/hotspot/share/runtime/safepointVerifiers.hpp Fri Mar 23 18:54:12 2018 +0100 @@ -0,0 +1,175 @@ +/* + * Copyright (c) 1997, 2018, 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. + * + */ + +#ifndef SHARE_VM_RUNTIME_SAFEPOINTVERIFIERS_HPP +#define SHARE_VM_RUNTIME_SAFEPOINTVERIFIERS_HPP + +#include "memory/allocation.hpp" +#include "runtime/thread.hpp" + +// A NoGCVerifier object can be placed in methods where one assumes that +// no garbage collection will occur. The destructor will verify this property +// unless the constructor is called with argument false (not verifygc). +// +// The check will only be done in debug mode and if verifygc true. + +class NoGCVerifier: public StackObj { + friend class PauseNoGCVerifier; + + protected: + bool _verifygc; + unsigned int _old_invocations; + + public: +#ifdef ASSERT + NoGCVerifier(bool verifygc = true); + ~NoGCVerifier(); +#else + NoGCVerifier(bool verifygc = true) {} + ~NoGCVerifier() {} +#endif +}; + +// A PauseNoGCVerifier is used to temporarily pause the behavior +// of a NoGCVerifier object. If we are not in debug mode or if the +// NoGCVerifier object has a _verifygc value of false, then there +// is nothing to do. + +class PauseNoGCVerifier: public StackObj { + private: + NoGCVerifier * _ngcv; + + public: +#ifdef ASSERT + PauseNoGCVerifier(NoGCVerifier * ngcv); + ~PauseNoGCVerifier(); +#else + PauseNoGCVerifier(NoGCVerifier * ngcv) {} + ~PauseNoGCVerifier() {} +#endif +}; + + +// A NoSafepointVerifier object will throw an assertion failure if +// the current thread passes a possible safepoint while this object is +// instantiated. A safepoint, will either be: an oop allocation, blocking +// on a Mutex or JavaLock, or executing a VM operation. +// +// If StrictSafepointChecks is turned off, it degrades into a NoGCVerifier +// +class NoSafepointVerifier : public NoGCVerifier { + friend class PauseNoSafepointVerifier; + + private: + bool _activated; + Thread *_thread; + public: +#ifdef ASSERT + NoSafepointVerifier(bool activated = true, bool verifygc = true ) : + NoGCVerifier(verifygc), + _activated(activated) { + _thread = Thread::current(); + if (_activated) { + _thread->_allow_allocation_count++; + _thread->_allow_safepoint_count++; + } + } + + ~NoSafepointVerifier() { + if (_activated) { + _thread->_allow_allocation_count--; + _thread->_allow_safepoint_count--; + } + } +#else + NoSafepointVerifier(bool activated = true, bool verifygc = true) : NoGCVerifier(verifygc){} + ~NoSafepointVerifier() {} +#endif +}; + +// A PauseNoSafepointVerifier is used to temporarily pause the +// behavior of a NoSafepointVerifier object. If we are not in debug +// mode then there is nothing to do. If the NoSafepointVerifier +// object has an _activated value of false, then there is nothing to +// do for safepoint and allocation checking, but there may still be +// something to do for the underlying NoGCVerifier object. + +class PauseNoSafepointVerifier : public PauseNoGCVerifier { + private: + NoSafepointVerifier * _nsv; + + public: +#ifdef ASSERT + PauseNoSafepointVerifier(NoSafepointVerifier * nsv) + : PauseNoGCVerifier(nsv) { + + _nsv = nsv; + if (_nsv->_activated) { + _nsv->_thread->_allow_allocation_count--; + _nsv->_thread->_allow_safepoint_count--; + } + } + + ~PauseNoSafepointVerifier() { + if (_nsv->_activated) { + _nsv->_thread->_allow_allocation_count++; + _nsv->_thread->_allow_safepoint_count++; + } + } +#else + PauseNoSafepointVerifier(NoSafepointVerifier * nsv) + : PauseNoGCVerifier(nsv) {} + ~PauseNoSafepointVerifier() {} +#endif +}; + +// A NoAllocVerifier object can be placed in methods where one assumes that +// no allocation will occur. The destructor will verify this property +// unless the constructor is called with argument false (not activated). +// +// The check will only be done in debug mode and if activated. +// Note: this only makes sense at safepoints (otherwise, other threads may +// allocate concurrently.) + +class NoAllocVerifier : public StackObj { + private: + bool _activated; + + public: +#ifdef ASSERT + NoAllocVerifier(bool activated = true) { + _activated = activated; + if (_activated) Thread::current()->_allow_allocation_count++; + } + + ~NoAllocVerifier() { + if (_activated) Thread::current()->_allow_allocation_count--; + } +#else + NoAllocVerifier(bool activated = true) {} + ~NoAllocVerifier() {} +#endif +}; + +#endif // SHARE_VM_RUNTIME_SAFEPOINTVERIFIERS_HPP diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/simpleThresholdPolicy.cpp --- a/src/hotspot/share/runtime/simpleThresholdPolicy.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/simpleThresholdPolicy.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -24,10 +24,10 @@ #include "precompiled.hpp" #include "compiler/compileBroker.hpp" -#include "gc/shared/gcLocker.hpp" #include "memory/resourceArea.hpp" #include "runtime/arguments.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/simpleThresholdPolicy.hpp" #include "runtime/simpleThresholdPolicy.inline.hpp" #include "code/scopeDesc.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/synchronizer.cpp --- a/src/hotspot/share/runtime/synchronizer.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/synchronizer.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -39,6 +39,7 @@ #include "runtime/objectMonitor.hpp" #include "runtime/objectMonitor.inline.hpp" #include "runtime/osThread.hpp" +#include "runtime/safepointVerifiers.hpp" #include "runtime/sharedRuntime.hpp" #include "runtime/stubRoutines.hpp" #include "runtime/synchronizer.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/unhandledOops.cpp --- a/src/hotspot/share/runtime/unhandledOops.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/unhandledOops.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -24,7 +24,7 @@ #include "precompiled.hpp" #include "gc/shared/collectedHeap.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "memory/universe.hpp" #include "oops/oop.inline.hpp" #include "runtime/thread.hpp" diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/runtime/vmThread.cpp --- a/src/hotspot/share/runtime/vmThread.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/runtime/vmThread.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -576,6 +576,31 @@ } } +// A SkipGCALot object is used to elide the usual effect of gc-a-lot +// over a section of execution by a thread. Currently, it's used only to +// prevent re-entrant calls to GC. +class SkipGCALot : public StackObj { + private: + bool _saved; + Thread* _t; + + public: +#ifdef ASSERT + SkipGCALot(Thread* t) : _t(t) { + _saved = _t->skip_gcalot(); + _t->set_skip_gcalot(true); + } + + ~SkipGCALot() { + assert(_t->skip_gcalot(), "Save-restore protocol invariant"); + _t->set_skip_gcalot(_saved); + } +#else + SkipGCALot(Thread* t) { } + ~SkipGCALot() { } +#endif +}; + void VMThread::execute(VM_Operation* op) { Thread* t = Thread::current(); diff -r 4dd58ecc9912 -r 898ef81cbc0e src/hotspot/share/services/heapDumper.cpp --- a/src/hotspot/share/services/heapDumper.cpp Thu Mar 15 21:29:36 2018 +0100 +++ b/src/hotspot/share/services/heapDumper.cpp Fri Mar 23 18:54:12 2018 +0100 @@ -27,7 +27,7 @@ #include "classfile/symbolTable.hpp" #include "classfile/systemDictionary.hpp" #include "classfile/vmSymbols.hpp" -#include "gc/shared/gcLocker.inline.hpp" +#include "gc/shared/gcLocker.hpp" #include "gc/shared/genCollectedHeap.hpp" #include "gc/shared/vmGCOperations.hpp" #include "memory/allocation.inline.hpp"