< prev index next >
src/hotspot/share/asm/codeBuffer.cpp
Print this page
rev 54763 : 8213084: Rework and enhance Print[Opto]Assembly output
Reviewed-by:
*** 83,93 ****
typedef CodeBuffer::csize_t csize_t; // file-local definition
// External buffer, in a predefined CodeBlob.
// Important: The code_start must be taken exactly, and not realigned.
CodeBuffer::CodeBuffer(CodeBlob* blob) {
! initialize_misc("static buffer");
initialize(blob->content_begin(), blob->content_size());
verify_section_allocation();
}
void CodeBuffer::initialize(csize_t code_size, csize_t locs_size) {
--- 83,94 ----
typedef CodeBuffer::csize_t csize_t; // file-local definition
// External buffer, in a predefined CodeBlob.
// Important: The code_start must be taken exactly, and not realigned.
CodeBuffer::CodeBuffer(CodeBlob* blob) {
! // Provide code buffer with meaningful name
! initialize_misc(blob->name());
initialize(blob->content_begin(), blob->content_size());
verify_section_allocation();
}
void CodeBuffer::initialize(csize_t code_size, csize_t locs_size) {
*** 1032,1042 ****
--- 1033,1045 ----
void CodeSection::decode() {
Disassembler::decode(start(), end());
}
void CodeBuffer::block_comment(intptr_t offset, const char * comment) {
+ if (_collect_comments) {
_code_strings.add_comment(offset, comment);
+ }
}
const char* CodeBuffer::code_string(const char* str) {
return _code_strings.add_string(str);
}
*** 1145,1163 ****
}
}
const char* CodeStrings::_prefix = " ;; "; // default: can be changed via set_prefix
void CodeStrings::print_block_comment(outputStream* stream, intptr_t offset) const {
check_valid();
if (_strings != NULL) {
CodeString* c = find(offset);
while (c && c->offset() == offset) {
stream->bol();
stream->print("%s", _prefix);
// Don't interpret as format strings since it could contain %
! stream->print_raw_cr(c->string());
c = c->next_comment();
}
}
}
--- 1148,1174 ----
}
}
const char* CodeStrings::_prefix = " ;; "; // default: can be changed via set_prefix
+ // Check if any block comments are pending for the given offset.
+ bool CodeStrings::has_block_comment(intptr_t offset) const {
+ if (_strings == NULL) return false;
+ CodeString* c = find(offset);
+ return c != NULL;
+ }
+
void CodeStrings::print_block_comment(outputStream* stream, intptr_t offset) const {
check_valid();
if (_strings != NULL) {
CodeString* c = find(offset);
while (c && c->offset() == offset) {
stream->bol();
stream->print("%s", _prefix);
// Don't interpret as format strings since it could contain %
! stream->print_raw(c->string());
! stream->bol(); // advance to next line only if string didn't contain a cr() at the end.
c = c->next_comment();
}
}
}
*** 1183,1193 ****
return s->string();
}
void CodeBuffer::decode() {
ttyLocker ttyl;
! Disassembler::decode(decode_begin(), insts_end());
_decode_begin = insts_end();
}
void CodeSection::print(const char* name) {
csize_t locs_size = locs_end() - locs_start();
--- 1194,1204 ----
return s->string();
}
void CodeBuffer::decode() {
ttyLocker ttyl;
! Disassembler::decode(decode_begin(), insts_end(), tty);
_decode_begin = insts_end();
}
void CodeSection::print(const char* name) {
csize_t locs_size = locs_end() - locs_start();
*** 1214,1219 ****
--- 1225,1236 ----
CodeSection* cs = code_section(n);
cs->print(code_section_name(n));
}
}
+ // Directly disassemble code buffer.
+ void CodeBuffer::decode(address start, address end) {
+ ttyLocker ttyl;
+ Disassembler::decode(this, start, end, tty);
+ }
+
#endif // PRODUCT
< prev index next >