equal
deleted
inserted
replaced
49 static void destroy(ZNMethodWithImmediateOops* nmi); |
49 static void destroy(ZNMethodWithImmediateOops* nmi); |
50 |
50 |
51 nmethod* method() const; |
51 nmethod* method() const; |
52 size_t immediate_oops_count() const; |
52 size_t immediate_oops_count() const; |
53 oop** immediate_oops_begin() const; |
53 oop** immediate_oops_begin() const; |
54 oop** immediate_oops_begin_safe() const; |
|
55 oop** immediate_oops_end() const; |
54 oop** immediate_oops_end() const; |
56 }; |
55 }; |
57 |
56 |
58 size_t ZNMethodWithImmediateOops::header_size() { |
57 size_t ZNMethodWithImmediateOops::header_size() { |
59 const size_t size = sizeof(ZNMethodWithImmediateOops); |
58 const size_t size = sizeof(ZNMethodWithImmediateOops); |
92 |
91 |
93 oop** ZNMethodWithImmediateOops::immediate_oops_begin() const { |
92 oop** ZNMethodWithImmediateOops::immediate_oops_begin() const { |
94 // The immediate oop* array starts immediately after this object |
93 // The immediate oop* array starts immediately after this object |
95 return (oop**)((uintptr_t)this + header_size()); |
94 return (oop**)((uintptr_t)this + header_size()); |
96 } |
95 } |
97 |
|
98 oop** ZNMethodWithImmediateOops::immediate_oops_begin_safe() const { |
|
99 // Non-entrant nmethods have a jump instruction patched into the beginning |
|
100 // of the verified entry point, which could have overwritten an immediate |
|
101 // oop. If so, make sure we skip over that oop. |
|
102 if (_nm->is_not_entrant()) { |
|
103 oop* const first_immediate_oop = *immediate_oops_begin(); |
|
104 oop* const safe_begin = (oop*)(_nm->verified_entry_point() + NativeJump::instruction_size); |
|
105 if (first_immediate_oop < safe_begin) { |
|
106 // First immediate oop overwritten, skip it |
|
107 return immediate_oops_begin() + 1; |
|
108 } |
|
109 } |
|
110 |
|
111 // First immediate oop not overwritten |
|
112 return immediate_oops_begin(); |
|
113 } |
|
114 |
|
115 |
96 |
116 oop** ZNMethodWithImmediateOops::immediate_oops_end() const { |
97 oop** ZNMethodWithImmediateOops::immediate_oops_end() const { |
117 return immediate_oops_begin() + immediate_oops_count(); |
98 return immediate_oops_begin() + immediate_oops_count(); |
118 } |
99 } |
119 |
100 |
427 } |
408 } |
428 |
409 |
429 if (entry.immediate_oops()) { |
410 if (entry.immediate_oops()) { |
430 // Process immediate oops |
411 // Process immediate oops |
431 const ZNMethodWithImmediateOops* const nmi = entry.method_with_immediate_oops(); |
412 const ZNMethodWithImmediateOops* const nmi = entry.method_with_immediate_oops(); |
432 oop** const begin = nmi->immediate_oops_begin_safe(); |
413 oop** const begin = nmi->immediate_oops_begin(); |
433 oop** const end = nmi->immediate_oops_end(); |
414 oop** const end = nmi->immediate_oops_end(); |
434 for (oop** p = begin; p < end; p++) { |
415 for (oop** p = begin; p < end; p++) { |
435 cl->do_oop(*p); |
416 cl->do_oop(*p); |
436 } |
417 } |
437 } |
418 } |