Skip to content

Commit

Permalink
8335921: Fix HotSpot VM build without JVMTI
Browse files Browse the repository at this point in the history
  • Loading branch information
vnkozlov committed Jul 17, 2024
1 parent 69baa7d commit 29888ba
Show file tree
Hide file tree
Showing 8 changed files with 20 additions and 13 deletions.
2 changes: 1 addition & 1 deletion make/hotspot/lib/JvmFeatures.gmk
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ ifneq ($(call check-jvm-feature, jvmti), true)
jvmtiImpl.cpp jvmtiManageCapabilities.cpp jvmtiRawMonitor.cpp jvmtiUtil.cpp jvmtiTrace.cpp \
jvmtiCodeBlobEvents.cpp jvmtiEnv.cpp jvmtiRedefineClasses.cpp jvmtiEnvBase.cpp jvmtiEnvThreadState.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

ifneq ($(call check-jvm-feature, jvmci), true)
Expand Down
8 changes: 4 additions & 4 deletions src/hotspot/share/jfr/instrumentation/jfrJvmtiAgent.hpp
Original file line number Diff line number Diff line change
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -32,10 +32,10 @@ class JfrJvmtiAgent : public JfrCHeapObj {
private:
JfrJvmtiAgent();
~JfrJvmtiAgent();
static bool create();
static void destroy();
static bool create() NOT_JVMTI_RETURN_(true);
static void destroy() NOT_JVMTI_RETURN;
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
7 changes: 6 additions & 1 deletion src/hotspot/share/jfr/periodic/jfrPeriodic.cpp
Original file line number Diff line number Diff line change
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -280,6 +280,7 @@ TRACE_REQUEST_FUNC(SystemProcess) {
}
}

#if INCLUDE_JVMTI
template <typename AgentEvent>
static void send_agent_event(AgentEvent& event, const JvmtiAgent* agent) {
event.set_name(agent->name());
Expand Down Expand Up @@ -316,6 +317,10 @@ TRACE_REQUEST_FUNC(NativeAgent) {
const JvmtiAgentList::Iterator xrun_agents_it = JvmtiAgentList::xrun_agents();
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) {
double rate = 0.0;
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jfr/recorder/jfrRecorder.cpp
Original file line number Diff line number Diff line change
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -238,7 +238,7 @@ bool JfrRecorder::on_create_vm_2() {
}

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());
}

Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/share/jvmci/jvmciCompilerToVM.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,14 @@ class CompilerToVM {
// Minimum alignment of an offset into CodeBuffer::SECT_CONSTS
static int data_section_item_alignment;

#if INCLUDE_JVMTI
/*
* Pointer to JvmtiExport::_should_notify_object_alloc.
* Exposed as an int* instead of an address so the
* underlying type is part of the JVMCIVMStructs definition.
*/
static int* _should_notify_object_alloc;
#endif

public:
static void initialize(JVMCI_TRAPS);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/share/jvmci/jvmciCompilerToVMInit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ address CompilerToVM::Data::symbol_clinit;

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) {
Klass_vtable_start_offset = in_bytes(Klass::vtable_start_offset());
Expand Down Expand Up @@ -230,7 +230,7 @@ void CompilerToVM::Data::initialize(JVMCI_TRAPS) {

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();
if (bs->is_a(BarrierSet::CardTableBarrierSet)) {
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/jvmci/vmStructs_jvmci.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@
\
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) \
\
Expand Down
4 changes: 2 additions & 2 deletions test/jdk/jdk/jfr/event/runtime/TestAgentEvent.java
Original file line number Diff line number Diff line change
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -46,7 +46,7 @@
* @test
* @key jfr
* @summary Tests Agent Loaded event by starting native and Java agents
* @requires vm.hasJFR
* @requires vm.hasJFR & vm.jvmti
*
* @library /test/lib
* @modules java.instrument
Expand Down

0 comments on commit 29888ba

Please sign in to comment.