comparison src/cpu/x86/vm/cppInterpreter_x86.cpp @ 710:e5b0439ef4ae

6655638: dynamic languages need method handles Summary: initial implementation, with known omissions (x86/64, sparc, compiler optim., c-oops, C++ interp.) Reviewed-by: kvn, twisti, never
author jrose
date Wed, 08 Apr 2009 10:56:49 -0700
parents 7bb995fbd3c0
children c18cbe5936b8
comparison
equal deleted inserted replaced
709:1d037ecd7960 710:e5b0439ef4ae
511 __ movptr(STATE(_stack), rsp); // set current expression stack tos 511 __ movptr(STATE(_stack), rsp); // set current expression stack tos
512 512
513 // compute full expression stack limit 513 // compute full expression stack limit
514 514
515 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); 515 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset());
516 const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_words();
516 __ load_unsigned_short(rdx, size_of_stack); // get size of expression stack in words 517 __ load_unsigned_short(rdx, size_of_stack); // get size of expression stack in words
517 __ negptr(rdx); // so we can subtract in next step 518 __ negptr(rdx); // so we can subtract in next step
518 // Allocate expression stack 519 // Allocate expression stack
519 __ lea(rsp, Address(rsp, rdx, Address::times_ptr)); 520 __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -extra_stack));
520 __ movptr(STATE(_stack_limit), rsp); 521 __ movptr(STATE(_stack_limit), rsp);
521 } 522 }
522 523
523 #ifdef _LP64 524 #ifdef _LP64
524 // Make sure stack is properly aligned and sized for the abi 525 // Make sure stack is properly aligned and sized for the abi
657 // locals + overhead, in bytes 658 // locals + overhead, in bytes
658 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset()); 659 const Address size_of_stack (rbx, methodOopDesc::max_stack_offset());
659 // Always give one monitor to allow us to start interp if sync method. 660 // Always give one monitor to allow us to start interp if sync method.
660 // Any additional monitors need a check when moving the expression stack 661 // Any additional monitors need a check when moving the expression stack
661 const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; 662 const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize;
663 const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
662 __ load_unsigned_short(rax, size_of_stack); // get size of expression stack in words 664 __ load_unsigned_short(rax, size_of_stack); // get size of expression stack in words
663 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor)); 665 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor));
664 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); 666 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size));
665 667
666 #ifdef ASSERT 668 #ifdef ASSERT
667 Label stack_base_okay, stack_size_okay; 669 Label stack_base_okay, stack_size_okay;
668 // verify that thread stack base is non-zero 670 // verify that thread stack base is non-zero
2183 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break; 2185 case Interpreter::native : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(false); break;
2184 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break; 2186 case Interpreter::native_synchronized : entry_point = ((InterpreterGenerator*)this)->generate_native_entry(true); break;
2185 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break; 2187 case Interpreter::empty : entry_point = ((InterpreterGenerator*)this)->generate_empty_entry(); break;
2186 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break; 2188 case Interpreter::accessor : entry_point = ((InterpreterGenerator*)this)->generate_accessor_entry(); break;
2187 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break; 2189 case Interpreter::abstract : entry_point = ((InterpreterGenerator*)this)->generate_abstract_entry(); break;
2190 case Interpreter::method_handle : entry_point = ((InterpreterGenerator*)this)->generate_method_handle_entry(); break;
2188 2191
2189 case Interpreter::java_lang_math_sin : // fall thru 2192 case Interpreter::java_lang_math_sin : // fall thru
2190 case Interpreter::java_lang_math_cos : // fall thru 2193 case Interpreter::java_lang_math_cos : // fall thru
2191 case Interpreter::java_lang_math_tan : // fall thru 2194 case Interpreter::java_lang_math_tan : // fall thru
2192 case Interpreter::java_lang_math_abs : // fall thru 2195 case Interpreter::java_lang_math_abs : // fall thru
2222 // address, saved rbp and 2 words for a "static long no_params() method" issue. 2225 // address, saved rbp and 2 words for a "static long no_params() method" issue.
2223 2226
2224 const int overhead_size = sizeof(BytecodeInterpreter)/wordSize + 2227 const int overhead_size = sizeof(BytecodeInterpreter)/wordSize +
2225 ( frame::sender_sp_offset - frame::link_offset) + 2; 2228 ( frame::sender_sp_offset - frame::link_offset) + 2;
2226 2229
2227 const int method_stack = (method->max_locals() + method->max_stack()) * 2230 const int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
2231 const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
2228 Interpreter::stackElementWords(); 2232 Interpreter::stackElementWords();
2229 return overhead_size + method_stack + stub_code; 2233 return overhead_size + method_stack + stub_code;
2230 } 2234 }
2231 2235
2232 // returns the activation size. 2236 // returns the activation size.
2287 to_fill->_oop_temp = NULL; 2291 to_fill->_oop_temp = NULL;
2288 to_fill->_stack_base = stack_base; 2292 to_fill->_stack_base = stack_base;
2289 // Need +1 here because stack_base points to the word just above the first expr stack entry 2293 // Need +1 here because stack_base points to the word just above the first expr stack entry
2290 // and stack_limit is supposed to point to the word just below the last expr stack entry. 2294 // and stack_limit is supposed to point to the word just below the last expr stack entry.
2291 // See generate_compute_interpreter_state. 2295 // See generate_compute_interpreter_state.
2292 to_fill->_stack_limit = stack_base - (method->max_stack() + 1); 2296 int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
2297 to_fill->_stack_limit = stack_base - (method->max_stack() + extra_stack + 1);
2293 to_fill->_monitor_base = (BasicObjectLock*) monitor_base; 2298 to_fill->_monitor_base = (BasicObjectLock*) monitor_base;
2294 2299
2295 to_fill->_self_link = to_fill; 2300 to_fill->_self_link = to_fill;
2296 assert(stack >= to_fill->_stack_limit && stack < to_fill->_stack_base, 2301 assert(stack >= to_fill->_stack_limit && stack < to_fill->_stack_base,
2297 "Stack top out of range"); 2302 "Stack top out of range");
2333 // First calculate the frame size without any java expression stack 2338 // First calculate the frame size without any java expression stack
2334 int short_frame_size = size_activation_helper(extra_locals_size, 2339 int short_frame_size = size_activation_helper(extra_locals_size,
2335 monitor_size); 2340 monitor_size);
2336 2341
2337 // Now with full size expression stack 2342 // Now with full size expression stack
2338 int full_frame_size = short_frame_size + method->max_stack() * BytesPerWord; 2343 int extra_stack = 0; //6815692//methodOopDesc::extra_stack_entries();
2344 int full_frame_size = short_frame_size + (method->max_stack() + extra_stack) * BytesPerWord;
2339 2345
2340 // and now with only live portion of the expression stack 2346 // and now with only live portion of the expression stack
2341 short_frame_size = short_frame_size + tempcount * BytesPerWord; 2347 short_frame_size = short_frame_size + tempcount * BytesPerWord;
2342 2348
2343 // the size the activation is right now. Only top frame is full size 2349 // the size the activation is right now. Only top frame is full size