Skip to content

Commit bcb5e69

Browse files
author
Vladimir Kozlov
committed
8335921: Fix HotSpot VM build without JVMTI
Reviewed-by: dholmes, shade
1 parent 10186ff commit bcb5e69

File tree

8 files changed

+20
-13
lines changed

8 files changed

+20
-13
lines changed

make/hotspot/lib/JvmFeatures.gmk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ ifneq ($(call check-jvm-feature, jvmti), true)
8484
jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
8585
jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.cpp \
8686
jvmtiTagMap.cpp jvmtiEventController.cpp evmCompat.cpp jvmtiEnter.xsl jvmtiExport.cpp \
87-
jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp jvmtiAgent.cpp jvmtiAgentList.cpp
87+
jvmtiClassFileReconstituter.cpp jvmtiTagMapTable.cpp jvmtiAgent.cpp jvmtiAgentList.cpp jfrJvmtiAgent.cpp
8888
endif
8989

9090
ifneq ($(call check-jvm-feature, jvmci), true)

src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2024, 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
@@ -32,10 +32,10 @@ class JfrJvmtiAgent : public JfrCHeapObj {
3232
private:
3333
JfrJvmtiAgent();
3434
~JfrJvmtiAgent();
35-
static bool create();
36-
static void destroy();
35+
static bool create() NOT_JVMTI_RETURN_(true);
36+
static void destroy() NOT_JVMTI_RETURN;
3737
public:
38-
static void retransform_classes(JNIEnv* env, jobjectArray classes, TRAPS);
38+
static void retransform_classes(JNIEnv* env, jobjectArray classes, TRAPS) NOT_JVMTI_RETURN;
3939
};
4040

4141
#endif // SHARE_JFR_INSTRUMENTATION_JFRJVMTIAGENT_HPP

src/hotspot/share/jfr/periodic/jfrPeriodic.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2024, 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
@@ -280,6 +280,7 @@ TRACE_REQUEST_FUNC(SystemProcess) {
280280
}
281281
}
282282

283+
#if INCLUDE_JVMTI
283284
template <typename AgentEvent>
284285
static void send_agent_event(AgentEvent& event, const JvmtiAgent* agent) {
285286
event.set_name(agent->name());
@@ -316,6 +317,10 @@ TRACE_REQUEST_FUNC(NativeAgent) {
316317
const JvmtiAgentList::Iterator xrun_agents_it = JvmtiAgentList::xrun_agents();
317318
send_native_agent_events(xrun_agents_it);
318319
}
320+
#else // INCLUDE_JVMTI
321+
TRACE_REQUEST_FUNC(JavaAgent) {}
322+
TRACE_REQUEST_FUNC(NativeAgent) {}
323+
#endif // INCLUDE_JVMTI
319324

320325
TRACE_REQUEST_FUNC(ThreadContextSwitchRate) {
321326
double rate = 0.0;

src/hotspot/share/jfr/recorder/jfrRecorder.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2012, 2024, 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
@@ -238,7 +238,7 @@ bool JfrRecorder::on_create_vm_2() {
238238
}
239239

240240
bool JfrRecorder::on_create_vm_3() {
241-
assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence");
241+
JVMTI_ONLY( assert(JvmtiEnvBase::get_phase() == JVMTI_PHASE_LIVE, "invalid init sequence"); )
242242
return CDSConfig::is_dumping_archive() || launch_command_line_recordings(JavaThread::current());
243243
}
244244

src/hotspot/share/jvmci/jvmciCompilerToVM.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,14 @@ class CompilerToVM {
126126
// Minimum alignment of an offset into CodeBuffer::SECT_CONSTS
127127
static int data_section_item_alignment;
128128

129+
#if INCLUDE_JVMTI
129130
/*
130131
* Pointer to JvmtiExport::_should_notify_object_alloc.
131132
* Exposed as an int* instead of an address so the
132133
* underlying type is part of the JVMCIVMStructs definition.
133134
*/
134135
static int* _should_notify_object_alloc;
136+
#endif
135137

136138
public:
137139
static void initialize(JVMCI_TRAPS);

src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ address CompilerToVM::Data::symbol_clinit;
144144

145145
int CompilerToVM::Data::data_section_item_alignment;
146146

147-
int* CompilerToVM::Data::_should_notify_object_alloc;
147+
JVMTI_ONLY( int* CompilerToVM::Data::_should_notify_object_alloc; )
148148

149149
void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
150150
Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
@@ -230,7 +230,7 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {
230230

231231
data_section_item_alignment = relocInfo::addr_unit();
232232

233-
_should_notify_object_alloc = &JvmtiExport::_should_notify_object_alloc;
233+
JVMTI_ONLY( _should_notify_object_alloc = &JvmtiExport::_should_notify_object_alloc; )
234234

235235
BarrierSet* bs = BarrierSet::barrier_set();
236236
if (bs->is_a(BarrierSet::CardTableBarrierSet)) {

src/hotspot/share/jvmci/vmStructs_jvmci.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
\
139139
static_field(CompilerToVM::Data, data_section_item_alignment, int) \
140140
\
141-
static_field(CompilerToVM::Data, _should_notify_object_alloc, int*) \
141+
JVMTI_ONLY(static_field(CompilerToVM::Data, _should_notify_object_alloc, int*)) \
142142
\
143143
static_field(Abstract_VM_Version, _features, uint64_t) \
144144
\

test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2023, 2024, 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
@@ -46,7 +46,7 @@
4646
* @test
4747
* @key jfr
4848
* @summary Tests Agent Loaded event by starting native and Java agents
49-
* @requires vm.hasJFR
49+
* @requires vm.hasJFR & vm.jvmti
5050
*
5151
* @library /test/lib
5252
* @modules java.instrument

0 commit comments

Comments
 (0)