comparison src/share/vm/graal/graalCodeInstaller.cpp @ 5554:70f715dfbb41

Bring Java renamings and restructurings to the C++ part.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Sun, 10 Jun 2012 01:17:48 +0200
parents 511612d1b5c1
children 69358a2182a3
comparison
equal deleted inserted replaced
5553:511612d1b5c1 5554:70f715dfbb41
66 static int bitmap_size(oop bit_map) { 66 static int bitmap_size(oop bit_map) {
67 arrayOop arr = (arrayOop) GraalBitMap::words(bit_map); 67 arrayOop arr = (arrayOop) GraalBitMap::words(bit_map);
68 return arr->length() * MapWordBits; 68 return arr->length() * MapWordBits;
69 } 69 }
70 70
71 // creates a hotspot oop map out of the byte arrays provided by CiDebugInfo 71 // creates a hotspot oop map out of the byte arrays provided by DebugInfo
72 static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) { 72 static OopMap* create_oop_map(jint total_frame_size, jint parameter_count, oop debug_info) {
73 OopMap* map = new OopMap(total_frame_size, parameter_count); 73 OopMap* map = new OopMap(total_frame_size, parameter_count);
74 oop register_map = (oop) CiDebugInfo::registerRefMap(debug_info); 74 oop register_map = (oop) DebugInfo::registerRefMap(debug_info);
75 oop frame_map = (oop) CiDebugInfo::frameRefMap(debug_info); 75 oop frame_map = (oop) DebugInfo::frameRefMap(debug_info);
76 76
77 if (register_map != NULL) { 77 if (register_map != NULL) {
78 for (jint i = 0; i < NUM_CPU_REGS; i++) { 78 for (jint i = 0; i < NUM_CPU_REGS; i++) {
79 bool is_oop = is_bit_set(register_map, i); 79 bool is_oop = is_bit_set(register_map, i);
80 VMReg reg = get_hotspot_reg(i); 80 VMReg reg = get_hotspot_reg(i);
102 } 102 }
103 103
104 // TODO: finish this - graal doesn't provide any scope values at the moment 104 // TODO: finish this - graal doesn't provide any scope values at the moment
105 static ScopeValue* get_hotspot_value(oop value, int total_frame_size, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) { 105 static ScopeValue* get_hotspot_value(oop value, int total_frame_size, GrowableArray<ScopeValue*>* objects, ScopeValue* &second) {
106 second = NULL; 106 second = NULL;
107 if (value == CiValue::IllegalValue()) { 107 if (value == Value::IllegalValue()) {
108 return new LocationValue(Location::new_stk_loc(Location::invalid, 0)); 108 return new LocationValue(Location::new_stk_loc(Location::invalid, 0));
109 } 109 }
110 110
111 BasicType type = GraalCompiler::kindToBasicType(CiKind::typeChar(CiValue::kind(value))); 111 BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(Value::kind(value)));
112 Location::Type locationType = Location::normal; 112 Location::Type locationType = Location::normal;
113 if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop; 113 if (type == T_OBJECT || type == T_ARRAY) locationType = Location::oop;
114 114
115 if (value->is_a(CiRegisterValue::klass())) { 115 if (value->is_a(RegisterValue::klass())) {
116 jint number = CiRegister::number(CiRegisterValue::reg(value)); 116 jint number = code_Register::number(RegisterValue::reg(value));
117 if (number < 16) { 117 if (number < 16) {
118 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE || type == T_ADDRESS) { 118 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE || type == T_ADDRESS) {
119 locationType = Location::int_in_long; 119 locationType = Location::int_in_long;
120 } else if (type == T_LONG) { 120 } else if (type == T_LONG) {
121 locationType = Location::lng; 121 locationType = Location::lng;
139 if (type == T_DOUBLE) { 139 if (type == T_DOUBLE) {
140 second = value; 140 second = value;
141 } 141 }
142 return value; 142 return value;
143 } 143 }
144 } else if (value->is_a(CiStackSlot::klass())) { 144 } else if (value->is_a(StackSlot::klass())) {
145 if (type == T_DOUBLE) { 145 if (type == T_DOUBLE) {
146 locationType = Location::dbl; 146 locationType = Location::dbl;
147 } else if (type == T_LONG) { 147 } else if (type == T_LONG) {
148 locationType = Location::lng; 148 locationType = Location::lng;
149 } 149 }
150 jint offset = CiStackSlot::offset(value); 150 jint offset = StackSlot::offset(value);
151 if (CiStackSlot::addFrameSize(value)) { 151 if (StackSlot::addFrameSize(value)) {
152 offset += total_frame_size; 152 offset += total_frame_size;
153 } 153 }
154 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset)); 154 ScopeValue* value = new LocationValue(Location::new_stk_loc(locationType, offset));
155 if (type == T_DOUBLE || type == T_LONG) { 155 if (type == T_DOUBLE || type == T_LONG) {
156 second = value; 156 second = value;
157 } 157 }
158 return value; 158 return value;
159 } else if (value->is_a(CiConstant::klass())){ 159 } else if (value->is_a(Constant::klass())){
160 oop obj = CiConstant::object(value); 160 oop obj = Constant::object(value);
161 jlong prim = CiConstant::primitive(value); 161 jlong prim = Constant::primitive(value);
162 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) { 162 if (type == T_INT || type == T_FLOAT || type == T_SHORT || type == T_CHAR || type == T_BOOLEAN || type == T_BYTE) {
163 return new ConstantIntValue(*(jint*)&prim); 163 return new ConstantIntValue(*(jint*)&prim);
164 } else if (type == T_LONG || type == T_DOUBLE) { 164 } else if (type == T_LONG || type == T_DOUBLE) {
165 second = new ConstantIntValue(0); 165 second = new ConstantIntValue(0);
166 return new ConstantLongValue(prim); 166 return new ConstantLongValue(prim);
167 } else if (type == T_OBJECT) { 167 } else if (type == T_OBJECT) {
168 oop obj = CiConstant::object(value); 168 oop obj = Constant::object(value);
169 if (obj == NULL) { 169 if (obj == NULL) {
170 return new ConstantOopWriteValue(NULL); 170 return new ConstantOopWriteValue(NULL);
171 } else { 171 } else {
172 return new ConstantOopWriteValue(JNIHandles::make_local(obj)); 172 return new ConstantOopWriteValue(JNIHandles::make_local(obj));
173 } 173 }
174 } else if (type == T_ADDRESS) { 174 } else if (type == T_ADDRESS) {
175 return new ConstantLongValue(prim); 175 return new ConstantLongValue(prim);
176 } 176 }
177 tty->print("%i", type); 177 tty->print("%i", type);
178 } else if (value->is_a(CiVirtualObject::klass())) { 178 } else if (value->is_a(VirtualObject::klass())) {
179 oop type = CiVirtualObject::type(value); 179 oop type = VirtualObject::type(value);
180 int id = CiVirtualObject::id(value); 180 int id = VirtualObject::id(value);
181 klassOop klass = java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type)); 181 klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type));
182 bool isLongArray = klass == Universe::longArrayKlassObj(); 182 bool isLongArray = klass == Universe::longArrayKlassObj();
183 183
184 for (jint i = 0; i < objects->length(); i++) { 184 for (jint i = 0; i < objects->length(); i++) {
185 ObjectValue* obj = (ObjectValue*) objects->at(i); 185 ObjectValue* obj = (ObjectValue*) objects->at(i);
186 if (obj->id() == id) { 186 if (obj->id() == id) {
188 } 188 }
189 } 189 }
190 190
191 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), klass))); 191 ObjectValue* sv = new ObjectValue(id, new ConstantOopWriteValue(JNIHandles::make_local(Thread::current(), klass)));
192 192
193 arrayOop values = (arrayOop) CiVirtualObject::values(value); 193 arrayOop values = (arrayOop) VirtualObject::values(value);
194 for (jint i = 0; i < values->length(); i++) { 194 for (jint i = 0; i < values->length(); i++) {
195 ((oop*) values->base(T_OBJECT))[i]; 195 ((oop*) values->base(T_OBJECT))[i];
196 } 196 }
197 197
198 for (jint i = 0; i < values->length(); i++) { 198 for (jint i = 0; i < values->length(); i++) {
224 ShouldNotReachHere(); 224 ShouldNotReachHere();
225 return NULL; 225 return NULL;
226 } 226 }
227 227
228 static MonitorValue* get_monitor_value(oop value, int total_frame_size, GrowableArray<ScopeValue*>* objects) { 228 static MonitorValue* get_monitor_value(oop value, int total_frame_size, GrowableArray<ScopeValue*>* objects) {
229 guarantee(value->is_a(CiMonitorValue::klass()), "Monitors must be of type CiMonitorValue"); 229 guarantee(value->is_a(code_MonitorValue::klass()), "Monitors must be of type MonitorValue");
230 230
231 ScopeValue* second = NULL; 231 ScopeValue* second = NULL;
232 ScopeValue* owner_value = get_hotspot_value(CiMonitorValue::owner(value), total_frame_size, objects, second); 232 ScopeValue* owner_value = get_hotspot_value(code_MonitorValue::owner(value), total_frame_size, objects, second);
233 assert(second == NULL, "monitor cannot occupy two stack slots"); 233 assert(second == NULL, "monitor cannot occupy two stack slots");
234 234
235 ScopeValue* lock_data_value = get_hotspot_value(CiMonitorValue::lockData(value), total_frame_size, objects, second); 235 ScopeValue* lock_data_value = get_hotspot_value(code_MonitorValue::lockData(value), total_frame_size, objects, second);
236 assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots"); 236 assert(second == lock_data_value, "monitor is LONG value that occupies two stack slots");
237 assert(lock_data_value->is_location(), "invalid monitor location"); 237 assert(lock_data_value->is_location(), "invalid monitor location");
238 Location lock_data_loc = ((LocationValue*)lock_data_value)->location(); 238 Location lock_data_loc = ((LocationValue*)lock_data_value)->location();
239 239
240 bool eliminated = false; 240 bool eliminated = false;
241 if (CiMonitorValue::eliminated(value)) { 241 if (code_MonitorValue::eliminated(value)) {
242 eliminated = true; 242 eliminated = true;
243 } 243 }
244 244
245 return new MonitorValue(owner_value, lock_data_loc, eliminated); 245 return new MonitorValue(owner_value, lock_data_loc, eliminated);
246 } 246 }
248 void CodeInstaller::initialize_assumptions(oop target_method) { 248 void CodeInstaller::initialize_assumptions(oop target_method) {
249 _oop_recorder = new OopRecorder(_env->arena()); 249 _oop_recorder = new OopRecorder(_env->arena());
250 _env->set_oop_recorder(_oop_recorder); 250 _env->set_oop_recorder(_oop_recorder);
251 _env->set_dependencies(_dependencies); 251 _env->set_dependencies(_dependencies);
252 _dependencies = new Dependencies(_env); 252 _dependencies = new Dependencies(_env);
253 Handle assumptions_handle = CiTargetMethod::assumptions(HotSpotTargetMethod::targetMethod(target_method)); 253 Handle assumptions_handle = InstalledCode::assumptions(HotSpotTargetMethod::targetMethod(target_method));
254 if (!assumptions_handle.is_null()) { 254 if (!assumptions_handle.is_null()) {
255 objArrayHandle assumptions(Thread::current(), (objArrayOop)CiAssumptions::list(assumptions_handle())); 255 objArrayHandle assumptions(Thread::current(), (objArrayOop)Assumptions::list(assumptions_handle()));
256 int length = assumptions->length(); 256 int length = assumptions->length();
257 for (int i = 0; i < length; ++i) { 257 for (int i = 0; i < length; ++i) {
258 Handle assumption = assumptions->obj_at(i); 258 Handle assumption = assumptions->obj_at(i);
259 if (!assumption.is_null()) { 259 if (!assumption.is_null()) {
260 if (assumption->klass() == CiAssumptions_MethodContents::klass()) { 260 if (assumption->klass() == Assumptions_MethodContents::klass()) {
261 assumption_MethodContents(assumption); 261 assumption_MethodContents(assumption);
262 } else if (assumption->klass() == CiAssumptions_ConcreteSubtype::klass()) { 262 } else if (assumption->klass() == Assumptions_ConcreteSubtype::klass()) {
263 assumption_ConcreteSubtype(assumption); 263 assumption_ConcreteSubtype(assumption);
264 } else if (assumption->klass() == CiAssumptions_ConcreteMethod::klass()) { 264 } else if (assumption->klass() == Assumptions_ConcreteMethod::klass()) {
265 assumption_ConcreteMethod(assumption); 265 assumption_ConcreteMethod(assumption);
266 } else { 266 } else {
267 assumption->print(); 267 assumption->print();
268 fatal("unexpected Assumption subclass"); 268 fatal("unexpected Assumption subclass");
269 } 269 }
325 } 325 }
326 _name = HotSpotTargetMethod::name(target_method); 326 _name = HotSpotTargetMethod::name(target_method);
327 _sites = (arrayOop) HotSpotTargetMethod::sites(target_method); 327 _sites = (arrayOop) HotSpotTargetMethod::sites(target_method);
328 _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method); 328 _exception_handlers = (arrayOop) HotSpotTargetMethod::exceptionHandlers(target_method);
329 329
330 _code = (arrayOop) CiTargetMethod::targetCode(_citarget_method); 330 _code = (arrayOop) InstalledCode::targetCode(_citarget_method);
331 _code_size = CiTargetMethod::targetCodeSize(_citarget_method); 331 _code_size = InstalledCode::targetCodeSize(_citarget_method);
332 // The frame size we get from the target method does not include the return address, so add one word for it here. 332 // The frame size we get from the target method does not include the return address, so add one word for it here.
333 _total_frame_size = CiTargetMethod::frameSize(_citarget_method) + HeapWordSize; 333 _total_frame_size = InstalledCode::frameSize(_citarget_method) + HeapWordSize;
334 _custom_stack_area_offset = CiTargetMethod::customStackAreaOffset(_citarget_method); 334 _custom_stack_area_offset = InstalledCode::customStackAreaOffset(_citarget_method);
335 335
336 336
337 // (very) conservative estimate: each site needs a constant section entry 337 // (very) conservative estimate: each site needs a constant section entry
338 _constants_size = _sites->length() * (BytesPerLong*2); 338 _constants_size = _sites->length() * (BytesPerLong*2);
339 _total_size = align_size_up(_code_size, HeapWordSize) + _constants_size; 339 _total_size = align_size_up(_code_size, HeapWordSize) + _constants_size;
363 _instructions->set_end(_instructions->start() + _code_size); 363 _instructions->set_end(_instructions->start() + _code_size);
364 364
365 oop* sites = (oop*) _sites->base(T_OBJECT); 365 oop* sites = (oop*) _sites->base(T_OBJECT);
366 for (int i = 0; i < _sites->length(); i++) { 366 for (int i = 0; i < _sites->length(); i++) {
367 oop site = sites[i]; 367 oop site = sites[i];
368 jint pc_offset = CiTargetMethod_Site::pcOffset(site); 368 jint pc_offset = InstalledCode_Site::pcOffset(site);
369 369
370 if (site->is_a(CiTargetMethod_Call::klass())) { 370 if (site->is_a(InstalledCode_Call::klass())) {
371 TRACE_graal_4("call at %i", pc_offset); 371 TRACE_graal_4("call at %i", pc_offset);
372 site_Call(buffer, pc_offset, site); 372 site_Call(buffer, pc_offset, site);
373 } else if (site->is_a(CiTargetMethod_Safepoint::klass())) { 373 } else if (site->is_a(InstalledCode_Safepoint::klass())) {
374 TRACE_graal_4("safepoint at %i", pc_offset); 374 TRACE_graal_4("safepoint at %i", pc_offset);
375 site_Safepoint(buffer, pc_offset, site); 375 site_Safepoint(buffer, pc_offset, site);
376 } else if (site->is_a(CiTargetMethod_DataPatch::klass())) { 376 } else if (site->is_a(InstalledCode_DataPatch::klass())) {
377 TRACE_graal_4("datapatch at %i", pc_offset); 377 TRACE_graal_4("datapatch at %i", pc_offset);
378 site_DataPatch(buffer, pc_offset, site); 378 site_DataPatch(buffer, pc_offset, site);
379 } else if (site->is_a(CiTargetMethod_Mark::klass())) { 379 } else if (site->is_a(InstalledCode_Mark::klass())) {
380 TRACE_graal_4("mark at %i", pc_offset); 380 TRACE_graal_4("mark at %i", pc_offset);
381 site_Mark(buffer, pc_offset, site); 381 site_Mark(buffer, pc_offset, site);
382 } else { 382 } else {
383 fatal("unexpected Site subclass"); 383 fatal("unexpected Site subclass");
384 } 384 }
385 } 385 }
386 } 386 }
387 387
388 void CodeInstaller::assumption_MethodContents(Handle assumption) { 388 void CodeInstaller::assumption_MethodContents(Handle assumption) {
389 Handle method_handle = CiAssumptions_MethodContents::method(assumption()); 389 Handle method_handle = Assumptions_MethodContents::method(assumption());
390 methodHandle method = getMethodFromHotSpotMethod(method_handle()); 390 methodHandle method = getMethodFromHotSpotMethod(method_handle());
391 ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(method()); 391 ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(method());
392 392
393 _dependencies->assert_evol_method(m); 393 _dependencies->assert_evol_method(m);
394 } 394 }
395 395
396 void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) { 396 void CodeInstaller::assumption_ConcreteSubtype(Handle assumption) {
397 Handle context_handle = CiAssumptions_ConcreteSubtype::context(assumption()); 397 Handle context_handle = Assumptions_ConcreteSubtype::context(assumption());
398 ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(context_handle))); 398 ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(context_handle)));
399 399
400 Handle type_handle = CiAssumptions_ConcreteSubtype::subtype(assumption()); 400 Handle type_handle = Assumptions_ConcreteSubtype::subtype(assumption());
401 ciKlass* type = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(type_handle))); 401 ciKlass* type = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type_handle)));
402 402
403 _dependencies->assert_leaf_type(type); 403 _dependencies->assert_leaf_type(type);
404 if (context != type) { 404 if (context != type) {
405 assert(context->is_abstract(), ""); 405 assert(context->is_abstract(), "");
406 _dependencies->assert_abstract_with_unique_concrete_subtype(context, type); 406 _dependencies->assert_abstract_with_unique_concrete_subtype(context, type);
407 } 407 }
408 } 408 }
409 409
410 void CodeInstaller::assumption_ConcreteMethod(Handle assumption) { 410 void CodeInstaller::assumption_ConcreteMethod(Handle assumption) {
411 Handle impl_handle = CiAssumptions_ConcreteMethod::impl(assumption()); 411 Handle impl_handle = Assumptions_ConcreteMethod::impl(assumption());
412 methodHandle impl = getMethodFromHotSpotMethod(impl_handle()); 412 methodHandle impl = getMethodFromHotSpotMethod(impl_handle());
413 ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(impl()); 413 ciMethod* m = (ciMethod*) CURRENT_ENV->get_object(impl());
414 414
415 Handle context_handle = CiAssumptions_ConcreteMethod::context(assumption()); 415 Handle context_handle = Assumptions_ConcreteMethod::context(assumption());
416 ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotTypeResolved::javaMirror(context_handle))); 416 ciKlass* context = (ciKlass*) CURRENT_ENV->get_object(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(context_handle)));
417 _dependencies->assert_unique_concrete_method(context, m); 417 _dependencies->assert_unique_concrete_method(context, m);
418 } 418 }
419 419
420 void CodeInstaller::process_exception_handlers() { 420 void CodeInstaller::process_exception_handlers() {
421 // allocate some arrays for use by the collection code. 421 // allocate some arrays for use by the collection code.
426 426
427 if (_exception_handlers != NULL) { 427 if (_exception_handlers != NULL) {
428 oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT); 428 oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT);
429 for (int i = 0; i < _exception_handlers->length(); i++) { 429 for (int i = 0; i < _exception_handlers->length(); i++) {
430 oop exc = exception_handlers[i]; 430 oop exc = exception_handlers[i];
431 jint pc_offset = CiTargetMethod_Site::pcOffset(exc); 431 jint pc_offset = InstalledCode_Site::pcOffset(exc);
432 jint handler_offset = CiTargetMethod_ExceptionHandler::handlerPos(exc); 432 jint handler_offset = InstalledCode_ExceptionHandler::handlerPos(exc);
433 433
434 // Subtable header 434 // Subtable header
435 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); 435 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0));
436 436
437 // Subtable entry 437 // Subtable entry
439 } 439 }
440 } 440 }
441 } 441 }
442 442
443 void CodeInstaller::record_scope(jint pc_offset, oop frame, GrowableArray<ScopeValue*>* objects) { 443 void CodeInstaller::record_scope(jint pc_offset, oop frame, GrowableArray<ScopeValue*>* objects) {
444 assert(frame->klass() == CiFrame::klass(), "CiFrame expected"); 444 assert(frame->klass() == BytecodeFrame::klass(), "BytecodeFrame expected");
445 oop caller_frame = CiCodePos::caller(frame); 445 oop caller_frame = BytecodePosition::caller(frame);
446 if (caller_frame != NULL) { 446 if (caller_frame != NULL) {
447 record_scope(pc_offset, caller_frame, objects); 447 record_scope(pc_offset, caller_frame, objects);
448 } 448 }
449 449
450 oop hotspot_method = CiCodePos::method(frame); 450 oop hotspot_method = BytecodePosition::method(frame);
451 methodOop method = getMethodFromHotSpotMethod(hotspot_method); 451 methodOop method = getMethodFromHotSpotMethod(hotspot_method);
452 jint bci = CiCodePos::bci(frame); 452 jint bci = BytecodePosition::bci(frame);
453 bool reexecute; 453 bool reexecute;
454 if (bci == -1) { 454 if (bci == -1) {
455 reexecute = false; 455 reexecute = false;
456 } else { 456 } else {
457 Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci)); 457 Bytecodes::Code code = Bytecodes::java_code_at(method, method->bcp_from(bci));
458 reexecute = Interpreter::bytecode_should_reexecute(code); 458 reexecute = Interpreter::bytecode_should_reexecute(code);
459 if (frame != NULL) { 459 if (frame != NULL) {
460 reexecute = (CiFrame::duringCall(frame) == 0); 460 reexecute = (BytecodeFrame::duringCall(frame) == 0);
461 } 461 }
462 } 462 }
463 463
464 if (TraceGraal >= 2) { 464 if (TraceGraal >= 2) {
465 tty->print_cr("Recording scope pc_offset=%d bci=%d frame=%d", pc_offset, bci, frame); 465 tty->print_cr("Recording scope pc_offset=%d bci=%d frame=%d", pc_offset, bci, frame);
466 } 466 }
467 467
468 jint local_count = CiFrame::numLocals(frame); 468 jint local_count = BytecodeFrame::numLocals(frame);
469 jint expression_count = CiFrame::numStack(frame); 469 jint expression_count = BytecodeFrame::numStack(frame);
470 jint monitor_count = CiFrame::numLocks(frame); 470 jint monitor_count = BytecodeFrame::numLocks(frame);
471 arrayOop values = (arrayOop) CiFrame::values(frame); 471 arrayOop values = (arrayOop) BytecodeFrame::values(frame);
472 472
473 assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length"); 473 assert(local_count + expression_count + monitor_count == values->length(), "unexpected values length");
474 474
475 GrowableArray<ScopeValue*>* locals = new GrowableArray<ScopeValue*> (); 475 GrowableArray<ScopeValue*>* locals = new GrowableArray<ScopeValue*> ();
476 GrowableArray<ScopeValue*>* expressions = new GrowableArray<ScopeValue*> (); 476 GrowableArray<ScopeValue*>* expressions = new GrowableArray<ScopeValue*> ();
500 } else { 500 } else {
501 monitors->append(get_monitor_value(value, _total_frame_size, objects)); 501 monitors->append(get_monitor_value(value, _total_frame_size, objects));
502 } 502 }
503 if (second != NULL) { 503 if (second != NULL) {
504 i++; 504 i++;
505 assert(i < values->length(), "double-slot value not followed by CiValue.IllegalValue"); 505 assert(i < values->length(), "double-slot value not followed by Value.IllegalValue");
506 assert(((oop*) values->base(T_OBJECT))[i] == CiValue::IllegalValue(), "double-slot value not followed by CiValue.IllegalValue"); 506 assert(((oop*) values->base(T_OBJECT))[i] == Value::IllegalValue(), "double-slot value not followed by Value.IllegalValue");
507 } 507 }
508 } 508 }
509 509
510 _debug_recorder->dump_object_pool(objects); 510 _debug_recorder->dump_object_pool(objects);
511 511
512 DebugToken* locals_token = _debug_recorder->create_scope_values(locals); 512 DebugToken* locals_token = _debug_recorder->create_scope_values(locals);
513 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions); 513 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions);
514 DebugToken* monitors_token = _debug_recorder->create_monitor_values(monitors); 514 DebugToken* monitors_token = _debug_recorder->create_monitor_values(monitors);
515 515
516 bool throw_exception = false; 516 bool throw_exception = false;
517 if (CiFrame::rethrowException(frame)) { 517 if (BytecodeFrame::rethrowException(frame)) {
518 throw_exception = true; 518 throw_exception = true;
519 } 519 }
520 520
521 _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token); 521 _debug_recorder->describe_scope(pc_offset, method, NULL, bci, reexecute, throw_exception, false, false, locals_token, expressions_token, monitors_token);
522 } 522 }
523 523
524 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) { 524 void CodeInstaller::site_Safepoint(CodeBuffer& buffer, jint pc_offset, oop site) {
525 oop debug_info = CiTargetMethod_Safepoint::debugInfo(site); 525 oop debug_info = InstalledCode_Safepoint::debugInfo(site);
526 assert(debug_info != NULL, "debug info expected"); 526 assert(debug_info != NULL, "debug info expected");
527 527
528 // address instruction = _instructions->start() + pc_offset; 528 // address instruction = _instructions->start() + pc_offset;
529 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start(); 529 // jint next_pc_offset = Assembler::locate_next_instruction(instruction) - _instructions->start();
530 _debug_recorder->add_safepoint(pc_offset, -1, create_oop_map(_total_frame_size, _parameter_count, debug_info)); 530 _debug_recorder->add_safepoint(pc_offset, -1, create_oop_map(_total_frame_size, _parameter_count, debug_info));
531 531
532 oop code_pos = CiDebugInfo::bytecodePosition(debug_info); 532 oop code_pos = DebugInfo::bytecodePosition(debug_info);
533 record_scope(pc_offset, code_pos, new GrowableArray<ScopeValue*>()); 533 record_scope(pc_offset, code_pos, new GrowableArray<ScopeValue*>());
534 534
535 _debug_recorder->end_safepoint(pc_offset); 535 _debug_recorder->end_safepoint(pc_offset);
536 } 536 }
537 537
538 address CodeInstaller::runtime_call_target_address(oop runtime_call) { 538 address CodeInstaller::runtime_call_target_address(oop runtime_call) {
539 address target_addr = 0x0; 539 address target_addr = 0x0;
540 if (runtime_call == CiRuntimeCall::Debug()) { 540 if (runtime_call == RuntimeCall::Debug()) {
541 TRACE_graal_3("CiRuntimeCall::Debug()"); 541 TRACE_graal_3("RuntimeCall::Debug()");
542 } else if (runtime_call == CiRuntimeCall::UnwindException()) { 542 } else if (runtime_call == RuntimeCall::UnwindException()) {
543 target_addr = Runtime1::entry_for(Runtime1::graal_unwind_exception_call_id); 543 target_addr = Runtime1::entry_for(Runtime1::graal_unwind_exception_call_id);
544 TRACE_graal_3("CiRuntimeCall::UnwindException()"); 544 TRACE_graal_3("RuntimeCall::UnwindException()");
545 } else if (runtime_call == CiRuntimeCall::SetDeoptInfo()) { 545 } else if (runtime_call == RuntimeCall::SetDeoptInfo()) {
546 target_addr = Runtime1::entry_for(Runtime1::graal_set_deopt_info_id); 546 target_addr = Runtime1::entry_for(Runtime1::graal_set_deopt_info_id);
547 TRACE_graal_3("CiRuntimeCall::SetDeoptInfo()"); 547 TRACE_graal_3("RuntimeCall::SetDeoptInfo()");
548 } else if (runtime_call == CiRuntimeCall::CreateNullPointerException()) { 548 } else if (runtime_call == RuntimeCall::CreateNullPointerException()) {
549 target_addr = Runtime1::entry_for(Runtime1::graal_create_null_pointer_exception_id); 549 target_addr = Runtime1::entry_for(Runtime1::graal_create_null_pointer_exception_id);
550 TRACE_graal_3("CiRuntimeCall::CreateNullPointerException()"); 550 TRACE_graal_3("RuntimeCall::CreateNullPointerException()");
551 } else if (runtime_call == CiRuntimeCall::CreateOutOfBoundsException()) { 551 } else if (runtime_call == RuntimeCall::CreateOutOfBoundsException()) {
552 target_addr = Runtime1::entry_for(Runtime1::graal_create_out_of_bounds_exception_id); 552 target_addr = Runtime1::entry_for(Runtime1::graal_create_out_of_bounds_exception_id);
553 TRACE_graal_3("CiRuntimeCall::CreateOutOfBoundsException()"); 553 TRACE_graal_3("RuntimeCall::CreateOutOfBoundsException()");
554 } else if (runtime_call == CiRuntimeCall::JavaTimeMillis()) { 554 } else if (runtime_call == RuntimeCall::JavaTimeMillis()) {
555 target_addr = CAST_FROM_FN_PTR(address, os::javaTimeMillis); 555 target_addr = CAST_FROM_FN_PTR(address, os::javaTimeMillis);
556 TRACE_graal_3("CiRuntimeCall::JavaTimeMillis()"); 556 TRACE_graal_3("RuntimeCall::JavaTimeMillis()");
557 } else if (runtime_call == CiRuntimeCall::JavaTimeNanos()) { 557 } else if (runtime_call == RuntimeCall::JavaTimeNanos()) {
558 target_addr = CAST_FROM_FN_PTR(address, os::javaTimeNanos); 558 target_addr = CAST_FROM_FN_PTR(address, os::javaTimeNanos);
559 TRACE_graal_3("CiRuntimeCall::JavaTimeNanos()"); 559 TRACE_graal_3("RuntimeCall::JavaTimeNanos()");
560 } else if (runtime_call == CiRuntimeCall::ArithmeticFrem()) { 560 } else if (runtime_call == RuntimeCall::ArithmeticFrem()) {
561 target_addr = Runtime1::entry_for(Runtime1::graal_arithmetic_frem_id); 561 target_addr = Runtime1::entry_for(Runtime1::graal_arithmetic_frem_id);
562 TRACE_graal_3("CiRuntimeCall::ArithmeticFrem()"); 562 TRACE_graal_3("RuntimeCall::ArithmeticFrem()");
563 } else if (runtime_call == CiRuntimeCall::ArithmeticDrem()) { 563 } else if (runtime_call == RuntimeCall::ArithmeticDrem()) {
564 target_addr = Runtime1::entry_for(Runtime1::graal_arithmetic_drem_id); 564 target_addr = Runtime1::entry_for(Runtime1::graal_arithmetic_drem_id);
565 TRACE_graal_3("CiRuntimeCall::ArithmeticDrem()"); 565 TRACE_graal_3("RuntimeCall::ArithmeticDrem()");
566 } else if (runtime_call == CiRuntimeCall::ArithmeticSin()) { 566 } else if (runtime_call == RuntimeCall::ArithmeticSin()) {
567 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dsin); 567 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dsin);
568 TRACE_graal_3("CiRuntimeCall::ArithmeticSin()"); 568 TRACE_graal_3("RuntimeCall::ArithmeticSin()");
569 } else if (runtime_call == CiRuntimeCall::ArithmeticCos()) { 569 } else if (runtime_call == RuntimeCall::ArithmeticCos()) {
570 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dcos); 570 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dcos);
571 TRACE_graal_3("CiRuntimeCall::ArithmeticCos()"); 571 TRACE_graal_3("RuntimeCall::ArithmeticCos()");
572 } else if (runtime_call == CiRuntimeCall::ArithmeticTan()) { 572 } else if (runtime_call == RuntimeCall::ArithmeticTan()) {
573 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dtan); 573 target_addr = CAST_FROM_FN_PTR(address, SharedRuntime::dtan);
574 TRACE_graal_3("CiRuntimeCall::ArithmeticTan()"); 574 TRACE_graal_3("RuntimeCall::ArithmeticTan()");
575 } else if (runtime_call == CiRuntimeCall::RegisterFinalizer()) { 575 } else if (runtime_call == RuntimeCall::RegisterFinalizer()) {
576 target_addr = Runtime1::entry_for(Runtime1::register_finalizer_id); 576 target_addr = Runtime1::entry_for(Runtime1::register_finalizer_id);
577 TRACE_graal_3("CiRuntimeCall::RegisterFinalizer()"); 577 TRACE_graal_3("RuntimeCall::RegisterFinalizer()");
578 } else if (runtime_call == CiRuntimeCall::Deoptimize()) { 578 } else if (runtime_call == RuntimeCall::Deoptimize()) {
579 target_addr = SharedRuntime::deopt_blob()->uncommon_trap(); 579 target_addr = SharedRuntime::deopt_blob()->uncommon_trap();
580 TRACE_graal_3("CiRuntimeCall::Deoptimize()"); 580 TRACE_graal_3("RuntimeCall::Deoptimize()");
581 } else if (runtime_call == CiRuntimeCall::GenericCallback()) { 581 } else if (runtime_call == RuntimeCall::GenericCallback()) {
582 target_addr = Runtime1::entry_for(Runtime1::graal_generic_callback_id); 582 target_addr = Runtime1::entry_for(Runtime1::graal_generic_callback_id);
583 TRACE_graal_3("CiRuntimeCall::GenericCallback()"); 583 TRACE_graal_3("RuntimeCall::GenericCallback()");
584 } else { 584 } else {
585 runtime_call->print(); 585 runtime_call->print();
586 fatal("runtime_call not implemented"); 586 fatal("runtime_call not implemented");
587 } 587 }
588 return target_addr; 588 return target_addr;
589 } 589 }
590 590
591 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) { 591 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) {
592 oop target = CiTargetMethod_Call::target(site); 592 oop target = InstalledCode_Call::target(site);
593 instanceKlass* target_klass = instanceKlass::cast(target->klass()); 593 instanceKlass* target_klass = instanceKlass::cast(target->klass());
594 594
595 oop runtime_call = NULL; // CiRuntimeCall 595 oop runtime_call = NULL; // RuntimeCall
596 oop hotspot_method = NULL; // RiMethod 596 oop hotspot_method = NULL; // JavaMethod
597 oop global_stub = NULL; 597 oop global_stub = NULL;
598 598
599 if (target_klass->is_subclass_of(SystemDictionary::Long_klass())) { 599 if (target_klass->is_subclass_of(SystemDictionary::Long_klass())) {
600 global_stub = target; 600 global_stub = target;
601 } else if (target_klass->name() == vmSymbols::com_oracle_max_cri_ci_CiRuntimeCall()) { 601 } else if (target_klass->name() == vmSymbols::com_oracle_graal_api_code_RuntimeCall()) {
602 runtime_call = target; 602 runtime_call = target;
603 } else { 603 } else {
604 hotspot_method = target; 604 hotspot_method = target;
605 } 605 }
606 606
607 oop debug_info = CiTargetMethod_Call::debugInfo(site); 607 oop debug_info = InstalledCode_Call::debugInfo(site);
608 608
609 assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); 609 assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type");
610 610
611 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset); 611 NativeInstruction* inst = nativeInstruction_at(_instructions->start() + pc_offset);
612 jint next_pc_offset = 0x0; 612 jint next_pc_offset = 0x0;
639 639
640 return; 640 return;
641 } 641 }
642 642
643 if (debug_info != NULL) { 643 if (debug_info != NULL) {
644 oop frame = CiDebugInfo::bytecodePosition(debug_info); 644 oop frame = DebugInfo::bytecodePosition(debug_info);
645 _debug_recorder->add_safepoint(next_pc_offset, CiFrame::leafGraphId(frame), create_oop_map(_total_frame_size, _parameter_count, debug_info)); 645 _debug_recorder->add_safepoint(next_pc_offset, BytecodeFrame::leafGraphId(frame), create_oop_map(_total_frame_size, _parameter_count, debug_info));
646 record_scope(next_pc_offset, frame, new GrowableArray<ScopeValue*>()); 646 record_scope(next_pc_offset, frame, new GrowableArray<ScopeValue*>());
647 } 647 }
648 648
649 if (runtime_call != NULL) { 649 if (runtime_call != NULL) {
650 if (runtime_call != CiRuntimeCall::Debug()) { 650 if (runtime_call != RuntimeCall::Debug()) {
651 address target_addr = runtime_call_target_address(runtime_call); 651 address target_addr = runtime_call_target_address(runtime_call);
652 652
653 if (inst->is_call()) { 653 if (inst->is_call()) {
654 // NOTE: for call without a mov, the offset must fit a 32-bit immediate 654 // NOTE: for call without a mov, the offset must fit a 32-bit immediate
655 // see also CompilerToVM.getMaxCallTargetOffset() 655 // see also CompilerToVM.getMaxCallTargetOffset()
674 nativeJump_at((address)inst)->set_jump_destination(VmIds::getStub(global_stub)); 674 nativeJump_at((address)inst)->set_jump_destination(VmIds::getStub(global_stub));
675 } 675 }
676 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); 676 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
677 TRACE_graal_3("relocating (stub) at %016x", inst); 677 TRACE_graal_3("relocating (stub) at %016x", inst);
678 } else { // method != NULL 678 } else { // method != NULL
679 assert(hotspot_method != NULL, "unexpected RiMethod"); 679 assert(hotspot_method != NULL, "unexpected JavaMethod");
680 assert(debug_info != NULL, "debug info expected"); 680 assert(debug_info != NULL, "debug info expected");
681 681
682 methodOop method = NULL; 682 methodOop method = NULL;
683 // we need to check, this might also be an unresolved method 683 // we need to check, this might also be an unresolved method
684 if (hotspot_method->is_a(HotSpotMethodResolved::klass())) { 684 if (hotspot_method->is_a(HotSpotResolvedJavaMethod::klass())) {
685 method = getMethodFromHotSpotMethod(hotspot_method); 685 method = getMethodFromHotSpotMethod(hotspot_method);
686 } 686 }
687 687
688 assert(debug_info != NULL, "debug info expected"); 688 assert(debug_info != NULL, "debug info expected");
689 689
728 _debug_recorder->end_safepoint(next_pc_offset); 728 _debug_recorder->end_safepoint(next_pc_offset);
729 } 729 }
730 } 730 }
731 731
732 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) { 732 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) {
733 oop constant = CiTargetMethod_DataPatch::constant(site); 733 oop constant = InstalledCode_DataPatch::constant(site);
734 int alignment = CiTargetMethod_DataPatch::alignment(site); 734 int alignment = InstalledCode_DataPatch::alignment(site);
735 oop kind = CiConstant::kind(constant); 735 oop kind = Constant::kind(constant);
736 736
737 address instruction = _instructions->start() + pc_offset; 737 address instruction = _instructions->start() + pc_offset;
738 738
739 char typeChar = CiKind::typeChar(kind); 739 char typeChar = Kind::typeChar(kind);
740 switch (typeChar) { 740 switch (typeChar) {
741 case 'z': 741 case 'z':
742 case 'b': 742 case 'b':
743 case 's': 743 case 's':
744 case 'c': 744 case 'c':
756 size = align_size_up(size, alignment); 756 size = align_size_up(size, alignment);
757 } 757 }
758 // we don't care if this is a long/double/etc., the primitive field contains the right bits 758 // we don't care if this is a long/double/etc., the primitive field contains the right bits
759 address dest = _constants->start() + size; 759 address dest = _constants->start() + size;
760 _constants->set_end(dest + BytesPerLong); 760 _constants->set_end(dest + BytesPerLong);
761 *(jlong*) dest = CiConstant::primitive(constant); 761 *(jlong*) dest = Constant::primitive(constant);
762 762
763 long disp = dest - next_instruction; 763 long disp = dest - next_instruction;
764 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); 764 assert(disp == (jint) disp, "disp doesn't fit in 32 bits");
765 *((jint*) operand) = (jint) disp; 765 *((jint*) operand) = (jint) disp;
766 766
768 TRACE_graal_3("relocating (%c) at %016x/%016x with destination at %016x (%d)", typeChar, instruction, operand, dest, size); 768 TRACE_graal_3("relocating (%c) at %016x/%016x with destination at %016x (%d)", typeChar, instruction, operand, dest, size);
769 break; 769 break;
770 } 770 }
771 case 'a': { 771 case 'a': {
772 address operand = Assembler::locate_operand(instruction, Assembler::imm_operand); 772 address operand = Assembler::locate_operand(instruction, Assembler::imm_operand);
773 Handle obj = CiConstant::object(constant); 773 Handle obj = Constant::object(constant);
774 774
775 if (obj->is_a(HotSpotKlassOop::klass())) { 775 if (obj->is_a(HotSpotKlassOop::klass())) {
776 assert(!obj.is_null(), ""); 776 assert(!obj.is_null(), "");
777 *((jobject*) operand) = JNIHandles::make_local(java_lang_Class::as_klassOop(HotSpotKlassOop::javaMirror(obj))); 777 *((jobject*) operand) = JNIHandles::make_local(java_lang_Class::as_klassOop(HotSpotKlassOop::javaMirror(obj)));
778 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); 778 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
779 TRACE_graal_3("relocating (HotSpotType) at %016x/%016x", instruction, operand); 779 TRACE_graal_3("relocating (HotSpotJavaType) at %016x/%016x", instruction, operand);
780 } else { 780 } else {
781 jobject value = JNIHandles::make_local(obj()); 781 jobject value = JNIHandles::make_local(obj());
782 if (obj() == HotSpotProxy::DUMMY_CONSTANT_OBJ()) { 782 if (obj() == HotSpotProxy::DUMMY_CONSTANT_OBJ()) {
783 value = (jobject) Universe::non_oop_word(); 783 value = (jobject) Universe::non_oop_word();
784 } 784 }
787 TRACE_graal_3("relocating (oop constant) at %016x/%016x", instruction, operand); 787 TRACE_graal_3("relocating (oop constant) at %016x/%016x", instruction, operand);
788 } 788 }
789 break; 789 break;
790 } 790 }
791 default: 791 default:
792 fatal("unexpected CiKind in DataPatch"); 792 fatal("unexpected Kind in DataPatch");
793 break; 793 break;
794 } 794 }
795 } 795 }
796 796
797 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) { 797 void CodeInstaller::site_Mark(CodeBuffer& buffer, jint pc_offset, oop site) {
798 oop id_obj = CiTargetMethod_Mark::id(site); 798 oop id_obj = InstalledCode_Mark::id(site);
799 arrayOop references = (arrayOop) CiTargetMethod_Mark::references(site); 799 arrayOop references = (arrayOop) InstalledCode_Mark::references(site);
800 800
801 if (id_obj != NULL) { 801 if (id_obj != NULL) {
802 assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected"); 802 assert(java_lang_boxing_object::is_instance(id_obj, T_INT), "Integer id expected");
803 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT)); 803 jint id = id_obj->int_field(java_lang_boxing_object::value_offset_in_bytes(T_INT));
804 804
821 _offsets.set_value(CodeOffsets::Deopt, pc_offset); 821 _offsets.set_value(CodeOffsets::Deopt, pc_offset);
822 break; 822 break;
823 case MARK_STATIC_CALL_STUB: { 823 case MARK_STATIC_CALL_STUB: {
824 assert(references->length() == 1, "static call stub needs one reference"); 824 assert(references->length() == 1, "static call stub needs one reference");
825 oop ref = ((oop*) references->base(T_OBJECT))[0]; 825 oop ref = ((oop*) references->base(T_OBJECT))[0];
826 address call_pc = _instructions->start() + CiTargetMethod_Site::pcOffset(ref); 826 address call_pc = _instructions->start() + InstalledCode_Site::pcOffset(ref);
827 _instructions->relocate(instruction, static_stub_Relocation::spec(call_pc)); 827 _instructions->relocate(instruction, static_stub_Relocation::spec(call_pc));
828 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); 828 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
829 break; 829 break;
830 } 830 }
831 case MARK_INVOKE_INVALID: 831 case MARK_INVOKE_INVALID:
866 assert(*byte_skip == 5, "unexpected byte_skip"); 866 assert(*byte_skip == 5, "unexpected byte_skip");
867 867
868 assert(references->length() == 2, "MARK_KLASS_PATCHING/MARK_ACCESS_FIELD_PATCHING needs 2 references"); 868 assert(references->length() == 2, "MARK_KLASS_PATCHING/MARK_ACCESS_FIELD_PATCHING needs 2 references");
869 oop ref1 = ((oop*) references->base(T_OBJECT))[0]; 869 oop ref1 = ((oop*) references->base(T_OBJECT))[0];
870 oop ref2 = ((oop*) references->base(T_OBJECT))[1]; 870 oop ref2 = ((oop*) references->base(T_OBJECT))[1];
871 int i_byte_count = CiTargetMethod_Site::pcOffset(ref2) - CiTargetMethod_Site::pcOffset(ref1); 871 int i_byte_count = InstalledCode_Site::pcOffset(ref2) - InstalledCode_Site::pcOffset(ref1);
872 assert(i_byte_count == (unsigned char)i_byte_count, "invalid offset"); 872 assert(i_byte_count == (unsigned char)i_byte_count, "invalid offset");
873 *byte_count = i_byte_count; 873 *byte_count = i_byte_count;
874 *being_initialized_entry_offset = *byte_count + *byte_skip; 874 *being_initialized_entry_offset = *byte_count + *byte_skip;
875 875
876 // we need to correct the offset of a field access - it's created with MAX_INT to ensure the correct size, and hotspot expects 0 876 // we need to correct the offset of a field access - it's created with MAX_INT to ensure the correct size, and hotspot expects 0
877 if (id == MARK_ACCESS_FIELD_PATCHING) { 877 if (id == MARK_ACCESS_FIELD_PATCHING) {
878 NativeMovRegMem* inst = nativeMovRegMem_at(_instructions->start() + CiTargetMethod_Site::pcOffset(ref1)); 878 NativeMovRegMem* inst = nativeMovRegMem_at(_instructions->start() + InstalledCode_Site::pcOffset(ref1));
879 assert(inst->offset() == max_jint, "unexpected offset value"); 879 assert(inst->offset() == max_jint, "unexpected offset value");
880 inst->set_offset(0); 880 inst->set_offset(0);
881 } 881 }
882 break; 882 break;
883 } 883 }