Skip to content

Commit f67847f

Browse files
committed
8267396: Avoid recording "pc" in unhandled oops detector for better performance
Reviewed-by: coleenp, dholmes
1 parent 878d1b3 commit f67847f

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

src/hotspot/share/oops/oopsHierarchy.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ void oop::register_oop() {
3636
// This gets expensive, which is why checking unhandled oops is on a switch.
3737
Thread* t = Thread::current_or_null();
3838
if (t != NULL && t->is_Java_thread()) {
39-
frame fr = os::current_frame();
40-
t->unhandled_oops()->register_unhandled_oop(this, fr.pc());
39+
t->unhandled_oops()->register_unhandled_oop(this);
4140
}
4241
}
4342

src/hotspot/share/runtime/unhandledOops.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ void UnhandledOops::dump_oops(UnhandledOops *list) {
5757
// You don't want to turn it on in compiled code here.
5858
static Thread* unhandled_oop_print = NULL;
5959

60-
void UnhandledOops::register_unhandled_oop(oop* op, address pc) {
60+
void UnhandledOops::register_unhandled_oop(oop* op) {
6161
if (!_thread->is_in_live_stack((address)op)) {
6262
return;
6363
}
@@ -67,7 +67,7 @@ void UnhandledOops::register_unhandled_oop(oop* op, address pc) {
6767
for (int i=0; i < _level; i++) tty->print(" ");
6868
tty->print_cr("r " INTPTR_FORMAT, p2i(op));
6969
}
70-
UnhandledOopEntry entry(op, pc);
70+
UnhandledOopEntry entry(op);
7171
_oop_list->push(entry);
7272
}
7373

@@ -120,8 +120,7 @@ void UnhandledOops::clear_unhandled_oops() {
120120
// in the unhandled oop generator.
121121
if (!_thread->is_in_live_stack((address)entry._oop_ptr)) {
122122
tty->print_cr("oop_ptr is " INTPTR_FORMAT, p2i(entry._oop_ptr));
123-
tty->print_cr("thread is " INTPTR_FORMAT " from pc " INTPTR_FORMAT,
124-
p2i(_thread), p2i(entry._pc));
123+
tty->print_cr("thread is " INTPTR_FORMAT, p2i(_thread));
125124
assert(false, "heap is corrupted by the unhandled oop detector");
126125
}
127126
// Set unhandled oops to a pattern that will crash distinctively

src/hotspot/share/runtime/unhandledOops.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,11 @@ class UnhandledOopEntry : public CHeapObj<mtThread> {
5353
private:
5454
oop* _oop_ptr;
5555
bool _ok_for_gc;
56-
address _pc;
5756
public:
5857
oop* oop_ptr() { return _oop_ptr; }
59-
UnhandledOopEntry() : _oop_ptr(NULL), _ok_for_gc(false), _pc(NULL) {}
60-
UnhandledOopEntry(oop* op, address pc) :
61-
_oop_ptr(op), _ok_for_gc(false), _pc(pc) {}
58+
UnhandledOopEntry() : _oop_ptr(NULL), _ok_for_gc(false) {}
59+
UnhandledOopEntry(oop* op) :
60+
_oop_ptr(op), _ok_for_gc(false) {}
6261
};
6362

6463

@@ -75,7 +74,7 @@ class UnhandledOops : public CHeapObj<mtThread> {
7574

7675
public:
7776
static void dump_oops(UnhandledOops* list);
78-
void register_unhandled_oop(oop* op, address pc);
77+
void register_unhandled_oop(oop* op);
7978
void unregister_unhandled_oop(oop* op);
8079
};
8180

0 commit comments

Comments
 (0)