1.1 --- a/src/cpu/sparc/vm/sparc.ad Mon May 24 14:15:14 2010 -0700 1.2 +++ b/src/cpu/sparc/vm/sparc.ad Tue May 25 02:38:48 2010 -0700 1.3 @@ -534,7 +534,10 @@ 1.4 // The "return address" is the address of the call instruction, plus 8. 1.5 1.6 int MachCallStaticJavaNode::ret_addr_offset() { 1.7 - return NativeCall::instruction_size; // call; delay slot 1.8 + int offset = NativeCall::instruction_size; // call; delay slot 1.9 + if (_method_handle_invoke) 1.10 + offset += 4; // restore SP 1.11 + return offset; 1.12 } 1.13 1.14 int MachCallDynamicJavaNode::ret_addr_offset() { 1.15 @@ -1858,7 +1861,7 @@ 1.16 } 1.17 1.18 const RegMask Matcher::method_handle_invoke_SP_save_mask() { 1.19 - return RegMask(); 1.20 + return L7_REGP_mask; 1.21 } 1.22 1.23 %} 1.24 @@ -2441,6 +2444,16 @@ 1.25 /*preserve_g2=*/true, /*force far call*/true); 1.26 %} 1.27 1.28 + enc_class preserve_SP %{ 1.29 + MacroAssembler _masm(&cbuf); 1.30 + __ mov(SP, L7_mh_SP_save); 1.31 + %} 1.32 + 1.33 + enc_class restore_SP %{ 1.34 + MacroAssembler _masm(&cbuf); 1.35 + __ mov(L7_mh_SP_save, SP); 1.36 + %} 1.37 + 1.38 enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL 1.39 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine 1.40 // who we intended to call. 1.41 @@ -9213,6 +9226,7 @@ 1.42 // Call Java Static Instruction 1.43 instruct CallStaticJavaDirect( method meth ) %{ 1.44 match(CallStaticJava); 1.45 + predicate(! ((CallStaticJavaNode*)n)->is_method_handle_invoke()); 1.46 effect(USE meth); 1.47 1.48 size(8); 1.49 @@ -9223,6 +9237,20 @@ 1.50 ins_pipe(simple_call); 1.51 %} 1.52 1.53 +// Call Java Static Instruction (method handle version) 1.54 +instruct CallStaticJavaHandle(method meth, l7RegP l7_mh_SP_save) %{ 1.55 + match(CallStaticJava); 1.56 + predicate(((CallStaticJavaNode*)n)->is_method_handle_invoke()); 1.57 + effect(USE meth, KILL l7_mh_SP_save); 1.58 + 1.59 + size(8); 1.60 + ins_cost(CALL_COST); 1.61 + format %{ "CALL,static/MethodHandle" %} 1.62 + ins_encode(preserve_SP, Java_Static_Call(meth), restore_SP, call_epilog); 1.63 + ins_pc_relative(1); 1.64 + ins_pipe(simple_call); 1.65 +%} 1.66 + 1.67 // Call Java Dynamic Instruction 1.68 instruct CallDynamicJavaDirect( method meth ) %{ 1.69 match(CallDynamicJava);