90 monarray()->append(new MonitorValue(
91 slot2lv (obj_offset, Location::oop),
92 slot2loc(box_offset, Location::normal)));
93 }
94
95 void SharkDecacher::process_oop_tmp_slot(Value** value, int offset) {
96 // Decache the temporary oop slot
97 if (*value) {
98 write_value_to_frame(
99 SharkType::oop_type(),
100 *value,
101 offset);
102
103 oopmap()->set_oop(slot2reg(offset));
104 }
105 }
106
107 void SharkDecacher::process_method_slot(Value** value, int offset) {
108 // Decache the method pointer
109 write_value_to_frame(
110 SharkType::Method*_type(),
111 *value,
112 offset);
113
114 oopmap()->set_oop(slot2reg(offset));
115 }
116
117 void SharkDecacher::process_pc_slot(int offset) {
118 // Record the PC
119 builder()->CreateStore(
120 builder()->code_buffer_address(pc_offset()),
121 stack()->slot_addr(offset));
122 }
123
124 void SharkDecacher::start_locals() {
125 // Create the array we'll record our local variables in
126 _locarray = new GrowableArray<ScopeValue*>(max_locals());}
127
128 void SharkDecacher::process_local_slot(int index,
129 SharkValue** addr,
130 int offset) {
131 SharkValue *value = *addr;
132
133 // Write the value to the frame if necessary
134 if (local_slot_needs_write(index, value)) {
188 // Copy the monitor from the OSR buffer to the frame
189 int src_offset = max_locals() + index * 2;
190 builder()->CreateStore(
191 builder()->CreateLoad(
192 CreateAddressOfOSRBufEntry(src_offset, SharkType::intptr_type())),
193 stack()->slot_addr(box_offset, SharkType::intptr_type()));
194 builder()->CreateStore(
195 builder()->CreateLoad(
196 CreateAddressOfOSRBufEntry(src_offset + 1, SharkType::oop_type())),
197 stack()->slot_addr(obj_offset, SharkType::oop_type()));
198 }
199
200 void SharkCacher::process_oop_tmp_slot(Value** value, int offset) {
201 // Cache the temporary oop
202 if (*value)
203 *value = read_value_from_frame(SharkType::oop_type(), offset);
204 }
205
206 void SharkCacher::process_method_slot(Value** value, int offset) {
207 // Cache the method pointer
208 *value = read_value_from_frame(SharkType::Method*_type(), offset);
209 }
210
211 void SharkFunctionEntryCacher::process_method_slot(Value** value, int offset) {
212 // "Cache" the method pointer
213 *value = method();
214 }
215
216 void SharkCacher::process_local_slot(int index,
217 SharkValue** addr,
218 int offset) {
219 SharkValue *value = *addr;
220
221 // Read the value from the frame if necessary
222 if (local_slot_needs_read(index, value)) {
223 *addr = SharkValue::create_generic(
224 value->type(),
225 read_value_from_frame(
226 SharkType::to_stackType(value->basic_type()),
227 adjusted_offset(value, offset)),
228 value->zero_checked());
229 }
230 }
231
232 Value* SharkOSREntryCacher::CreateAddressOfOSRBufEntry(int offset,
233 const Type* type) {
234 Value *result = builder()->CreateStructGEP(osr_buf(), offset);
235 if (type != SharkType::intptr_type())
236 result = builder()->CreateBitCast(result, PointerType::getUnqual(type));
237 return result;
238 }
239
240 void SharkOSREntryCacher::process_local_slot(int index,
241 SharkValue** addr,
242 int offset) {
243 SharkValue *value = *addr;
244
245 // Read the value from the OSR buffer if necessary
246 if (local_slot_needs_read(index, value)) {
247 *addr = SharkValue::create_generic(
248 value->type(),
249 builder()->CreateLoad(
250 CreateAddressOfOSRBufEntry(
251 adjusted_offset(value, max_locals() - 1 - index),
252 SharkType::to_stackType(value->basic_type()))),
253 value->zero_checked());
254 }
255 }
256
257 void SharkDecacher::write_value_to_frame(const Type* type,
258 Value* value,
259 int offset) {
260 builder()->CreateStore(value, stack()->slot_addr(offset, type));
261 }
262
263 Value* SharkCacher::read_value_from_frame(const Type* type, int offset) {
264 return builder()->CreateLoad(stack()->slot_addr(offset, type));
265 }
|
90 monarray()->append(new MonitorValue(
91 slot2lv (obj_offset, Location::oop),
92 slot2loc(box_offset, Location::normal)));
93 }
94
95 void SharkDecacher::process_oop_tmp_slot(Value** value, int offset) {
96 // Decache the temporary oop slot
97 if (*value) {
98 write_value_to_frame(
99 SharkType::oop_type(),
100 *value,
101 offset);
102
103 oopmap()->set_oop(slot2reg(offset));
104 }
105 }
106
107 void SharkDecacher::process_method_slot(Value** value, int offset) {
108 // Decache the method pointer
109 write_value_to_frame(
110 SharkType::Method_type(),
111 *value,
112 offset);
113
114 }
115
116 void SharkDecacher::process_pc_slot(int offset) {
117 // Record the PC
118 builder()->CreateStore(
119 builder()->code_buffer_address(pc_offset()),
120 stack()->slot_addr(offset));
121 }
122
123 void SharkDecacher::start_locals() {
124 // Create the array we'll record our local variables in
125 _locarray = new GrowableArray<ScopeValue*>(max_locals());}
126
127 void SharkDecacher::process_local_slot(int index,
128 SharkValue** addr,
129 int offset) {
130 SharkValue *value = *addr;
131
132 // Write the value to the frame if necessary
133 if (local_slot_needs_write(index, value)) {
187 // Copy the monitor from the OSR buffer to the frame
188 int src_offset = max_locals() + index * 2;
189 builder()->CreateStore(
190 builder()->CreateLoad(
191 CreateAddressOfOSRBufEntry(src_offset, SharkType::intptr_type())),
192 stack()->slot_addr(box_offset, SharkType::intptr_type()));
193 builder()->CreateStore(
194 builder()->CreateLoad(
195 CreateAddressOfOSRBufEntry(src_offset + 1, SharkType::oop_type())),
196 stack()->slot_addr(obj_offset, SharkType::oop_type()));
197 }
198
199 void SharkCacher::process_oop_tmp_slot(Value** value, int offset) {
200 // Cache the temporary oop
201 if (*value)
202 *value = read_value_from_frame(SharkType::oop_type(), offset);
203 }
204
205 void SharkCacher::process_method_slot(Value** value, int offset) {
206 // Cache the method pointer
207 *value = read_value_from_frame(SharkType::Method_type(), offset);
208 }
209
210 void SharkFunctionEntryCacher::process_method_slot(Value** value, int offset) {
211 // "Cache" the method pointer
212 *value = method();
213 }
214
215 void SharkCacher::process_local_slot(int index,
216 SharkValue** addr,
217 int offset) {
218 SharkValue *value = *addr;
219
220 // Read the value from the frame if necessary
221 if (local_slot_needs_read(index, value)) {
222 *addr = SharkValue::create_generic(
223 value->type(),
224 read_value_from_frame(
225 SharkType::to_stackType(value->basic_type()),
226 adjusted_offset(value, offset)),
227 value->zero_checked());
228 }
229 }
230
231 Value* SharkOSREntryCacher::CreateAddressOfOSRBufEntry(int offset,
232 Type* type) {
233 Value *result = builder()->CreateStructGEP(osr_buf(), offset);
234 if (type != SharkType::intptr_type())
235 result = builder()->CreateBitCast(result, PointerType::getUnqual(type));
236 return result;
237 }
238
239 void SharkOSREntryCacher::process_local_slot(int index,
240 SharkValue** addr,
241 int offset) {
242 SharkValue *value = *addr;
243
244 // Read the value from the OSR buffer if necessary
245 if (local_slot_needs_read(index, value)) {
246 *addr = SharkValue::create_generic(
247 value->type(),
248 builder()->CreateLoad(
249 CreateAddressOfOSRBufEntry(
250 adjusted_offset(value, max_locals() - 1 - index),
251 SharkType::to_stackType(value->basic_type()))),
252 value->zero_checked());
253 }
254 }
255
256 void SharkDecacher::write_value_to_frame(Type* type,
257 Value* value,
258 int offset) {
259 builder()->CreateStore(value, stack()->slot_addr(offset, type));
260 }
261
262 Value* SharkCacher::read_value_from_frame(Type* type, int offset) {
263 return builder()->CreateLoad(stack()->slot_addr(offset, type));
264 }
|