Mercurial > hg > truffle
comparison src/cpu/x86/vm/cppInterpreter_x86.cpp @ 10393:603ca7e51354
8010460: Interpreter on some platforms loads ConstMethod::_max_stack and misses extra stack slots for JSR 292
Summary: ConstMethod::max_stack() doesn't account for JSR 292 appendix.
Reviewed-by: kvn
author | roland |
---|---|
date | Wed, 24 Apr 2013 11:49:38 +0200 |
parents | aeaca88565e6 |
children | bd3237e0e18d |
comparison
equal
deleted
inserted
replaced
10392:c07dd9be16e8 | 10393:603ca7e51354 |
---|---|
537 __ subptr(rsp, wordSize); // pre-push stack | 537 __ subptr(rsp, wordSize); // pre-push stack |
538 __ movptr(STATE(_stack), rsp); // set current expression stack tos | 538 __ movptr(STATE(_stack), rsp); // set current expression stack tos |
539 | 539 |
540 // compute full expression stack limit | 540 // compute full expression stack limit |
541 | 541 |
542 const int extra_stack = 0; //6815692//Method::extra_stack_words(); | |
543 __ movptr(rdx, Address(rbx, Method::const_offset())); | 542 __ movptr(rdx, Address(rbx, Method::const_offset())); |
544 __ load_unsigned_short(rdx, Address(rdx, ConstMethod::max_stack_offset())); // get size of expression stack in words | 543 __ load_unsigned_short(rdx, Address(rdx, ConstMethod::max_stack_offset())); // get size of expression stack in words |
545 __ negptr(rdx); // so we can subtract in next step | 544 __ negptr(rdx); // so we can subtract in next step |
546 // Allocate expression stack | 545 // Allocate expression stack |
547 __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -extra_stack)); | 546 __ lea(rsp, Address(rsp, rdx, Address::times_ptr, -Method::extra_stack_words())); |
548 __ movptr(STATE(_stack_limit), rsp); | 547 __ movptr(STATE(_stack_limit), rsp); |
549 } | 548 } |
550 | 549 |
551 #ifdef _LP64 | 550 #ifdef _LP64 |
552 // Make sure stack is properly aligned and sized for the abi | 551 // Make sure stack is properly aligned and sized for the abi |
690 | 689 |
691 // locals + overhead, in bytes | 690 // locals + overhead, in bytes |
692 // Always give one monitor to allow us to start interp if sync method. | 691 // Always give one monitor to allow us to start interp if sync method. |
693 // Any additional monitors need a check when moving the expression stack | 692 // Any additional monitors need a check when moving the expression stack |
694 const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; | 693 const int one_monitor = frame::interpreter_frame_monitor_size() * wordSize; |
695 const int extra_stack = 0; //6815692//Method::extra_stack_entries(); | |
696 __ movptr(rax, Address(rbx, Method::const_offset())); | 694 __ movptr(rax, Address(rbx, Method::const_offset())); |
697 __ load_unsigned_short(rax, Address(rax, ConstMethod::max_stack_offset())); // get size of expression stack in words | 695 __ load_unsigned_short(rax, Address(rax, ConstMethod::max_stack_offset())); // get size of expression stack in words |
698 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), extra_stack + one_monitor)); | 696 __ lea(rax, Address(noreg, rax, Interpreter::stackElementScale(), one_monitor+Method::extra_stack_words())); |
699 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); | 697 __ lea(rax, Address(rax, rdx, Interpreter::stackElementScale(), overhead_size)); |
700 | 698 |
701 #ifdef ASSERT | 699 #ifdef ASSERT |
702 Label stack_base_okay, stack_size_okay; | 700 Label stack_base_okay, stack_size_okay; |
703 // verify that thread stack base is non-zero | 701 // verify that thread stack base is non-zero |
2263 // address, saved rbp and 2 words for a "static long no_params() method" issue. | 2261 // address, saved rbp and 2 words for a "static long no_params() method" issue. |
2264 | 2262 |
2265 const int overhead_size = sizeof(BytecodeInterpreter)/wordSize + | 2263 const int overhead_size = sizeof(BytecodeInterpreter)/wordSize + |
2266 ( frame::sender_sp_offset - frame::link_offset) + 2; | 2264 ( frame::sender_sp_offset - frame::link_offset) + 2; |
2267 | 2265 |
2268 const int extra_stack = 0; //6815692//Method::extra_stack_entries(); | 2266 const int method_stack = (method->max_locals() + method->max_stack()) * |
2269 const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) * | |
2270 Interpreter::stackElementWords; | 2267 Interpreter::stackElementWords; |
2271 return overhead_size + method_stack + stub_code; | 2268 return overhead_size + method_stack + stub_code; |
2272 } | 2269 } |
2273 | 2270 |
2274 // returns the activation size. | 2271 // returns the activation size. |
2329 to_fill->_oop_temp = NULL; | 2326 to_fill->_oop_temp = NULL; |
2330 to_fill->_stack_base = stack_base; | 2327 to_fill->_stack_base = stack_base; |
2331 // Need +1 here because stack_base points to the word just above the first expr stack entry | 2328 // Need +1 here because stack_base points to the word just above the first expr stack entry |
2332 // and stack_limit is supposed to point to the word just below the last expr stack entry. | 2329 // and stack_limit is supposed to point to the word just below the last expr stack entry. |
2333 // See generate_compute_interpreter_state. | 2330 // See generate_compute_interpreter_state. |
2334 int extra_stack = 0; //6815692//Method::extra_stack_entries(); | 2331 to_fill->_stack_limit = stack_base - (method->max_stack() + 1); |
2335 to_fill->_stack_limit = stack_base - (method->max_stack() + extra_stack + 1); | |
2336 to_fill->_monitor_base = (BasicObjectLock*) monitor_base; | 2332 to_fill->_monitor_base = (BasicObjectLock*) monitor_base; |
2337 | 2333 |
2338 to_fill->_self_link = to_fill; | 2334 to_fill->_self_link = to_fill; |
2339 assert(stack >= to_fill->_stack_limit && stack < to_fill->_stack_base, | 2335 assert(stack >= to_fill->_stack_limit && stack < to_fill->_stack_base, |
2340 "Stack top out of range"); | 2336 "Stack top out of range"); |
2378 // First calculate the frame size without any java expression stack | 2374 // First calculate the frame size without any java expression stack |
2379 int short_frame_size = size_activation_helper(extra_locals_size, | 2375 int short_frame_size = size_activation_helper(extra_locals_size, |
2380 monitor_size); | 2376 monitor_size); |
2381 | 2377 |
2382 // Now with full size expression stack | 2378 // Now with full size expression stack |
2383 int extra_stack = 0; //6815692//Method::extra_stack_entries(); | 2379 int full_frame_size = short_frame_size + method->max_stack() * BytesPerWord; |
2384 int full_frame_size = short_frame_size + (method->max_stack() + extra_stack) * BytesPerWord; | |
2385 | 2380 |
2386 // and now with only live portion of the expression stack | 2381 // and now with only live portion of the expression stack |
2387 short_frame_size = short_frame_size + tempcount * BytesPerWord; | 2382 short_frame_size = short_frame_size + tempcount * BytesPerWord; |
2388 | 2383 |
2389 // the size the activation is right now. Only top frame is full size | 2384 // the size the activation is right now. Only top frame is full size |