comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3561:bea018622324

Changes to JavaAccess as a result of CRI changes.
author Doug Simon <doug.simon@oracle.com>
date Thu, 25 Aug 2011 16:58:25 +0200
parents 6e8fc93551d7
children 8780fa370aab
comparison
equal deleted inserted replaced
3560:6e8fc93551d7 3561:bea018622324
334 oop* sites = (oop*) _sites->base(T_OBJECT); 334 oop* sites = (oop*) _sites->base(T_OBJECT);
335 for (int i = 0; i < _sites->length(); i++) { 335 for (int i = 0; i < _sites->length(); i++) {
336 oop site = sites[i]; 336 oop site = sites[i];
337 jint pc_offset = CiTargetMethod_Site::pcOffset(site); 337 jint pc_offset = CiTargetMethod_Site::pcOffset(site);
338 338
339 if (site->is_a(CiTargetMethod_Safepoint::klass())) { 339 if (site->is_a(CiTargetMethod_Call::klass())) {
340 TRACE_graal_4("call at %i", pc_offset);
341 site_Call(buffer, pc_offset, site);
342 } else if (site->is_a(CiTargetMethod_Safepoint::klass())) {
340 TRACE_graal_4("safepoint at %i", pc_offset); 343 TRACE_graal_4("safepoint at %i", pc_offset);
341 site_Safepoint(buffer, pc_offset, site); 344 site_Safepoint(buffer, pc_offset, site);
342 } else if (site->is_a(CiTargetMethod_Call::klass())) {
343 TRACE_graal_4("call at %i", pc_offset);
344 site_Call(buffer, pc_offset, site);
345 } else if (site->is_a(CiTargetMethod_DataPatch::klass())) { 345 } else if (site->is_a(CiTargetMethod_DataPatch::klass())) {
346 TRACE_graal_4("datapatch at %i", pc_offset); 346 TRACE_graal_4("datapatch at %i", pc_offset);
347 site_DataPatch(buffer, pc_offset, site); 347 site_DataPatch(buffer, pc_offset, site);
348 } else if (site->is_a(CiTargetMethod_Mark::klass())) { 348 } else if (site->is_a(CiTargetMethod_Mark::klass())) {
349 TRACE_graal_4("mark at %i", pc_offset); 349 TRACE_graal_4("mark at %i", pc_offset);
565 565
566 _debug_recorder->end_safepoint(pc_offset); 566 _debug_recorder->end_safepoint(pc_offset);
567 } 567 }
568 568
569 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) { 569 void CodeInstaller::site_Call(CodeBuffer& buffer, jint pc_offset, oop site) {
570 oop runtime_call = CiTargetMethod_Call::runtimeCall(site); 570 oop target = CiTargetMethod_Call::target(site);
571 oop hotspot_method = CiTargetMethod_Call::method(site); 571 instanceKlass* target_klass = instanceKlass::cast(target->klass());
572 oop symbol = CiTargetMethod_Call::symbol(site); 572
573 oop global_stub = CiTargetMethod_Call::stubID(site); 573 oop runtime_call = NULL; // CiRuntimeCall
574 oop hotspot_method = NULL; // RiMethod
575 oop global_stub = NULL;
576
577 if (target_klass->is_subclass_of(SystemDictionary::Long_klass())) {
578 global_stub = target;
579 } else if (target_klass->name() == vmSymbols::com_sun_cri_ci_CiRuntimeCall()) {
580 runtime_call = target;
581 } else {
582 hotspot_method = target;
583 }
574 584
575 oop debug_info = CiTargetMethod_Call::debugInfo(site); 585 oop debug_info = CiTargetMethod_Call::debugInfo(site);
576 586
577 assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (symbol ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); 587 assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type");
578 588
579 assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size)"); 589 assert(NativeCall::instruction_size == (int)NativeJump::instruction_size, "unexpected size)");
580 jint next_pc_offset = pc_offset + NativeCall::instruction_size; 590 jint next_pc_offset = pc_offset + NativeCall::instruction_size;
581 591
582 if (debug_info != NULL) { 592 if (debug_info != NULL) {
656 } else { 666 } else {
657 nativeJump_at((address)inst)->set_jump_destination(VmIds::getStub(global_stub)); 667 nativeJump_at((address)inst)->set_jump_destination(VmIds::getStub(global_stub));
658 } 668 }
659 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand); 669 _instructions->relocate((address)inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
660 TRACE_graal_3("relocating (stub) at %016x", inst); 670 TRACE_graal_3("relocating (stub) at %016x", inst);
661 } else if (symbol != NULL) {
662 fatal("symbol");
663 } else { // method != NULL 671 } else { // method != NULL
664 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); 672 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset);
665 assert(hotspot_method != NULL, "unexpected RiMethod"); 673 assert(hotspot_method != NULL, "unexpected RiMethod");
666 assert(debug_info != NULL, "debug info expected"); 674 assert(debug_info != NULL, "debug info expected");
667 675