27
28
29 int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); }
30
31 void vframeArrayElement::free_monitors(JavaThread* jt) {
32 if (_monitors != NULL) {
33 MonitorChunk* chunk = _monitors;
34 _monitors = NULL;
35 jt->remove_monitor_chunk(chunk);
36 delete chunk;
37 }
38 }
39
40 void vframeArrayElement::fill_in(compiledVFrame* vf) {
41
42 // Copy the information from the compiled vframe to the
43 // interpreter frame we will be creating to replace vf
44
45 _method = vf->method();
46 _bci = vf->raw_bci();
47
48 int index;
49
50 // Get the monitors off-stack
51
52 GrowableArray<MonitorInfo*>* list = vf->monitors();
53 if (list->is_empty()) {
54 _monitors = NULL;
55 } else {
56
57 // Allocate monitor chunk
58 _monitors = new MonitorChunk(list->length());
59 vf->thread()->add_monitor_chunk(_monitors);
60
61 // Migrate the BasicLocks from the stack to the monitor chunk
62 for (index = 0; index < list->length(); index++) {
63 MonitorInfo* monitor = list->at(index);
64 assert(!monitor->owner_is_scalar_replaced(), "object should be reallocated already");
65 assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased");
66 BasicObjectLock* dest = _monitors->at(index);
138
139 void vframeArrayElement::unpack_on_stack(int callee_parameters,
140 int callee_locals,
141 frame* caller,
142 bool is_top_frame,
143 int exec_mode) {
144 JavaThread* thread = (JavaThread*) Thread::current();
145
146 // Look at bci and decide on bcp and continuation pc
147 address bcp;
148 // C++ interpreter doesn't need a pc since it will figure out what to do when it
149 // begins execution
150 address pc;
151 bool use_next_mdp; // true if we should use the mdp associated with the next bci
152 // rather than the one associated with bcp
153 if (raw_bci() == SynchronizationEntryBCI) {
154 // We are deoptimizing while hanging in prologue code for synchronized method
155 bcp = method()->bcp_from(0); // first byte code
156 pc = Interpreter::deopt_entry(vtos, 0); // step = 0 since we don't skip current bytecode
157 use_next_mdp = false;
158 } else {
159 bcp = method()->bcp_from(bci());
160 pc = Interpreter::continuation_for(method(), bcp, callee_parameters, is_top_frame, use_next_mdp);
161 }
162 assert(Bytecodes::is_defined(*bcp), "must be a valid bytecode");
163
164 // Monitorenter and pending exceptions:
165 //
166 // For Compiler2, there should be no pending exception when deoptimizing at monitorenter
167 // because there is no safepoint at the null pointer check (it is either handled explicitly
168 // or prior to the monitorenter) and asynchronous exceptions are not made "pending" by the
169 // runtime interface for the slow case (see JRT_ENTRY_FOR_MONITORENTER). If an asynchronous
170 // exception was processed, the bytecode pointer would have to be extended one bytecode beyond
171 // the monitorenter to place it in the proper exception range.
172 //
173 // For Compiler1, deoptimization can occur while throwing a NullPointerException at monitorenter,
174 // in which case bcp should point to the monitorenter since it is within the exception's range.
175
176 assert(*bcp != Bytecodes::_monitorenter || is_top_frame, "a _monitorenter must be a top frame");
177 // TIERED Must know the compiler of the deoptee QQQ
178 COMPILER2_PRESENT(guarantee(*bcp != Bytecodes::_monitorenter || exec_mode != Deoptimization::Unpack_exception,
179 "shouldn't get exception during monitorenter");)
|
27
28
29 int vframeArrayElement:: bci(void) const { return (_bci == SynchronizationEntryBCI ? 0 : _bci); }
30
31 void vframeArrayElement::free_monitors(JavaThread* jt) {
32 if (_monitors != NULL) {
33 MonitorChunk* chunk = _monitors;
34 _monitors = NULL;
35 jt->remove_monitor_chunk(chunk);
36 delete chunk;
37 }
38 }
39
40 void vframeArrayElement::fill_in(compiledVFrame* vf) {
41
42 // Copy the information from the compiled vframe to the
43 // interpreter frame we will be creating to replace vf
44
45 _method = vf->method();
46 _bci = vf->raw_bci();
47 _restart = vf->is_restart();
48
49 int index;
50
51 // Get the monitors off-stack
52
53 GrowableArray<MonitorInfo*>* list = vf->monitors();
54 if (list->is_empty()) {
55 _monitors = NULL;
56 } else {
57
58 // Allocate monitor chunk
59 _monitors = new MonitorChunk(list->length());
60 vf->thread()->add_monitor_chunk(_monitors);
61
62 // Migrate the BasicLocks from the stack to the monitor chunk
63 for (index = 0; index < list->length(); index++) {
64 MonitorInfo* monitor = list->at(index);
65 assert(!monitor->owner_is_scalar_replaced(), "object should be reallocated already");
66 assert(monitor->owner() == NULL || (!monitor->owner()->is_unlocked() && !monitor->owner()->has_bias_pattern()), "object must be null or locked, and unbiased");
67 BasicObjectLock* dest = _monitors->at(index);
139
140 void vframeArrayElement::unpack_on_stack(int callee_parameters,
141 int callee_locals,
142 frame* caller,
143 bool is_top_frame,
144 int exec_mode) {
145 JavaThread* thread = (JavaThread*) Thread::current();
146
147 // Look at bci and decide on bcp and continuation pc
148 address bcp;
149 // C++ interpreter doesn't need a pc since it will figure out what to do when it
150 // begins execution
151 address pc;
152 bool use_next_mdp; // true if we should use the mdp associated with the next bci
153 // rather than the one associated with bcp
154 if (raw_bci() == SynchronizationEntryBCI) {
155 // We are deoptimizing while hanging in prologue code for synchronized method
156 bcp = method()->bcp_from(0); // first byte code
157 pc = Interpreter::deopt_entry(vtos, 0); // step = 0 since we don't skip current bytecode
158 use_next_mdp = false;
159 } else if (is_restart()) { // Must restart this instruction according to debuginfo
160 bcp = method()->bcp_from(bci());
161 pc = Interpreter::deopt_entry(vtos, 0);
162 use_next_mdp = false;
163 } else { //some of them may still restart according to Interpreter::continuation_for
164 bcp = method()->bcp_from(bci());
165 pc = Interpreter::continuation_for(method(), bcp, callee_parameters, is_top_frame, use_next_mdp);
166 }
167 assert(Bytecodes::is_defined(*bcp), "must be a valid bytecode");
168
169 // Monitorenter and pending exceptions:
170 //
171 // For Compiler2, there should be no pending exception when deoptimizing at monitorenter
172 // because there is no safepoint at the null pointer check (it is either handled explicitly
173 // or prior to the monitorenter) and asynchronous exceptions are not made "pending" by the
174 // runtime interface for the slow case (see JRT_ENTRY_FOR_MONITORENTER). If an asynchronous
175 // exception was processed, the bytecode pointer would have to be extended one bytecode beyond
176 // the monitorenter to place it in the proper exception range.
177 //
178 // For Compiler1, deoptimization can occur while throwing a NullPointerException at monitorenter,
179 // in which case bcp should point to the monitorenter since it is within the exception's range.
180
181 assert(*bcp != Bytecodes::_monitorenter || is_top_frame, "a _monitorenter must be a top frame");
182 // TIERED Must know the compiler of the deoptee QQQ
183 COMPILER2_PRESENT(guarantee(*bcp != Bytecodes::_monitorenter || exec_mode != Deoptimization::Unpack_exception,
184 "shouldn't get exception during monitorenter");)
|