< prev index next >
src/hotspot/share/compiler/oopMap.cpp
Print this page
rev 54542 : 8213084: Rework and enhance Print[Opto]Assembly output
Reviewed-by:
*** 1,7 ****
/*
! * Copyright (c) 1998, 2018, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
--- 1,7 ----
/*
! * Copyright (c) 1998, 2019, 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*** 508,561 ****
st->print(" ");
}
void ImmutableOopMap::print_on(outputStream* st) const {
OopMapValue omv;
! st->print("ImmutableOopMap{");
for(OopMapStream oms(this); !oms.is_done(); oms.next()) {
omv = oms.current();
omv.print_on(st);
}
st->print("}");
}
void OopMap::print_on(outputStream* st) const {
OopMapValue omv;
! st->print("OopMap{");
for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
omv = oms.current();
omv.print_on(st);
}
! st->print("off=%d}", (int) offset());
}
void ImmutableOopMapSet::print_on(outputStream* st) const {
const ImmutableOopMap* last = NULL;
! for (int i = 0; i < _count; ++i) {
const ImmutableOopMapPair* pair = pair_at(i);
const ImmutableOopMap* map = pair->get_from(this);
if (map != last) {
st->cr();
map->print_on(st);
! st->print("pc offsets: ");
}
last = map;
st->print("%d ", pair->pc_offset());
}
}
void OopMapSet::print_on(outputStream* st) const {
! int i, len = om_count();
! st->print_cr("OopMapSet contains %d OopMaps\n",len);
! for( i = 0; i < len; i++) {
OopMap* m = at(i);
st->print_cr("#%d ",i);
m->print_on(st);
st->cr();
}
}
bool OopMap::equals(const OopMap* other) const {
if (other->_omv_count != _omv_count) {
return false;
--- 508,568 ----
st->print(" ");
}
void ImmutableOopMap::print_on(outputStream* st) const {
OopMapValue omv;
! st->print("ImmutableOopMap {");
for(OopMapStream oms(this); !oms.is_done(); oms.next()) {
omv = oms.current();
omv.print_on(st);
}
st->print("}");
}
void OopMap::print_on(outputStream* st) const {
OopMapValue omv;
! st->print("OopMap {");
for(OopMapStream oms((OopMap*)this); !oms.is_done(); oms.next()) {
omv = oms.current();
omv.print_on(st);
}
! // Print hex offset in addition.
! st->print("off=%d/0x%x}", (int) offset(), (int) offset());
}
void ImmutableOopMapSet::print_on(outputStream* st) const {
const ImmutableOopMap* last = NULL;
! const int len = count();
!
! st->print_cr("ImmutableOopMapSet contains %d OopMaps", len);
!
! for (int i = 0; i < len; i++) {
const ImmutableOopMapPair* pair = pair_at(i);
const ImmutableOopMap* map = pair->get_from(this);
if (map != last) {
st->cr();
map->print_on(st);
! st->print(" pc offsets: ");
}
last = map;
st->print("%d ", pair->pc_offset());
}
+ st->cr();
}
void OopMapSet::print_on(outputStream* st) const {
! const int len = om_count();
! st->print_cr("OopMapSet contains %d OopMaps", len);
! for(int i = 0; i < len; i++) {
OopMap* m = at(i);
st->print_cr("#%d ",i);
m->print_on(st);
st->cr();
}
+ st->cr();
}
bool OopMap::equals(const OopMap* other) const {
if (other->_omv_count != _omv_count) {
return false;
*** 569,587 ****
return true;
}
const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
ImmutableOopMapPair* pairs = get_pairs();
! int i;
! for (i = 0; i < _count; ++i) {
if (pairs[i].pc_offset() >= pc_offset) {
break;
}
}
- ImmutableOopMapPair* last = &pairs[i];
assert(last->pc_offset() == pc_offset, "oopmap not found");
return last->get_from(this);
}
const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const {
--- 576,596 ----
return true;
}
const ImmutableOopMap* ImmutableOopMapSet::find_map_at_offset(int pc_offset) const {
ImmutableOopMapPair* pairs = get_pairs();
+ ImmutableOopMapPair* last = NULL;
! for (int i = 0; i < _count; ++i) {
if (pairs[i].pc_offset() >= pc_offset) {
+ last = &pairs[i];
break;
}
}
+ // Heal Coverity issue: potential index out of bounds access.
+ guarantee(last != NULL, "last may not be null");
assert(last->pc_offset() == pc_offset, "oopmap not found");
return last->get_from(this);
}
const ImmutableOopMap* ImmutableOopMapPair::get_from(const ImmutableOopMapSet* set) const {
< prev index next >