comparison src/cpu/sparc/vm/sparc.ad @ 1567:110501f54a99

6934104: JSR 292 needs to support SPARC C2 Summary: C2 for SPARC needs to support JSR 292. Reviewed-by: kvn, never
author twisti
date Tue, 25 May 2010 02:38:48 -0700
parents d7f654633cfe
children 2d127394260e
comparison
equal deleted inserted replaced
1566:9f669cf29cb0 1567:110501f54a99
532 // from the start of the call to the point where the return address 532 // from the start of the call to the point where the return address
533 // will point. 533 // will point.
534 // The "return address" is the address of the call instruction, plus 8. 534 // The "return address" is the address of the call instruction, plus 8.
535 535
536 int MachCallStaticJavaNode::ret_addr_offset() { 536 int MachCallStaticJavaNode::ret_addr_offset() {
537 return NativeCall::instruction_size; // call; delay slot 537 int offset = NativeCall::instruction_size; // call; delay slot
538 if (_method_handle_invoke)
539 offset += 4; // restore SP
540 return offset;
538 } 541 }
539 542
540 int MachCallDynamicJavaNode::ret_addr_offset() { 543 int MachCallDynamicJavaNode::ret_addr_offset() {
541 int vtable_index = this->_vtable_index; 544 int vtable_index = this->_vtable_index;
542 if (vtable_index < 0) { 545 if (vtable_index < 0) {
1856 ShouldNotReachHere(); 1859 ShouldNotReachHere();
1857 return RegMask(); 1860 return RegMask();
1858 } 1861 }
1859 1862
1860 const RegMask Matcher::method_handle_invoke_SP_save_mask() { 1863 const RegMask Matcher::method_handle_invoke_SP_save_mask() {
1861 return RegMask(); 1864 return L7_REGP_mask;
1862 } 1865 }
1863 1866
1864 %} 1867 %}
1865 1868
1866 1869
2437 enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime 2440 enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime
2438 // CALL directly to the runtime 2441 // CALL directly to the runtime
2439 // The user of this is responsible for ensuring that R_L7 is empty (killed). 2442 // The user of this is responsible for ensuring that R_L7 is empty (killed).
2440 emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type, 2443 emit_call_reloc(cbuf, $meth$$method, relocInfo::runtime_call_type,
2441 /*preserve_g2=*/true, /*force far call*/true); 2444 /*preserve_g2=*/true, /*force far call*/true);
2445 %}
2446
2447 enc_class preserve_SP %{
2448 MacroAssembler _masm(&cbuf);
2449 __ mov(SP, L7_mh_SP_save);
2450 %}
2451
2452 enc_class restore_SP %{
2453 MacroAssembler _masm(&cbuf);
2454 __ mov(L7_mh_SP_save, SP);
2442 %} 2455 %}
2443 2456
2444 enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL 2457 enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL
2445 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine 2458 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine
2446 // who we intended to call. 2459 // who we intended to call.
9211 // ============================================================================ 9224 // ============================================================================
9212 // Call Instructions 9225 // Call Instructions
9213 // Call Java Static Instruction 9226 // Call Java Static Instruction
9214 instruct CallStaticJavaDirect( method meth ) %{ 9227 instruct CallStaticJavaDirect( method meth ) %{
9215 match(CallStaticJava); 9228 match(CallStaticJava);
9229 predicate(! ((CallStaticJavaNode*)n)->is_method_handle_invoke());
9216 effect(USE meth); 9230 effect(USE meth);
9217 9231
9218 size(8); 9232 size(8);
9219 ins_cost(CALL_COST); 9233 ins_cost(CALL_COST);
9220 format %{ "CALL,static ; NOP ==> " %} 9234 format %{ "CALL,static ; NOP ==> " %}
9221 ins_encode( Java_Static_Call( meth ), call_epilog ); 9235 ins_encode( Java_Static_Call( meth ), call_epilog );
9236 ins_pc_relative(1);
9237 ins_pipe(simple_call);
9238 %}
9239
9240 // Call Java Static Instruction (method handle version)
9241 instruct CallStaticJavaHandle(method meth, l7RegP l7_mh_SP_save) %{
9242 match(CallStaticJava);
9243 predicate(((CallStaticJavaNode*)n)->is_method_handle_invoke());
9244 effect(USE meth, KILL l7_mh_SP_save);
9245
9246 size(8);
9247 ins_cost(CALL_COST);
9248 format %{ "CALL,static/MethodHandle" %}
9249 ins_encode(preserve_SP, Java_Static_Call(meth), restore_SP, call_epilog);
9222 ins_pc_relative(1); 9250 ins_pc_relative(1);
9223 ins_pipe(simple_call); 9251 ins_pipe(simple_call);
9224 %} 9252 %}
9225 9253
9226 // Call Java Dynamic Instruction 9254 // Call Java Dynamic Instruction