Skip to content

Commit 4c75d14

Browse files
committed
8259374: Make ThreadInVMfromNative have ResetNoHandleMark
Reviewed-by: dcubed, pchilanomate
1 parent 563b268 commit 4c75d14

File tree

7 files changed

+10
-14
lines changed

7 files changed

+10
-14
lines changed

src/hotspot/share/ci/ciUtilities.inline.hpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -34,7 +34,6 @@
3434
#define VM_ENTRY_MARK \
3535
CompilerThread* thread=CompilerThread::current(); \
3636
ThreadInVMfromNative __tiv(thread); \
37-
ResetNoHandleMark rnhm; \
3837
HandleMarkCleaner __hm(thread); \
3938
Thread* THREAD = thread; \
4039
debug_only(VMNativeEntryWrapper __vew;)

src/hotspot/share/compiler/compileBroker.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -1803,7 +1803,6 @@ bool CompileBroker::init_compiler_runtime() {
18031803

18041804
// Switch back to VM state to do compiler initialization
18051805
ThreadInVMfromNative tv(thread);
1806-
ResetNoHandleMark rnhm;
18071806

18081807
// Perform per-thread and global initializations
18091808
comp->initialize();

src/hotspot/share/jfr/recorder/checkpoint/jfrCheckpointManager.cpp

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -374,7 +374,6 @@ size_t JfrCheckpointManager::write_threads(Thread* thread) {
374374
assert(thread != NULL, "invariant");
375375
// can safepoint here
376376
ThreadInVMfromNative transition(thread->as_Java_thread());
377-
ResetNoHandleMark rnhm;
378377
ResourceMark rm(thread);
379378
HandleMark hm(thread);
380379
JfrCheckpointWriter writer(true, thread, THREADS);
@@ -402,7 +401,6 @@ void JfrCheckpointManager::clear_type_set() {
402401
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(t));
403402
// can safepoint here
404403
ThreadInVMfromNative transition(t);
405-
ResetNoHandleMark rnhm;
406404
MutexLocker cld_lock(ClassLoaderDataGraph_lock);
407405
MutexLocker module_lock(Module_lock);
408406
JfrTypeSet::clear();
@@ -414,7 +412,6 @@ void JfrCheckpointManager::write_type_set() {
414412
DEBUG_ONLY(JfrJavaSupport::check_java_thread_in_native(thread));
415413
// can safepoint here
416414
ThreadInVMfromNative transition(thread);
417-
ResetNoHandleMark rnhm;
418415
MutexLocker cld_lock(thread, ClassLoaderDataGraph_lock);
419416
MutexLocker module_lock(thread, Module_lock);
420417
if (LeakProfiler::is_running()) {
@@ -454,7 +451,6 @@ size_t JfrCheckpointManager::flush_type_set() {
454451
if (thread->is_Java_thread()) {
455452
// can safepoint here
456453
ThreadInVMfromNative transition(thread->as_Java_thread());
457-
ResetNoHandleMark rnhm;
458454
elements = ::flush_type_set(thread);
459455
} else {
460456
elements = ::flush_type_set(thread);

src/hotspot/share/jfr/recorder/repository/jfrChunkRotation.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,6 @@ static void notify() {
5656
JavaThread* const thread = JavaThread::current();
5757
// can safepoint here
5858
ThreadInVMfromNative transition(thread);
59-
ResetNoHandleMark rnhm;
6059
JfrJavaSupport::notify_all(get_chunk_monitor(thread), thread);
6160
}
6261

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2011, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -126,7 +126,6 @@ Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) {
126126
// Bring the JVMCI compiler thread into the VM state.
127127
#define JVMCI_VM_ENTRY_MARK \
128128
ThreadInVMfromNative __tiv(thread); \
129-
ResetNoHandleMark rnhm; \
130129
HandleMarkCleaner __hm(thread); \
131130
Thread* THREAD = thread; \
132131
debug_only(VMNativeEntryWrapper __vew;)

src/hotspot/share/runtime/handles.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved.
33
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
44
*
55
* This code is free software; you can redistribute it and/or modify it
@@ -288,6 +288,9 @@ class NoHandleMark: public StackObj {
288288
};
289289

290290

291+
// ResetNoHandleMark is called in a context where there is an enclosing
292+
// NoHandleMark. A thread in _thread_in_native must not create handles so
293+
// this is used when transitioning via ThreadInVMfromNative.
291294
class ResetNoHandleMark: public StackObj {
292295
int _no_handle_mark_nesting;
293296
public:

src/hotspot/share/runtime/interfaceSupport.inline.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ class ThreadInVMfromUnknown {
192192

193193

194194
class ThreadInVMfromNative : public ThreadStateTransition {
195+
ResetNoHandleMark __rnhm;
195196
public:
196197
ThreadInVMfromNative(JavaThread* thread) : ThreadStateTransition(thread) {
197198
trans_from_native(_thread_in_vm);

0 commit comments

Comments
 (0)