8348239: SA does not know about DeoptimizeObjectsALotThread

Reviewed-by: kevinw, dlong, dholmes, lmesnik
This commit is contained in:
Chris Plummer 2025-01-27 19:45:50 +00:00
parent 8cc1304542
commit 21feef3280
6 changed files with 72 additions and 25 deletions

View File

@ -773,20 +773,6 @@ void CompileBroker::compilation_init(JavaThread* THREAD) {
}
#if defined(ASSERT) && COMPILER2_OR_JVMCI
// Stress testing. Dedicated threads revert optimizations based on escape analysis concurrently to
// the running java application. Configured with vm options DeoptimizeObjectsALot*.
class DeoptimizeObjectsALotThread : public JavaThread {
static void deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS);
void deoptimize_objects_alot_loop_single();
void deoptimize_objects_alot_loop_all();
public:
DeoptimizeObjectsALotThread() : JavaThread(&deopt_objs_alot_thread_entry) { }
bool is_hidden_from_external_view() const { return true; }
};
// Entry for DeoptimizeObjectsALotThread. The threads are started in
// CompileBroker::init_compiler_threads() iff DeoptimizeObjectsALot is enabled
void DeoptimizeObjectsALotThread::deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -39,6 +39,22 @@
class nmethod;
#if defined(ASSERT) && COMPILER2_OR_JVMCI
// Stress testing. Dedicated threads revert optimizations based on escape analysis concurrently to
// the running java application. Configured with vm options DeoptimizeObjectsALot*.
class DeoptimizeObjectsALotThread : public JavaThread {
static void deopt_objs_alot_thread_entry(JavaThread* thread, TRAPS);
void deoptimize_objects_alot_loop_single();
void deoptimize_objects_alot_loop_all();
public:
DeoptimizeObjectsALotThread() : JavaThread(&deopt_objs_alot_thread_entry) { }
bool is_hidden_from_external_view() const { return true; }
};
#endif
// CompilerCounters
//
// Per Compiler Performance Counters.

View File

@ -1261,6 +1261,8 @@
declare_type(CompilerThread, JavaThread) \
declare_type(StringDedupThread, JavaThread) \
declare_type(AttachListenerThread, JavaThread) \
DEBUG_ONLY(COMPILER2_OR_JVMCI_PRESENT( \
declare_type(DeoptimizeObjectsALotThread, JavaThread))) \
declare_toplevel_type(OSThread) \
declare_toplevel_type(JavaFrameAnchor) \
\

View File

@ -0,0 +1,42 @@
/*
* Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*
*/
package sun.jvm.hotspot.runtime;
import java.io.*;
import sun.jvm.hotspot.debugger.Address;
public class DeoptimizeObjectsALotThread extends JavaThread {
public DeoptimizeObjectsALotThread (Address addr) {
super(addr);
}
public boolean isJavaThread() { return false; }
public boolean isHiddenFromExternalView() { return true; }
public boolean isDeoptimizeObjectsALotThread() { return true; }
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
@ -89,6 +89,7 @@ public class Thread extends VMObject {
public boolean isServiceThread() { return false; }
public boolean isMonitorDeflationThread() { return false; }
public boolean isAttachListenerThread() { return false; }
public boolean isDeoptimizeObjectsALotThread() { return false; }
/** Memory operations */
public void oopsDo(AddressVisitor oopVisitor) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 2025, 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
@ -155,19 +155,19 @@ public class Threads {
virtualConstructor.addMapping("NotificationThread", NotificationThread.class);
virtualConstructor.addMapping("StringDedupThread", StringDedupThread.class);
virtualConstructor.addMapping("AttachListenerThread", AttachListenerThread.class);
virtualConstructor.addMapping("DeoptimizeObjectsALotThread", DeoptimizeObjectsALotThread.class);
}
public Threads() {
_list = VMObjectFactory.newObject(ThreadsList.class, threadListField.getValue());
}
/** NOTE: this returns objects of type JavaThread, CompilerThread,
JvmtiAgentThread, NotificationThread, MonitorDeflationThread,
StringDedupThread, AttachListenerThread and ServiceThread.
The latter seven subclasses of the former. Most operations
(fetching the top frame, etc.) are only allowed to be performed on
a "pure" JavaThread. For this reason, {@link
sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been
/** NOTE: this returns objects of type JavaThread or one if its subclasses:
CompilerThread, JvmtiAgentThread, NotificationThread, MonitorDeflationThread,
StringDedupThread, AttachListenerThread, DeoptimizeObjectsALotThread and
ServiceThread. Most operations (fetching the top frame, etc.) are only
allowed to be performed on a "pure" JavaThread. For this reason,
{@link sun.jvm.hotspot.runtime.JavaThread#isJavaThread} has been
changed from the definition in the VM (which returns true for
all of these thread types) to return true for JavaThreads and
false for the seven subclasses. FIXME: should reconsider the
@ -195,7 +195,7 @@ public class Threads {
} catch (Exception e) {
throw new RuntimeException("Unable to deduce type of thread from address " + threadAddr +
" (expected type JavaThread, CompilerThread, MonitorDeflationThread, AttachListenerThread," +
" StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)", e);
" DeoptimizeObjectsALotThread, StringDedupThread, NotificationThread, ServiceThread or JvmtiAgentThread)", e);
}
}