< prev index next > src/hotspot/share/asm/codeBuffer.cpp
Print this page
#include "code/compiledIC.hpp"
#include "code/oopRecorder.inline.hpp"
#include "compiler/disassembler.hpp"
#include "logging/log.hpp"
#include "oops/klass.inline.hpp"
+ #include "oops/methodCounters.hpp"
#include "oops/methodData.hpp"
#include "oops/oop.inline.hpp"
#include "runtime/icache.hpp"
#include "runtime/safepointVerifiers.hpp"
#include "utilities/align.hpp"
Metadata* m = md->metadata_value();
if (oop_recorder()->is_real(m)) {
if (m->is_methodData()) {
m = ((MethodData*)m)->method();
}
+ if (m->is_methodCounters()) {
+ m = ((MethodCounters*)m)->method();
+ }
if (m->is_method()) {
m = ((Method*)m)->method_holder();
}
if (m->is_klass()) {
append_oop_references(&oops, (Klass*)m);
Metadata* m = oop_recorder()->metadata_at(i);
if (oop_recorder()->is_real(m)) {
if (m->is_methodData()) {
m = ((MethodData*)m)->method();
}
+ if (m->is_methodCounters()) {
+ m = ((MethodCounters*)m)->method();
+ }
if (m->is_method()) {
m = ((Method*)m)->method_holder();
}
if (m->is_klass()) {
append_oop_references(&oops, (Klass*)m);
void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
#ifndef PRODUCT
if (PrintNMethods && (WizardMode || Verbose)) {
tty->print("done with CodeBuffer:");
! ((CodeBuffer*)this)->print();
}
#endif //PRODUCT
CodeBuffer dest(dest_blob);
assert(dest_blob->content_size() >= total_content_size(), "good sizing");
void CodeBuffer::copy_code_to(CodeBlob* dest_blob) {
#ifndef PRODUCT
if (PrintNMethods && (WizardMode || Verbose)) {
tty->print("done with CodeBuffer:");
! ((CodeBuffer*)this)->print_on(tty);
}
#endif //PRODUCT
CodeBuffer dest(dest_blob);
assert(dest_blob->content_size() >= total_content_size(), "good sizing");
void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
#ifndef PRODUCT
if (PrintNMethods && (WizardMode || Verbose)) {
tty->print("expanding CodeBuffer:");
! this->print();
}
if (StressCodeBuffers && blob() != nullptr) {
static int expand_count = 0;
if (expand_count >= 0) expand_count += 1;
void CodeBuffer::expand(CodeSection* which_cs, csize_t amount) {
#ifndef PRODUCT
if (PrintNMethods && (WizardMode || Verbose)) {
tty->print("expanding CodeBuffer:");
! this->print_on(tty);
}
if (StressCodeBuffers && blob() != nullptr) {
static int expand_count = 0;
if (expand_count >= 0) expand_count += 1;
#ifndef PRODUCT
_decode_begin = nullptr; // sanity
if (PrintNMethods && (WizardMode || Verbose)) {
tty->print("expanded CodeBuffer:");
! this->print();
}
#endif //PRODUCT
}
void CodeBuffer::adjust_internal_address(address from, address to) {
#ifndef PRODUCT
_decode_begin = nullptr; // sanity
if (PrintNMethods && (WizardMode || Verbose)) {
tty->print("expanded CodeBuffer:");
! this->print_on(tty);
}
#endif //PRODUCT
}
void CodeBuffer::adjust_internal_address(address from, address to) {
if (!other->is_allocated() || other == sect) {
continue;
}
guarantee(other->disjoint(sect), "sanity");
}
! guarantee(sect->end() <= tend, "sanity");
! guarantee(sect->end() <= sect->limit(), "sanity");
}
}
void CodeBuffer::log_section_sizes(const char* name) {
if (xtty != nullptr) {
ttyLocker ttyl;
// log info about buffer usage
! xtty->print_cr("<blob name='%s' total_size='%d'>", name, _total_size);
for (int n = (int) CodeBuffer::SECT_FIRST; n < (int) CodeBuffer::SECT_LIMIT; n++) {
CodeSection* sect = code_section(n);
if (!sect->is_allocated() || sect->is_empty()) continue;
! xtty->print_cr("<sect index='%d' capacity='%d' size='%d' remaining='%d'/>",
! n, sect->capacity(), sect->size(), sect->remaining());
}
! xtty->print_cr("</blob>");
}
}
bool CodeBuffer::finalize_stubs() {
if (_finalize_stubs && !pd_finalize_stubs()) {
if (!other->is_allocated() || other == sect) {
continue;
}
guarantee(other->disjoint(sect), "sanity");
}
! guarantee(sect->end() <= tend, "sanity, sect_end: " PTR_FORMAT " tend: " PTR_FORMAT " size: %d", p2i(sect->end()), p2i(tend), (int)_total_size);
! guarantee(sect->end() <= sect->limit(), "sanity, sect_end: " PTR_FORMAT " sect_limit: " PTR_FORMAT, p2i(sect->end()), p2i(sect->limit()));
}
}
void CodeBuffer::log_section_sizes(const char* name) {
if (xtty != nullptr) {
ttyLocker ttyl;
// log info about buffer usage
! xtty->head("blob name='%s' total_size='%d'", name, _total_size);
for (int n = (int) CodeBuffer::SECT_FIRST; n < (int) CodeBuffer::SECT_LIMIT; n++) {
CodeSection* sect = code_section(n);
if (!sect->is_allocated() || sect->is_empty()) continue;
! xtty->elem("sect index='%d' capacity='%d' size='%d' remaining='%d'",
! n, sect->capacity(), sect->size(), sect->remaining());
}
! xtty->tail("blob");
}
}
bool CodeBuffer::finalize_stubs() {
if (_finalize_stubs && !pd_finalize_stubs()) {
ttyLocker ttyl;
Disassembler::decode(decode_begin(), insts_end(), tty NOT_PRODUCT(COMMA &asm_remarks()));
_decode_begin = insts_end();
}
! void CodeSection::print(const char* name) {
csize_t locs_size = locs_end() - locs_start();
! tty->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)",
! name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity());
! tty->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
! name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
if (PrintRelocations && (locs_size != 0)) {
RelocIterator iter(this);
! iter.print();
}
}
! void CodeBuffer::print() {
! tty->print_cr("CodeBuffer:");
for (int n = 0; n < (int)SECT_LIMIT; n++) {
// print each section
CodeSection* cs = code_section(n);
! cs->print(code_section_name(n));
}
}
// ----- CHeapString -----------------------------------------------------------
ttyLocker ttyl;
Disassembler::decode(decode_begin(), insts_end(), tty NOT_PRODUCT(COMMA &asm_remarks()));
_decode_begin = insts_end();
}
! void CodeSection::print_on(outputStream* st, const char* name) {
csize_t locs_size = locs_end() - locs_start();
! st->print_cr(" %7s.code = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d)",
! name, p2i(start()), p2i(end()), p2i(limit()), size(), capacity());
! st->print_cr(" %7s.locs = " PTR_FORMAT " : " PTR_FORMAT " : " PTR_FORMAT " (%d of %d) point=%d",
! name, p2i(locs_start()), p2i(locs_end()), p2i(locs_limit()), locs_size, locs_capacity(), locs_point_off());
if (PrintRelocations && (locs_size != 0)) {
RelocIterator iter(this);
! iter.print_on(st);
}
}
! void CodeBuffer::print_on(outputStream* st) {
! #if 0
+ if (this == nullptr) { // gcc complains 'nonnull' argument 'this' compared to NULL
+ st->print_cr("null CodeBuffer pointer");
+ return;
+ }
+ #endif
+
+ st->print_cr("CodeBuffer:%s", name());
for (int n = 0; n < (int)SECT_LIMIT; n++) {
// print each section
CodeSection* cs = code_section(n);
! cs->print_on(st, code_section_name(n));
}
}
// ----- CHeapString -----------------------------------------------------------
< prev index next >