comparison src/cpu/x86/vm/templateInterpreter_x86_64.cpp @ 1513:df736661d0c8

Merge
author jrose
date Tue, 11 May 2010 15:19:19 -0700
parents 2338d41fbd81
children c18cbe5936b8 ab102d5d923e
comparison
equal deleted inserted replaced
1496:e8e83be27dd7 1513:df736661d0c8
197 __ movl(rbx, Address(rbx, rcx, 197 __ movl(rbx, Address(rbx, rcx,
198 Address::times_ptr, 198 Address::times_ptr,
199 in_bytes(constantPoolCacheOopDesc::base_offset()) + 199 in_bytes(constantPoolCacheOopDesc::base_offset()) +
200 3 * wordSize)); 200 3 * wordSize));
201 __ andl(rbx, 0xFF); 201 __ andl(rbx, 0xFF);
202 if (TaggedStackInterpreter) __ shll(rbx, 1); // 2 slots per parameter.
203 __ lea(rsp, Address(rsp, rbx, Address::times_8)); 202 __ lea(rsp, Address(rsp, rbx, Address::times_8));
204 __ dispatch_next(state, step); 203 __ dispatch_next(state, step);
205 204
206 // out of the main line of code... 205 // out of the main line of code...
207 if (EnableInvokeDynamic) { 206 if (EnableInvokeDynamic) {
415 Label after_frame_check; 414 Label after_frame_check;
416 415
417 // see if the frame is greater than one page in size. If so, 416 // see if the frame is greater than one page in size. If so,
418 // then we need to verify there is enough stack space remaining 417 // then we need to verify there is enough stack space remaining
419 // for the additional locals. 418 // for the additional locals.
420 __ cmpl(rdx, (page_size - overhead_size) / Interpreter::stackElementSize()); 419 __ cmpl(rdx, (page_size - overhead_size) / Interpreter::stackElementSize);
421 __ jcc(Assembler::belowEqual, after_frame_check); 420 __ jcc(Assembler::belowEqual, after_frame_check);
422 421
423 // compute rsp as if this were going to be the last frame on 422 // compute rsp as if this were going to be the last frame on
424 // the stack before the red zone 423 // the stack before the red zone
425 424
426 const Address stack_base(r15_thread, Thread::stack_base_offset()); 425 const Address stack_base(r15_thread, Thread::stack_base_offset());
427 const Address stack_size(r15_thread, Thread::stack_size_offset()); 426 const Address stack_size(r15_thread, Thread::stack_size_offset());
428 427
429 // locals + overhead, in bytes 428 // locals + overhead, in bytes
430 __ mov(rax, rdx); 429 __ mov(rax, rdx);
431 __ shlptr(rax, Interpreter::logStackElementSize()); // 2 slots per parameter. 430 __ shlptr(rax, Interpreter::logStackElementSize); // 2 slots per parameter.
432 __ addptr(rax, overhead_size); 431 __ addptr(rax, overhead_size);
433 432
434 #ifdef ASSERT 433 #ifdef ASSERT
435 Label stack_base_okay, stack_size_okay; 434 Label stack_base_okay, stack_size_okay;
436 // verify that thread stack base is non-zero 435 // verify that thread stack base is non-zero
757 __ pop(rax); // get return address 756 __ pop(rax); // get return address
758 757
759 // for natives the size of locals is zero 758 // for natives the size of locals is zero
760 759
761 // compute beginning of parameters (r14) 760 // compute beginning of parameters (r14)
762 if (TaggedStackInterpreter) __ shll(rcx, 1); // 2 slots per parameter.
763 __ lea(r14, Address(rsp, rcx, Address::times_8, -wordSize)); 761 __ lea(r14, Address(rsp, rcx, Address::times_8, -wordSize));
764 762
765 // add 2 zero-initialized slots for native calls 763 // add 2 zero-initialized slots for native calls
766 // initialize result_handler slot 764 // initialize result_handler slot
767 __ push((int) NULL_WORD); 765 __ push((int) NULL_WORD);
863 __ get_method(method); 861 __ get_method(method);
864 __ verify_oop(method); 862 __ verify_oop(method);
865 __ load_unsigned_short(t, 863 __ load_unsigned_short(t,
866 Address(method, 864 Address(method,
867 methodOopDesc::size_of_parameters_offset())); 865 methodOopDesc::size_of_parameters_offset()));
868 __ shll(t, Interpreter::logStackElementSize()); 866 __ shll(t, Interpreter::logStackElementSize);
869 867
870 __ subptr(rsp, t); 868 __ subptr(rsp, t);
871 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows 869 __ subptr(rsp, frame::arg_reg_save_area_bytes); // windows
872 __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI) 870 __ andptr(rsp, -16); // must be 16 byte boundary (see amd64 ABI)
873 871
1226 1224
1227 // get return address 1225 // get return address
1228 __ pop(rax); 1226 __ pop(rax);
1229 1227
1230 // compute beginning of parameters (r14) 1228 // compute beginning of parameters (r14)
1231 if (TaggedStackInterpreter) __ shll(rcx, 1); // 2 slots per parameter.
1232 __ lea(r14, Address(rsp, rcx, Address::times_8, -wordSize)); 1229 __ lea(r14, Address(rsp, rcx, Address::times_8, -wordSize));
1233 1230
1234 // rdx - # of additional locals 1231 // rdx - # of additional locals
1235 // allocate space for locals 1232 // allocate space for locals
1236 // explicitly initialize locals 1233 // explicitly initialize locals
1237 { 1234 {
1238 Label exit, loop; 1235 Label exit, loop;
1239 __ testl(rdx, rdx); 1236 __ testl(rdx, rdx);
1240 __ jcc(Assembler::lessEqual, exit); // do nothing if rdx <= 0 1237 __ jcc(Assembler::lessEqual, exit); // do nothing if rdx <= 0
1241 __ bind(loop); 1238 __ bind(loop);
1242 if (TaggedStackInterpreter) __ push((int) NULL_WORD); // push tag
1243 __ push((int) NULL_WORD); // initialize local variables 1239 __ push((int) NULL_WORD); // initialize local variables
1244 __ decrementl(rdx); // until everything initialized 1240 __ decrementl(rdx); // until everything initialized
1245 __ jcc(Assembler::greater, loop); 1241 __ jcc(Assembler::greater, loop);
1246 __ bind(exit); 1242 __ bind(exit);
1247 } 1243 }
1484 -(frame::interpreter_frame_initial_sp_offset) + entry_size; 1480 -(frame::interpreter_frame_initial_sp_offset) + entry_size;
1485 1481
1486 const int stub_code = frame::entry_frame_after_call_words; 1482 const int stub_code = frame::entry_frame_after_call_words;
1487 const int extra_stack = methodOopDesc::extra_stack_entries(); 1483 const int extra_stack = methodOopDesc::extra_stack_entries();
1488 const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) * 1484 const int method_stack = (method->max_locals() + method->max_stack() + extra_stack) *
1489 Interpreter::stackElementWords(); 1485 Interpreter::stackElementWords;
1490 return (overhead_size + method_stack + stub_code); 1486 return (overhead_size + method_stack + stub_code);
1491 } 1487 }
1492 1488
1493 int AbstractInterpreter::layout_activation(methodOop method, 1489 int AbstractInterpreter::layout_activation(methodOop method,
1494 int tempcount, 1490 int tempcount,
1505 // The frame interpreter_frame, if not NULL, is guaranteed to be the 1501 // The frame interpreter_frame, if not NULL, is guaranteed to be the
1506 // right size, as determined by a previous call to this method. 1502 // right size, as determined by a previous call to this method.
1507 // It is also guaranteed to be walkable even though it is in a skeletal state 1503 // It is also guaranteed to be walkable even though it is in a skeletal state
1508 1504
1509 // fixed size of an interpreter frame: 1505 // fixed size of an interpreter frame:
1510 int max_locals = method->max_locals() * Interpreter::stackElementWords(); 1506 int max_locals = method->max_locals() * Interpreter::stackElementWords;
1511 int extra_locals = (method->max_locals() - method->size_of_parameters()) * 1507 int extra_locals = (method->max_locals() - method->size_of_parameters()) *
1512 Interpreter::stackElementWords(); 1508 Interpreter::stackElementWords;
1513 1509
1514 int overhead = frame::sender_sp_offset - 1510 int overhead = frame::sender_sp_offset -
1515 frame::interpreter_frame_initial_sp_offset; 1511 frame::interpreter_frame_initial_sp_offset;
1516 // Our locals were accounted for by the caller (or last_frame_adjust 1512 // Our locals were accounted for by the caller (or last_frame_adjust
1517 // on the transistion) Since the callee parameters already account 1513 // on the transistion) Since the callee parameters already account
1518 // for the callee's params we only need to account for the extra 1514 // for the callee's params we only need to account for the extra
1519 // locals. 1515 // locals.
1520 int size = overhead + 1516 int size = overhead +
1521 (callee_locals - callee_param_count)*Interpreter::stackElementWords() + 1517 (callee_locals - callee_param_count)*Interpreter::stackElementWords +
1522 moncount * frame::interpreter_frame_monitor_size() + 1518 moncount * frame::interpreter_frame_monitor_size() +
1523 tempcount* Interpreter::stackElementWords() + popframe_extra_args; 1519 tempcount* Interpreter::stackElementWords + popframe_extra_args;
1524 if (interpreter_frame != NULL) { 1520 if (interpreter_frame != NULL) {
1525 #ifdef ASSERT 1521 #ifdef ASSERT
1526 if (!EnableMethodHandles) 1522 if (!EnableMethodHandles)
1527 // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences? 1523 // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
1528 // Probably, since deoptimization doesn't work yet. 1524 // Probably, since deoptimization doesn't work yet.
1542 BasicObjectLock* monbot = montop - moncount; 1538 BasicObjectLock* monbot = montop - moncount;
1543 interpreter_frame->interpreter_frame_set_monitor_end(monbot); 1539 interpreter_frame->interpreter_frame_set_monitor_end(monbot);
1544 1540
1545 // Set last_sp 1541 // Set last_sp
1546 intptr_t* esp = (intptr_t*) monbot - 1542 intptr_t* esp = (intptr_t*) monbot -
1547 tempcount*Interpreter::stackElementWords() - 1543 tempcount*Interpreter::stackElementWords -
1548 popframe_extra_args; 1544 popframe_extra_args;
1549 interpreter_frame->interpreter_frame_set_last_sp(esp); 1545 interpreter_frame->interpreter_frame_set_last_sp(esp);
1550 1546
1551 // All frames but the initial (oldest) interpreter frame we fill in have 1547 // All frames but the initial (oldest) interpreter frame we fill in have
1552 // a value for sender_sp that allows walking the stack but isn't 1548 // a value for sender_sp that allows walking the stack but isn't
1648 // Compute size of arguments for saving when returning to 1644 // Compute size of arguments for saving when returning to
1649 // deoptimized caller 1645 // deoptimized caller
1650 __ get_method(rax); 1646 __ get_method(rax);
1651 __ load_unsigned_short(rax, Address(rax, in_bytes(methodOopDesc:: 1647 __ load_unsigned_short(rax, Address(rax, in_bytes(methodOopDesc::
1652 size_of_parameters_offset()))); 1648 size_of_parameters_offset())));
1653 __ shll(rax, Interpreter::logStackElementSize()); 1649 __ shll(rax, Interpreter::logStackElementSize);
1654 __ restore_locals(); // XXX do we need this? 1650 __ restore_locals(); // XXX do we need this?
1655 __ subptr(r14, rax); 1651 __ subptr(r14, rax);
1656 __ addptr(r14, wordSize); 1652 __ addptr(r14, wordSize);
1657 // Save these arguments 1653 // Save these arguments
1658 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address, 1654 __ super_call_VM_leaf(CAST_FROM_FN_PTR(address,