8289780: Avoid formatting stub names when Forte is not enabled
Reviewed-by: dholmes, coleenp, sspitsyn
This commit is contained in:
parent
54b4576f78
commit
3c08e6b311
@ -195,7 +195,9 @@ void RuntimeBlob::trace_new_stub(RuntimeBlob* stub, const char* name1, const cha
|
||||
// Do not hold the CodeCache lock during name formatting.
|
||||
assert(!CodeCache_lock->owned_by_self(), "release CodeCache before registering the stub");
|
||||
|
||||
if (stub != NULL) {
|
||||
if (stub != NULL && (PrintStubCode ||
|
||||
Forte::is_enabled() ||
|
||||
JvmtiExport::should_post_dynamic_code_generated())) {
|
||||
char stub_id[256];
|
||||
assert(strlen(name1) + strlen(name2) < sizeof(stub_id), "");
|
||||
jio_snprintf(stub_id, sizeof(stub_id), "%s%s", name1, name2);
|
||||
@ -212,7 +214,9 @@ void RuntimeBlob::trace_new_stub(RuntimeBlob* stub, const char* name1, const cha
|
||||
tty->print_cr("- - - [END] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -");
|
||||
tty->cr();
|
||||
}
|
||||
Forte::register_stub(stub_id, stub->code_begin(), stub->code_end());
|
||||
if (Forte::is_enabled()) {
|
||||
Forte::register_stub(stub_id, stub->code_begin(), stub->code_end());
|
||||
}
|
||||
|
||||
if (JvmtiExport::should_post_dynamic_code_generated()) {
|
||||
const char* stub_name = name2;
|
||||
|
@ -41,7 +41,6 @@
|
||||
#include "oops/methodData.hpp"
|
||||
#include "oops/method.inline.hpp"
|
||||
#include "oops/oop.inline.hpp"
|
||||
#include "prims/forte.hpp"
|
||||
#include "prims/jvmtiExport.hpp"
|
||||
#include "prims/methodHandles.hpp"
|
||||
#include "runtime/handles.inline.hpp"
|
||||
|
@ -71,8 +71,6 @@ enum {
|
||||
// Native interfaces for use by Forte tools.
|
||||
|
||||
|
||||
#if !defined(IA64)
|
||||
|
||||
class vframeStreamForte : public vframeStreamCommon {
|
||||
public:
|
||||
// constructor that starts with sender of frame fr (top_frame)
|
||||
@ -673,6 +671,7 @@ void AsyncGetCallTrace(ASGCT_CallTrace *trace, jint depth, void* ucontext) {
|
||||
// XXXDARWIN: Link errors occur even when __attribute__((weak_import))
|
||||
// is added
|
||||
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) ((void) 0)
|
||||
#define collector_func_load_enabled() false
|
||||
#else
|
||||
void collector_func_load(char* name,
|
||||
void* null_argument_1,
|
||||
@ -684,20 +683,28 @@ void collector_func_load(char* name,
|
||||
#pragma weak collector_func_load
|
||||
#define collector_func_load(x0,x1,x2,x3,x4,x5,x6) \
|
||||
( collector_func_load ? collector_func_load(x0,x1,x2,x3,x4,x5,x6),(void)0 : (void)0 )
|
||||
#define collector_func_load_enabled() (collector_func_load ? true : false)
|
||||
#endif // __APPLE__
|
||||
#endif // !_WINDOWS
|
||||
|
||||
} // end extern "C"
|
||||
#endif // !IA64
|
||||
|
||||
bool Forte::is_enabled() {
|
||||
#if !defined(_WINDOWS)
|
||||
return collector_func_load_enabled();
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Forte::register_stub(const char* name, address start, address end) {
|
||||
#if !defined(_WINDOWS) && !defined(IA64)
|
||||
#if !defined(_WINDOWS)
|
||||
assert(pointer_delta(end, start, sizeof(jbyte)) < INT_MAX,
|
||||
"Code size exceeds maximum range");
|
||||
|
||||
collector_func_load((char*)name, NULL, NULL, start,
|
||||
pointer_delta(end, start, sizeof(jbyte)), 0, NULL);
|
||||
#endif // !_WINDOWS && !IA64
|
||||
#endif // !_WINDOWS
|
||||
}
|
||||
|
||||
#else // INCLUDE_JVMTI
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2004, 2022, 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
|
||||
@ -29,6 +29,7 @@
|
||||
|
||||
class Forte : AllStatic {
|
||||
public:
|
||||
static bool is_enabled() NOT_JVMTI_RETURN_(false);
|
||||
static void register_stub(const char* name, address start, address end)
|
||||
NOT_JVMTI_RETURN;
|
||||
// register internal VM stub
|
||||
|
@ -2713,16 +2713,20 @@ extern "C" void unexpected_adapter_call() {
|
||||
}
|
||||
|
||||
static void post_adapter_creation(const AdapterBlob* new_adapter, const AdapterHandlerEntry* entry) {
|
||||
char blob_id[256];
|
||||
jio_snprintf(blob_id,
|
||||
sizeof(blob_id),
|
||||
"%s(%s)",
|
||||
new_adapter->name(),
|
||||
entry->fingerprint()->as_string());
|
||||
Forte::register_stub(blob_id, new_adapter->content_begin(), new_adapter->content_end());
|
||||
if (Forte::is_enabled() || JvmtiExport::should_post_dynamic_code_generated()) {
|
||||
char blob_id[256];
|
||||
jio_snprintf(blob_id,
|
||||
sizeof(blob_id),
|
||||
"%s(%s)",
|
||||
new_adapter->name(),
|
||||
entry->fingerprint()->as_string());
|
||||
if (Forte::is_enabled()) {
|
||||
Forte::register_stub(blob_id, new_adapter->content_begin(), new_adapter->content_end());
|
||||
}
|
||||
|
||||
if (JvmtiExport::should_post_dynamic_code_generated()) {
|
||||
JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
|
||||
if (JvmtiExport::should_post_dynamic_code_generated()) {
|
||||
JvmtiExport::post_dynamic_code_generated(blob_id, new_adapter->content_begin(), new_adapter->content_end());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user