--- old/src/cpu/sparc/vm/templateInterpreter_sparc.cpp 2010-04-26 07:45:31.791998374 -0700 +++ new/src/cpu/sparc/vm/templateInterpreter_sparc.cpp 2010-04-26 07:45:31.372630818 -0700 @@ -151,8 +151,10 @@ address TemplateInterpreterGenerator::generate_return_entry_for(TosState state, int step) { - address compiled_entry = __ pc(); + TosState incoming_state = state; + Label cont; + address compiled_entry = __ pc(); address entry = __ pc(); #if !defined(_LP64) && defined(COMPILER2) @@ -165,12 +167,11 @@ // do this here. Unfortunately if we did a rethrow we'd see an machepilog node // first which would move g1 -> O0/O1 and destroy the exception we were throwing. - if( state == ltos ) { - __ srl (G1, 0,O1); - __ srlx(G1,32,O0); + if (incoming_state == ltos) { + __ srl (G1, 0, O1); + __ srlx(G1, 32, O0); } -#endif /* !_LP64 && COMPILER2 */ - +#endif // !_LP64 && COMPILER2 __ bind(cont); @@ -182,10 +183,17 @@ __ mov(Llast_SP, SP); // Remove any adapter added stack space. - + Label L_got_cache, L_giant_index; const Register cache = G3_scratch; const Register size = G1_scratch; + if (EnableInvokeDynamic) { + __ ldub(Address(Lbcp, 0), G1_scratch); // Load current bytecode. + __ cmp(G1_scratch, Bytecodes::_invokedynamic); + __ br(Assembler::equal, false, Assembler::pn, L_giant_index); + __ delayed()->nop(); + } __ get_cache_and_index_at_bcp(cache, G1_scratch, 1); + __ bind(L_got_cache); __ ld_ptr(cache, constantPoolCacheOopDesc::base_offset() + ConstantPoolCacheEntry::flags_offset(), size); __ and3(size, 0xFF, size); // argument size in words @@ -193,6 +201,14 @@ __ add(Lesp, size, Lesp); // pop arguments __ dispatch_next(state, step); + // out of the main line of code... + if (EnableInvokeDynamic) { + __ bind(L_giant_index); + __ get_cache_and_index_at_bcp(cache, G1_scratch, 1, true); + __ ba(false, L_got_cache); + __ delayed()->nop(); + } + return entry; }