Mercurial > hg > truffle
comparison src/share/vm/code/nmethod.cpp @ 943:b1606b3c0a8a
Merge
author | apetrusenko |
---|---|
date | Fri, 04 Sep 2009 05:31:37 -0700 |
parents | 72088be4b386 8b46c4d82093 |
children | 54b3b351d6f9 |
comparison
equal
deleted
inserted
replaced
934:aba04734b61e | 943:b1606b3c0a8a |
---|---|
1077 " unloadable], methodOop(" INTPTR_FORMAT | 1077 " unloadable], methodOop(" INTPTR_FORMAT |
1078 "), cause(" INTPTR_FORMAT ")", | 1078 "), cause(" INTPTR_FORMAT ")", |
1079 this, (address)_method, (address)cause); | 1079 this, (address)_method, (address)cause); |
1080 cause->klass()->print(); | 1080 cause->klass()->print(); |
1081 } | 1081 } |
1082 // Unlink the osr method, so we do not look this up again | |
1083 if (is_osr_method()) { | |
1084 invalidate_osr_method(); | |
1085 } | |
1082 // If _method is already NULL the methodOop is about to be unloaded, | 1086 // If _method is already NULL the methodOop is about to be unloaded, |
1083 // so we don't have to break the cycle. Note that it is possible to | 1087 // so we don't have to break the cycle. Note that it is possible to |
1084 // have the methodOop live here, in case we unload the nmethod because | 1088 // have the methodOop live here, in case we unload the nmethod because |
1085 // it is pointing to some oop (other than the methodOop) being unloaded. | 1089 // it is pointing to some oop (other than the methodOop) being unloaded. |
1086 if (_method != NULL) { | 1090 if (_method != NULL) { |
1146 // They never become zombie/non-entrant, so the nmethod sweeper will never remove | 1150 // They never become zombie/non-entrant, so the nmethod sweeper will never remove |
1147 // them. Instead the entry_bci is set to InvalidOSREntryBci, so the osr nmethod | 1151 // them. Instead the entry_bci is set to InvalidOSREntryBci, so the osr nmethod |
1148 // will never be used anymore. That the nmethods only gets removed when class unloading | 1152 // will never be used anymore. That the nmethods only gets removed when class unloading |
1149 // happens, make life much simpler, since the nmethods are not just going to disappear | 1153 // happens, make life much simpler, since the nmethods are not just going to disappear |
1150 // out of the blue. | 1154 // out of the blue. |
1151 if (is_osr_only_method()) { | 1155 if (is_osr_method()) { |
1152 if (osr_entry_bci() != InvalidOSREntryBci) { | 1156 if (osr_entry_bci() != InvalidOSREntryBci) { |
1153 // only log this once | 1157 // only log this once |
1154 log_state_change(state); | 1158 log_state_change(state); |
1155 } | 1159 } |
1156 invalidate_osr_method(); | 1160 invalidate_osr_method(); |
1518 } | 1522 } |
1519 } | 1523 } |
1520 #endif // !PRODUCT | 1524 #endif // !PRODUCT |
1521 } | 1525 } |
1522 | 1526 |
1527 // This method is called twice during GC -- once while | |
1528 // tracing the "active" nmethods on thread stacks during | |
1529 // the (strong) marking phase, and then again when walking | |
1530 // the code cache contents during the weak roots processing | |
1531 // phase. The two uses are distinguished by means of the | |
1532 // do_nmethods() method in the closure "f" below -- which | |
1533 // answers "yes" in the first case, and "no" in the second | |
1534 // case. We want to walk the weak roots in the nmethod | |
1535 // only in the second case. The weak roots in the nmethod | |
1536 // are the oops in the ExceptionCache and the InlineCache | |
1537 // oops. | |
1523 void nmethod::oops_do(OopClosure* f) { | 1538 void nmethod::oops_do(OopClosure* f) { |
1524 // make sure the oops ready to receive visitors | 1539 // make sure the oops ready to receive visitors |
1525 assert(!is_zombie() && !is_unloaded(), | 1540 assert(!is_zombie() && !is_unloaded(), |
1526 "should not call follow on zombie or unloaded nmethod"); | 1541 "should not call follow on zombie or unloaded nmethod"); |
1527 | 1542 |
1536 // (See comment above.) | 1551 // (See comment above.) |
1537 } | 1552 } |
1538 | 1553 |
1539 // Compiled code | 1554 // Compiled code |
1540 f->do_oop((oop*) &_method); | 1555 f->do_oop((oop*) &_method); |
1541 ExceptionCache* ec = exception_cache(); | 1556 if (!f->do_nmethods()) { |
1542 while(ec != NULL) { | 1557 // weak roots processing phase -- update ExceptionCache oops |
1543 f->do_oop((oop*)ec->exception_type_addr()); | 1558 ExceptionCache* ec = exception_cache(); |
1544 ec = ec->next(); | 1559 while(ec != NULL) { |
1545 } | 1560 f->do_oop((oop*)ec->exception_type_addr()); |
1561 ec = ec->next(); | |
1562 } | |
1563 } // Else strong roots phase -- skip oops in ExceptionCache | |
1546 | 1564 |
1547 RelocIterator iter(this, low_boundary); | 1565 RelocIterator iter(this, low_boundary); |
1566 | |
1548 while (iter.next()) { | 1567 while (iter.next()) { |
1549 if (iter.type() == relocInfo::oop_type ) { | 1568 if (iter.type() == relocInfo::oop_type ) { |
1550 oop_Relocation* r = iter.oop_reloc(); | 1569 oop_Relocation* r = iter.oop_reloc(); |
1551 // In this loop, we must only follow those oops directly embedded in | 1570 // In this loop, we must only follow those oops directly embedded in |
1552 // the code. Other oops (oop_index>0) are seen as part of scopes_oops. | 1571 // the code. Other oops (oop_index>0) are seen as part of scopes_oops. |
1553 assert(1 == (r->oop_is_immediate()) + (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()), "oop must be found in exactly one place"); | 1572 assert(1 == (r->oop_is_immediate()) + |
1573 (r->oop_addr() >= oops_begin() && r->oop_addr() < oops_end()), | |
1574 "oop must be found in exactly one place"); | |
1554 if (r->oop_is_immediate() && r->oop_value() != NULL) { | 1575 if (r->oop_is_immediate() && r->oop_value() != NULL) { |
1555 f->do_oop(r->oop_addr()); | 1576 f->do_oop(r->oop_addr()); |
1556 } | 1577 } |
1557 } | 1578 } |
1558 } | 1579 } |