8335921: Fix HotSpot VM build without JVMTI

Reviewed-by: dholmes, shade
This commit is contained in:
Vladimir Kozlov 2024-07-17 18:46:00 +00:00
parent 10186ff48f
commit bcb5e69505
8 changed files with 20 additions and 13 deletions

View File

@ -84,7 +84,7 @@ ifneq ($(call check-jvm-feature, jvmti), true)
jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \ jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \ jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \ jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp jvmtiAgent.cpp jvmtiAgentList.cpp jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp jvmtiAgent.cpp jvmtiAgentList.cpp jfrJvmtiAgent.cpp
endif endif
ifneq ($(call check-jvm-feature, jvmci), true) ifneq ($(call check-jvm-feature, jvmci), true)

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -32,10 +32,10 @@ class JfrJvmtiAgent : public JfrCHeapObj {
private: private:
JfrJvmtiAgent(); JfrJvmtiAgent();
~JfrJvmtiAgent(); ~JfrJvmtiAgent();
static bool create(); static bool create() NOT_JVMTI_RETURN_(true);
static void destroy(); static void destroy() NOT_JVMTI_RETURN;
public: public:
static void retransform_classes(JNIEnv* env, jobjectArray classes, TRAPS); static void retransform_classes(JNIEnv* env, jobjectArray classes, TRAPS) NOT_JVMTI_RETURN;
}; };
#endif // SHARE_JFR_INSTRUMENTATION_JFRJVMTIAGENT_HPP #endif // SHARE_JFR_INSTRUMENTATION_JFRJVMTIAGENT_HPP

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -280,6 +280,7 @@ TRACE_REQUEST_FUNC(SystemProcess) {
} }
} }
#if INCLUDE_JVMTI
template <typename AgentEvent> template <typename AgentEvent>
static void send_agent_event(AgentEvent& event, const JvmtiAgent* agent) { static void send_agent_event(AgentEvent& event, const JvmtiAgent* agent) {
event.set_name(agent->name()); event.set_name(agent->name());
@ -316,6 +317,10 @@ TRACE_REQUEST_FUNC(NativeAgent) {
const JvmtiAgentList::Iterator xrun_agents_it = JvmtiAgentList::xrun_agents(); const JvmtiAgentList::Iterator xrun_agents_it = JvmtiAgentList::xrun_agents();
send_native_agent_events(xrun_agents_it); send_native_agent_events(xrun_agents_it);
} }
#else // INCLUDE_JVMTI
TRACE_REQUEST_FUNC(JavaAgent) {}
TRACE_REQUEST_FUNC(NativeAgent) {}
#endif // INCLUDE_JVMTI
TRACE_REQUEST_FUNC(ThreadContextSwitchRate) { TRACE_REQUEST_FUNC(ThreadContextSwitchRate) {
double rate = 0.0; double rate = 0.0;

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -238,7 +238,7 @@ bool JfrRecorder::on_create_vm_2() {
} }
bool JfrRecorder::on_create_vm_3() { bool JfrRecorder::on_create_vm_3() {
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence"); JVMTI_ONLY( assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence"); )
return CDSConfig::is_dumping_archive() || launch_command_line_recordings(JavaThread::current()); return CDSConfig::is_dumping_archive() || launch_command_line_recordings(JavaThread::current());
} }

View File

@ -126,12 +126,14 @@ class CompilerToVM {
// Minimum alignment of an offset into CodeBuffer::SECT_CONSTS // Minimum alignment of an offset into CodeBuffer::SECT_CONSTS
static int data_section_item_alignment; static int data_section_item_alignment;
#if INCLUDE_JVMTI
/* /*
* Pointer to JvmtiExport::_should_notify_object_alloc. * Pointer to JvmtiExport::_should_notify_object_alloc.
* Exposed as an int* instead of an address so the * Exposed as an int* instead of an address so the
* underlying type is part of the JVMCIVMStructs definition. * underlying type is part of the JVMCIVMStructs definition.
*/ */
static int* _should_notify_object_alloc; static int* _should_notify_object_alloc;
#endif
public: public:
static void initialize(JVMCI_TRAPS); static void initialize(JVMCI_TRAPS);

View File

@ -144,7 +144,7 @@ address CompilerToVM::Data::symbol_clinit;
int CompilerToVM::Data::data_section_item_alignment; int CompilerToVM::Data::data_section_item_alignment;
int* CompilerToVM::Data::_should_notify_object_alloc; JVMTI_ONLY( int* CompilerToVM::Data::_should_notify_object_alloc; )
void CompilerToVM::Data::initialize(JVMCI_TRAPS) { void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset()); Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
@ -230,7 +230,7 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
data_section_item_alignment = relocInfo::addr_unit(); data_section_item_alignment = relocInfo::addr_unit();
_should_notify_object_alloc = &JvmtiExport::_should_notify_object_alloc; JVMTI_ONLY( _should_notify_object_alloc = &JvmtiExport::_should_notify_object_alloc; )
BarrierSet* bs = BarrierSet::barrier_set(); BarrierSet* bs = BarrierSet::barrier_set();
if (bs->is_a(BarrierSet::CardTableBarrierSet)) { if (bs->is_a(BarrierSet::CardTableBarrierSet)) {

View File

@ -138,7 +138,7 @@
\ \
static_field(CompilerToVM::Data, data_section_item_alignment, int) \ static_field(CompilerToVM::Data, data_section_item_alignment, int) \
\ \
static_field(CompilerToVM::Data, _should_notify_object_alloc, int*) \ JVMTI_ONLY(static_field(CompilerToVM::Data, _should_notify_object_alloc, int*)) \
\ \
static_field(Abstract_VM_Version, _features, uint64_t) \ static_field(Abstract_VM_Version, _features, uint64_t) \
\ \

View File

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -46,7 +46,7 @@ import jdk.test.lib.jfr.TestClassLoader;
* @test * @test
* @key jfr * @key jfr
* @summary Tests Agent Loaded event by starting native and Java agents * @summary Tests Agent Loaded event by starting native and Java agents
* @requires vm.hasJFR * @requires vm.hasJFR & vm.jvmti
* *
* @library /test/lib * @library /test/lib
* @modules java.instrument * @modules java.instrument