mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-25 22:04:51 +02:00
8213084: Rework and enhance Print[Opto]Assembly output
Reviewed-by: kvn, thartmann
This commit is contained in:
parent
6b2615be6a
commit
b730805159
44 changed files with 2784 additions and 706 deletions
|
@ -289,6 +289,7 @@ public:
|
|||
const char* add_string(const char * string) PRODUCT_RETURN_(return NULL;);
|
||||
|
||||
void add_comment(intptr_t offset, const char * comment) PRODUCT_RETURN;
|
||||
bool has_block_comment(intptr_t offset) const;
|
||||
void print_block_comment(outputStream* stream, intptr_t offset) const PRODUCT_RETURN;
|
||||
// MOVE strings from other to this; invalidate other.
|
||||
void assign(CodeStrings& other) PRODUCT_RETURN;
|
||||
|
@ -296,6 +297,7 @@ public:
|
|||
void copy(CodeStrings& other) PRODUCT_RETURN;
|
||||
// FREE strings; invalidate this.
|
||||
void free() PRODUCT_RETURN;
|
||||
|
||||
// Guarantee that _strings are used at most once; assign and free invalidate a buffer.
|
||||
inline void check_valid() const {
|
||||
#ifdef ASSERT
|
||||
|
@ -377,6 +379,7 @@ class CodeBuffer: public StackObj {
|
|||
|
||||
OopRecorder* _oop_recorder;
|
||||
CodeStrings _code_strings;
|
||||
bool _collect_comments; // Indicate if we need to collect block comments at all.
|
||||
OopRecorder _default_oop_recorder; // override with initialize_oop_recorder
|
||||
Arena* _overflow_arena;
|
||||
|
||||
|
@ -403,6 +406,14 @@ class CodeBuffer: public StackObj {
|
|||
#if INCLUDE_AOT
|
||||
_immutable_PIC = false;
|
||||
#endif
|
||||
|
||||
// Collect block comments, but restrict collection to cases where a disassembly is output.
|
||||
_collect_comments = ( PrintAssembly
|
||||
|| PrintStubCode
|
||||
|| PrintMethodHandleStubs
|
||||
|| PrintInterpreter
|
||||
|| PrintSignatureHandlers
|
||||
);
|
||||
}
|
||||
|
||||
void initialize(address code_start, csize_t code_size) {
|
||||
|
@ -604,6 +615,23 @@ class CodeBuffer: public StackObj {
|
|||
}
|
||||
}
|
||||
|
||||
// Directly disassemble code buffer.
|
||||
// Print the comment associated with offset on stream, if there is one.
|
||||
virtual void print_block_comment(outputStream* stream, address block_begin) {
|
||||
#ifndef PRODUCT
|
||||
intptr_t offset = (intptr_t)(block_begin - _total_start); // I assume total_start is not correct for all code sections.
|
||||
_code_strings.print_block_comment(stream, offset);
|
||||
#endif
|
||||
}
|
||||
bool has_block_comment(address block_begin) {
|
||||
#ifndef PRODUCT
|
||||
intptr_t offset = (intptr_t)(block_begin - _total_start); // I assume total_start is not correct for all code sections.
|
||||
return _code_strings.has_block_comment(offset);
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Code generation
|
||||
void relocate(address at, RelocationHolder const& rspec, int format = 0) {
|
||||
_insts.relocate(at, rspec, format);
|
||||
|
@ -650,7 +678,8 @@ class CodeBuffer: public StackObj {
|
|||
void decode();
|
||||
void print();
|
||||
#endif
|
||||
|
||||
// Directly disassemble code buffer.
|
||||
void decode(address start, address end);
|
||||
|
||||
// The following header contains architecture-specific implementations
|
||||
#include CPU_HEADER(codeBuffer)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue