1098 "), cause(" INTPTR_FORMAT ")", |
1098 "), cause(" INTPTR_FORMAT ")", |
1099 this, (address)_method, (address)cause); |
1099 this, (address)_method, (address)cause); |
1100 if (!Universe::heap()->is_gc_active()) |
1100 if (!Universe::heap()->is_gc_active()) |
1101 cause->klass()->print(); |
1101 cause->klass()->print(); |
1102 } |
1102 } |
|
1103 // Unlink the osr method, so we do not look this up again |
|
1104 if (is_osr_method()) { |
|
1105 invalidate_osr_method(); |
|
1106 } |
1103 // If _method is already NULL the methodOop is about to be unloaded, |
1107 // If _method is already NULL the methodOop is about to be unloaded, |
1104 // so we don't have to break the cycle. Note that it is possible to |
1108 // so we don't have to break the cycle. Note that it is possible to |
1105 // have the methodOop live here, in case we unload the nmethod because |
1109 // have the methodOop live here, in case we unload the nmethod because |
1106 // it is pointing to some oop (other than the methodOop) being unloaded. |
1110 // it is pointing to some oop (other than the methodOop) being unloaded. |
1107 if (_method != NULL) { |
1111 if (_method != NULL) { |
1168 // They never become zombie/non-entrant, so the nmethod sweeper will never remove |
1172 // They never become zombie/non-entrant, so the nmethod sweeper will never remove |
1169 // them. Instead the entry_bci is set to InvalidOSREntryBci, so the osr nmethod |
1173 // them. Instead the entry_bci is set to InvalidOSREntryBci, so the osr nmethod |
1170 // will never be used anymore. That the nmethods only gets removed when class unloading |
1174 // will never be used anymore. That the nmethods only gets removed when class unloading |
1171 // happens, make life much simpler, since the nmethods are not just going to disappear |
1175 // happens, make life much simpler, since the nmethods are not just going to disappear |
1172 // out of the blue. |
1176 // out of the blue. |
1173 if (is_osr_only_method()) { |
1177 if (is_osr_method()) { |
1174 if (osr_entry_bci() != InvalidOSREntryBci) { |
1178 if (osr_entry_bci() != InvalidOSREntryBci) { |
1175 // only log this once |
1179 // only log this once |
1176 log_state_change(state); |
1180 log_state_change(state); |
1177 } |
1181 } |
1178 invalidate_osr_method(); |
1182 invalidate_osr_method(); |
1547 } |
1551 } |
1548 } |
1552 } |
1549 #endif // !PRODUCT |
1553 #endif // !PRODUCT |
1550 } |
1554 } |
1551 |
1555 |
|
1556 // This method is called twice during GC -- once while |
|
1557 // tracing the "active" nmethods on thread stacks during |
|
1558 // the (strong) marking phase, and then again when walking |
|
1559 // the code cache contents during the weak roots processing |
|
1560 // phase. The two uses are distinguished by means of the |
|
1561 // do_nmethods() method in the closure "f" below -- which |
|
1562 // answers "yes" in the first case, and "no" in the second |
|
1563 // case. We want to walk the weak roots in the nmethod |
|
1564 // only in the second case. The weak roots in the nmethod |
|
1565 // are the oops in the ExceptionCache and the InlineCache |
|
1566 // oops. |
1552 void nmethod::oops_do(OopClosure* f) { |
1567 void nmethod::oops_do(OopClosure* f) { |
1553 // make sure the oops ready to receive visitors |
1568 // make sure the oops ready to receive visitors |
1554 assert(!is_zombie() && !is_unloaded(), |
1569 assert(!is_zombie() && !is_unloaded(), |
1555 "should not call follow on zombie or unloaded nmethod"); |
1570 "should not call follow on zombie or unloaded nmethod"); |
1556 |
1571 |
1565 // (See comment above.) |
1580 // (See comment above.) |
1566 } |
1581 } |
1567 |
1582 |
1568 // Compiled code |
1583 // Compiled code |
1569 f->do_oop((oop*) &_method); |
1584 f->do_oop((oop*) &_method); |
1570 ExceptionCache* ec = exception_cache(); |
1585 if (!f->do_nmethods()) { |
1571 while(ec != NULL) { |
1586 // weak roots processing phase -- update ExceptionCache oops |
1572 f->do_oop((oop*)ec->exception_type_addr()); |
1587 ExceptionCache* ec = exception_cache(); |
1573 ec = ec->next(); |
1588 while(ec != NULL) { |
1574 } |
1589 f->do_oop((oop*)ec->exception_type_addr()); |
|
1590 ec = ec->next(); |
|
1591 } |
|
1592 } // Else strong roots phase -- skip oops in ExceptionCache |
1575 |
1593 |
1576 RelocIterator iter(this, low_boundary); |
1594 RelocIterator iter(this, low_boundary); |
|
1595 |
1577 while (iter.next()) { |
1596 while (iter.next()) { |
1578 if (iter.type() == relocInfo::oop_type ) { |
1597 if (iter.type() == relocInfo::oop_type ) { |
1579 oop_Relocation* r = iter.oop_reloc(); |
1598 oop_Relocation* r = iter.oop_reloc(); |
1580 // In this loop, we must only follow those oops directly embedded in |
1599 // In this loop, we must only follow those oops directly embedded in |
1581 // the code. Other oops (oop_index>0) are seen as part of scopes_oops. |
1600 // the code. Other oops (oop_index>0) are seen as part of scopes_oops. |
1582 assert(1 == (r->oop_is_immediate()) + (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()), "oop must be found in exactly one place"); |
1601 assert(1 == (r->oop_is_immediate()) + |
|
1602 (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()), |
|
1603 "oop must be found in exactly one place"); |
1583 if (r->oop_is_immediate() && r->oop_value() != NULL) { |
1604 if (r->oop_is_immediate() && r->oop_value() != NULL) { |
1584 f->do_oop(r->oop_addr()); |
1605 f->do_oop(r->oop_addr()); |
1585 } |
1606 } |
1586 } |
1607 } |
1587 } |
1608 } |