Mercurial > hg > truffle
comparison src/share/vm/graal/graalCodeInstaller.cpp @ 9972:91c16dff3fc1
Refactor CodeInstaller and CompilerToVM
author | Christos Kotselidis <christos.kotselidis@oracle.com> |
---|---|
date | Mon, 10 Jun 2013 11:47:18 +0200 |
parents | 558c73d8bdc0 |
children | 13384d19fec0 |
comparison
equal
deleted
inserted
replaced
9971:390df0b3eefe | 9972:91c16dff3fc1 |
---|---|
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 oop object; | 259 oop object = ((objArrayOop) (values))->obj_at(i); |
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 ScopeValue* value = get_hotspot_value(object, total_frame_size, objects, cur_second, oop_recorder); |
266 | 261 |
267 if (isLongArray && cur_second == NULL) { | 262 if (isLongArray && cur_second == NULL) { |
268 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. | 263 // we're trying to put ints into a long array... this isn't really valid, but it's used for some optimizations. |
269 // add an int 0 constant | 264 // add an int 0 constant |
441 | 436 |
442 // copy the code into the newly created CodeBuffer | 437 // copy the code into the newly created CodeBuffer |
443 memcpy(_instructions->start(), _code->base(T_BYTE), _code_size); | 438 memcpy(_instructions->start(), _code->base(T_BYTE), _code_size); |
444 _instructions->set_end(_instructions->start() + _code_size); | 439 _instructions->set_end(_instructions->start() + _code_size); |
445 | 440 |
446 oop site; | |
447 for (int i = 0; i < _sites->length(); i++) { | 441 for (int i = 0; i < _sites->length(); i++) { |
448 if(UseCompressedOops) { | 442 oop site=((objArrayOop) (_sites))->obj_at(i); |
449 site=oopDesc::decode_heap_oop(((narrowOop*) _sites->base(T_OBJECT))[i]); | |
450 } else { | |
451 site=((oop*) (_sites->base(T_OBJECT)))[i]; | |
452 } | |
453 jint pc_offset = CompilationResult_Site::pcOffset(site); | 443 jint pc_offset = CompilationResult_Site::pcOffset(site); |
454 | 444 |
455 if (site->is_a(CompilationResult_Call::klass())) { | 445 if (site->is_a(CompilationResult_Call::klass())) { |
456 TRACE_graal_4("call at %i", pc_offset); | 446 TRACE_graal_4("call at %i", pc_offset); |
457 site_Call(buffer, pc_offset, site); | 447 site_Call(buffer, pc_offset, site); |
477 } | 467 } |
478 } | 468 } |
479 | 469 |
480 #ifndef PRODUCT | 470 #ifndef PRODUCT |
481 if (_comments != NULL) { | 471 if (_comments != NULL) { |
482 oop comment; | |
483 for (int i = 0; i < _comments->length(); i++) { | 472 for (int i = 0; i < _comments->length(); i++) { |
484 if(UseCompressedOops) { | 473 oop comment=((objArrayOop) (_comments))->obj_at(i); |
485 comment=oopDesc::decode_heap_oop(((narrowOop*) _comments->base(T_OBJECT))[i]); | |
486 } else { | |
487 comment=((oop*) (_comments->base(T_OBJECT)))[i]; | |
488 } | |
489 assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce"); | 474 assert(comment->is_a(HotSpotCompiledCode_Comment::klass()), "cce"); |
490 jint offset = HotSpotCompiledCode_Comment::pcOffset(comment); | 475 jint offset = HotSpotCompiledCode_Comment::pcOffset(comment); |
491 char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment)); | 476 char* text = java_lang_String::as_utf8_string(HotSpotCompiledCode_Comment::text(comment)); |
492 buffer.block_comment(offset, text); | 477 buffer.block_comment(offset, text); |
493 } | 478 } |
543 GrowableArray<intptr_t>* bcis = new GrowableArray<intptr_t> (num_handlers); | 528 GrowableArray<intptr_t>* bcis = new GrowableArray<intptr_t> (num_handlers); |
544 GrowableArray<intptr_t>* scope_depths = new GrowableArray<intptr_t> (num_handlers); | 529 GrowableArray<intptr_t>* scope_depths = new GrowableArray<intptr_t> (num_handlers); |
545 GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t> (num_handlers); | 530 GrowableArray<intptr_t>* pcos = new GrowableArray<intptr_t> (num_handlers); |
546 | 531 |
547 if (_exception_handlers != NULL) { | 532 if (_exception_handlers != NULL) { |
548 oop* exception_handlers = (oop*) _exception_handlers->base(T_OBJECT); | |
549 for (int i = 0; i < _exception_handlers->length(); i++) { | 533 for (int i = 0; i < _exception_handlers->length(); i++) { |
550 oop exc; | 534 oop exc=((objArrayOop) (_exception_handlers))->obj_at(i); |
551 if(UseCompressedOops) { | |
552 exc=oopDesc::decode_heap_oop(((narrowOop*) _exception_handlers->base(T_OBJECT))[i]); | |
553 } else { | |
554 exc=((oop*) (_exception_handlers->base(T_OBJECT)))[i]; | |
555 } | |
556 jint pc_offset = CompilationResult_Site::pcOffset(exc); | 535 jint pc_offset = CompilationResult_Site::pcOffset(exc); |
557 jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc); | 536 jint handler_offset = CompilationResult_ExceptionHandler::handlerPos(exc); |
558 | 537 |
559 // Subtable header | 538 // Subtable header |
560 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); | 539 _exception_handler_table.add_entry(HandlerTableEntry(1, pc_offset, 0)); |
622 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); | 601 tty->print_cr("%d locals %d expressions, %d monitors", local_count, expression_count, monitor_count); |
623 } | 602 } |
624 | 603 |
625 for (jint i = 0; i < values->length(); i++) { | 604 for (jint i = 0; i < values->length(); i++) { |
626 ScopeValue* second = NULL; | 605 ScopeValue* second = NULL; |
627 oop value; | 606 oop value=((objArrayOop) (values))->obj_at(i); |
628 if(UseCompressedOops) { | |
629 value=oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]); | |
630 } else { | |
631 value = ((oop*) values->base(T_OBJECT))[i]; | |
632 } | |
633 if (i < local_count) { | 607 if (i < local_count) { |
634 ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder); | 608 ScopeValue* first = get_hotspot_value(value, _total_frame_size, objects, second, _oop_recorder); |
635 if (second != NULL) { | 609 if (second != NULL) { |
636 locals->append(second); | 610 locals->append(second); |
637 } | 611 } |
646 monitors->append(get_monitor_value(value, _total_frame_size, objects, _oop_recorder)); | 620 monitors->append(get_monitor_value(value, _total_frame_size, objects, _oop_recorder)); |
647 } | 621 } |
648 if (second != NULL) { | 622 if (second != NULL) { |
649 i++; | 623 i++; |
650 assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL"); | 624 assert(i < values->length(), "double-slot value not followed by Value.ILLEGAL"); |
651 if(UseCompressedOops) { | 625 assert(((objArrayOop) (values))->obj_at(i) == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); |
652 assert(oopDesc::decode_heap_oop(((narrowOop*) values->base(T_OBJECT))[i]) == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); | |
653 } else { | |
654 assert(((oop*) values->base(T_OBJECT))[i] == Value::ILLEGAL(), "double-slot value not followed by Value.ILLEGAL"); | |
655 } | |
656 } | 626 } |
657 } | 627 } |
658 | 628 |
659 | 629 |
660 _debug_recorder->dump_object_pool(objects); | 630 _debug_recorder->dump_object_pool(objects); |