Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/hotspot/share/asm/codeBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1041,6 +1041,16 @@ void CodeBuffer::shared_stub_to_interp_for(ciMethod* callee, csize_t call_offset
}

#ifndef PRODUCT
bool CodeBuffer::collect_comments() {
return ( PrintAssembly
|| PrintStubCode
|| PrintMethodHandleStubs
|| PrintInterpreter
|| PrintSignatureHandlers
|| (UnlockDiagnosticVMOptions && !AOTCodeCache::maybe_dumping_code())
);
}

void CodeBuffer::block_comment(ptrdiff_t offset, const char* comment) {
if (insts()->scratch_emit()) {
return;
Expand Down
9 changes: 2 additions & 7 deletions src/hotspot/share/asm/codeBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,7 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
bool _collect_comments; // Indicate if we need to collect block comments at all.
address _decode_begin; // start address for decode
address decode_begin();
static bool collect_comments();
#endif

void initialize_misc(const char * name) {
Expand Down Expand Up @@ -608,13 +609,7 @@ class CodeBuffer: public StackObj DEBUG_ONLY(COMMA private Scrubber) {
#ifndef PRODUCT
_decode_begin = nullptr;
// Collect block comments, but restrict collection to cases where a disassembly is output.
_collect_comments = ( PrintAssembly
|| PrintStubCode
|| PrintMethodHandleStubs
|| PrintInterpreter
|| PrintSignatureHandlers
|| UnlockDiagnosticVMOptions
);
_collect_comments = collect_comments();
#endif
}

Expand Down
8 changes: 7 additions & 1 deletion src/hotspot/share/code/aotCodeCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ bool AOTCodeCache::is_caching_enabled() {
return AOTStubCaching || AOTAdapterCaching;
}

// This is used before AOTCodeCahe is initialized
// but after AOT (CDS) Cache flags consistency is checked.
bool AOTCodeCache::maybe_dumping_code() {
return is_caching_enabled() && CDSConfig::is_dumping_final_static_archive();
}

static uint32_t encode_id(AOTCodeEntry::Kind kind, int id) {
assert(AOTCodeEntry::is_valid_entry_kind(kind), "invalid AOTCodeEntry kind %d", (int)kind);
// There can be a conflict of id between an Adapter and *Blob, but that should not cause any functional issue
Expand Down Expand Up @@ -2184,7 +2190,7 @@ void AOTCodeAddressTable::set_stubgen_stubs_complete() {
#ifdef PRODUCT
#define MAX_STR_COUNT 200
#else
#define MAX_STR_COUNT 500
#define MAX_STR_COUNT 2000
#endif
#define _c_str_max MAX_STR_COUNT
static const int _c_str_base = _all_max;
Expand Down
3 changes: 3 additions & 0 deletions src/hotspot/share/code/aotCodeCache.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,9 @@ class AOTCodeCache : public CHeapObj<mtCode> {
static void disable_caching() NOT_CDS_RETURN;
static bool is_caching_enabled() NOT_CDS_RETURN_(false);

// It is used before AOTCodeCache is initialized.
static bool maybe_dumping_code() NOT_CDS_RETURN_(false);

static const char* add_C_string(const char* str) NOT_CDS_RETURN_(str);

static void print_on(outputStream* st) NOT_CDS_RETURN;
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/share/code/codeBlob.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ class CodeBlob {
nmethod* as_nmethod() const { assert(is_nmethod(), "must be nmethod"); return (nmethod*) this; }
CodeBlob* as_codeblob() const { return (CodeBlob*) this; }
// we may want to force an actual buffer blob or subtype instance
BufferBlob* as_buffer_blob(bool strict = true) const { assert(is_buffer_blob(), "must be %sbuffer blob", (strict ? "strict " : "")); return (BufferBlob*) this; }
BufferBlob* as_buffer_blob(bool strict = true) const { assert(is_buffer_blob(strict), "must be %sbuffer blob", (strict ? "strict " : "")); return (BufferBlob*) this; }
AdapterBlob* as_adapter_blob() const { assert(is_adapter_blob(), "must be adapter blob"); return (AdapterBlob*) this; }
ExceptionBlob* as_exception_blob() const { assert(is_exception_stub(), "must be exception stub"); return (ExceptionBlob*) this; }
// this will always return a subtype instance
Expand Down