Mercurial > hg > graal-compiler
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 9887:4d5872186e76
Add compressed oops support in Graal/Hotspot site
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Tue, 04 Jun 2013 19:36:16 +0200 |
parents | d552919fbb05 |
children | 558c73d8bdc0 |
comparison
equal
deleted
inserted
replaced
9886:d14b65dac937 | 9887:4d5872186e76 |
---|---|
254 objects->append(sv); | 254 objects->append(sv); |
255 | 255 |
256 arrayOop values = (arrayOop) VirtualObject::values(value); | 256 arrayOop values = (arrayOop) VirtualObject::values(value); |
257 for (jint i = 0; i < values->length(); i++) { | 257 for (jint i = 0; i < values->length(); i++) { |
258 ScopeValue* cur_second = NULL; | 258 ScopeValue* cur_second = NULL; |
259 ScopeValue* value = get_hotspot_value(((oop*) values->base(T_OBJECT))[i], total_frame_size, objects, cur_second, oop_recorder); | 259 oop object; |
260 if(UseCompressedOops) { | |
261 object=oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]); | |
262 } else { | |
263 object=((oop*) (values->base(T_OBJECT)))[i]; | |
264 } | |
265 ScopeValue* value = get_hotspot_value(object, total_frame_size, objects, cur_second, oop_recorder); | |
260 | 266 |
261 if (isLongArray && cur_second == NULL) { | 267 if (isLongArray && cur_second == NULL) { |
262 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. | 268 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. |
263 // add an int 0 constant | 269 // add an int 0 constant |
264 #ifdef VM_LITTLE_ENDIAN | 270 #ifdef VM_LITTLE_ENDIAN |
435 | 441 |
436 // copy the code into the newly created CodeBuffer | 442 // copy the code into the newly created CodeBuffer |
437 memcpy(_instructions->start(), _code->base(T_BYTE), _code_size); | 443 memcpy(_instructions->start(), _code->base(T_BYTE), _code_size); |
438 _instructions->set_end(_instructions->start() + _code_size); | 444 _instructions->set_end(_instructions->start() + _code_size); |
439 | 445 |
440 oop* sites = (oop*) _sites->base(T_OBJECT); | 446 oop site; |
441 for (int i = 0; i < _sites->length(); i++) { | 447 for (int i = 0; i < _sites->length(); i++) { |
442 oop site = sites[i]; | 448 if(UseCompressedOops) { |
449 site=oopDesc::decode_heap_oop(((narrowOop*) _sites->base(T_OBJECT))[i]); | |
450 } else { | |
451 site=((oop*) (_sites->base(T_OBJECT)))[i]; | |
452 } | |
443 jint pc_offset = CompilationResult_Site::pcOffset(site); | 453 jint pc_offset = CompilationResult_Site::pcOffset(site); |
444 | 454 |
445 if (site->is_a(CompilationResult_Call::klass())) { | 455 if (site->is_a(CompilationResult_Call::klass())) { |
446 TRACE_graal_4("call at %i", pc_offset); | 456 TRACE_graal_4("call at %i", pc_offset); |
447 site_Call(buffer, pc_offset, site); | 457 site_Call(buffer, pc_offset, site); |
531 GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t> (num_handlers); | 541 GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t> (num_handlers); |
532 | 542 |
533 if (_exception_handlers != NULL) { | 543 if (_exception_handlers != NULL) { |
534 oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT); | 544 oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT); |
535 for (int i = 0; i < _exception_handlers->length(); i++) { | 545 for (int i = 0; i < _exception_handlers->length(); i++) { |
536 oop exc = exception_handlers[i]; | 546 oop exc; |
547 if(UseCompressedOops) { | |
548 exc=oopDesc::decode_heap_oop(((narrowOop*) _exception_handlers->base(T_OBJECT))[i]); | |
549 } else { | |
550 exc=((oop*) (_exception_handlers->base(T_OBJECT)))[i]; | |
551 } | |
537 jint pc_offset = CompilationResult_Site::pcOffset(exc); | 552 jint pc_offset = CompilationResult_Site::pcOffset(exc); |
538 jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc); | 553 jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc); |
539 | 554 |
540 // Subtable header | 555 // Subtable header |
541 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); | 556 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); |
603 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); | 618 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); |
604 } | 619 } |
605 | 620 |
606 for (jint i = 0; i < values->length(); i++) { | 621 for (jint i = 0; i < values->length(); i++) { |
607 ScopeValue* second = NULL; | 622 ScopeValue* second = NULL; |
608 oop value = ((oop*) values->base(T_OBJECT))[i]; | 623 oop value; |
609 | 624 if(UseCompressedOops) { |
625 value=oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]); | |
626 } else { | |
627 value = ((oop*) values->base(T_OBJECT))[i]; | |
628 } | |
610 if (i < local_count) { | 629 if (i < local_count) { |
611 ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder); | 630 ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder); |
612 if (second != NULL) { | 631 if (second != NULL) { |
613 locals->append(second); | 632 locals->append(second); |
614 } | 633 } |
623 monitors->append(get_monitor_value(value, _total_frame_size, objects, _oop_recorder)); | 642 monitors->append(get_monitor_value(value, _total_frame_size, objects, _oop_recorder)); |
624 } | 643 } |
625 if (second != NULL) { | 644 if (second != NULL) { |
626 i++; | 645 i++; |
627 assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL"); | 646 assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL"); |
628 assert(((oop*) values->base(T_OBJECT))[i] == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); | 647 if(UseCompressedOops) { |
629 } | 648 assert(oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]) == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); |
630 } | 649 } else { |
650 assert(((oop*) values->base(T_OBJECT))[i] == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); | |
651 } | |
652 } | |
653 } | |
654 | |
631 | 655 |
632 _debug_recorder->dump_object_pool(objects); | 656 _debug_recorder->dump_object_pool(objects); |
633 | 657 |
634 DebugToken* locals_token = _debug_recorder->create_scope_values(locals); | 658 DebugToken* locals_token = _debug_recorder->create_scope_values(locals); |
635 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions); | 659 DebugToken* expressions_token = _debug_recorder->create_scope_values(expressions); |