432 __ addptr(rax, overhead_size);
433
434 #ifdef ASSERT
435 Label stack_base_okay, stack_size_okay;
436 // verify that thread stack base is non-zero
437 __ cmpptr(stack_base, (int32_t)NULL_WORD);
438 __ jcc(Assembler::notEqual, stack_base_okay);
439 __ stop("stack base is zero");
440 __ bind(stack_base_okay);
441 // verify that thread stack size is non-zero
442 __ cmpptr(stack_size, 0);
443 __ jcc(Assembler::notEqual, stack_size_okay);
444 __ stop("stack size is zero");
445 __ bind(stack_size_okay);
446 #endif
447
448 // Add stack base to locals and subtract stack size
449 __ addptr(rax, stack_base);
450 __ subptr(rax, stack_size);
451
452 // add in the red and yellow zone sizes
453 __ addptr(rax, (StackRedPages + StackYellowPages) * page_size);
454
455 // check against the current stack bottom
456 __ cmpptr(rsp, rax);
457 __ jcc(Assembler::above, after_frame_check);
458
459 __ pop(rax); // get return address
460 __ jump(ExternalAddress(Interpreter::throw_StackOverflowError_entry()));
461
462 // all done with frame size check
463 __ bind(after_frame_check);
464 }
465
466 // Allocate monitor and lock method (asm interpreter)
467 //
468 // Args:
469 // rbx: methodOop
470 // r14: locals
471 //
472 // Kills:
473 // rax
1485 // right size, as determined by a previous call to this method.
1486 // It is also guaranteed to be walkable even though it is in a skeletal state
1487
1488 // fixed size of an interpreter frame:
1489 int max_locals = method->max_locals() * Interpreter::stackElementWords();
1490 int extra_locals = (method->max_locals() - method->size_of_parameters()) *
1491 Interpreter::stackElementWords();
1492
1493 int overhead = frame::sender_sp_offset -
1494 frame::interpreter_frame_initial_sp_offset;
1495 // Our locals were accounted for by the caller (or last_frame_adjust
1496 // on the transistion) Since the callee parameters already account
1497 // for the callee's params we only need to account for the extra
1498 // locals.
1499 int size = overhead +
1500 (callee_locals - callee_param_count)*Interpreter::stackElementWords() +
1501 moncount * frame::interpreter_frame_monitor_size() +
1502 tempcount* Interpreter::stackElementWords() + popframe_extra_args;
1503 if (interpreter_frame != NULL) {
1504 #ifdef ASSERT
1505 assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(),
1506 "Frame not properly walkable");
1507 assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
1508 #endif
1509
1510 interpreter_frame->interpreter_frame_set_method(method);
1511 // NOTE the difference in using sender_sp and
1512 // interpreter_frame_sender_sp interpreter_frame_sender_sp is
1513 // the original sp of the caller (the unextended_sp) and
1514 // sender_sp is fp+16 XXX
1515 intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
1516
1517 interpreter_frame->interpreter_frame_set_locals(locals);
1518 BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
1519 BasicObjectLock* monbot = montop - moncount;
1520 interpreter_frame->interpreter_frame_set_monitor_end(monbot);
1521
1522 // Set last_sp
1523 intptr_t* esp = (intptr_t*) monbot -
1524 tempcount*Interpreter::stackElementWords() -
1525 popframe_extra_args;
1526 interpreter_frame->interpreter_frame_set_last_sp(esp);
|
432 __ addptr(rax, overhead_size);
433
434 #ifdef ASSERT
435 Label stack_base_okay, stack_size_okay;
436 // verify that thread stack base is non-zero
437 __ cmpptr(stack_base, (int32_t)NULL_WORD);
438 __ jcc(Assembler::notEqual, stack_base_okay);
439 __ stop("stack base is zero");
440 __ bind(stack_base_okay);
441 // verify that thread stack size is non-zero
442 __ cmpptr(stack_size, 0);
443 __ jcc(Assembler::notEqual, stack_size_okay);
444 __ stop("stack size is zero");
445 __ bind(stack_size_okay);
446 #endif
447
448 // Add stack base to locals and subtract stack size
449 __ addptr(rax, stack_base);
450 __ subptr(rax, stack_size);
451
452 // Use the maximum number of pages we might bang.
453 const int max_pages = StackShadowPages > (StackRedPages+StackYellowPages) ? StackShadowPages :
454 (StackRedPages+StackYellowPages);
455
456 // add in the red and yellow zone sizes
457 __ addptr(rax, max_pages * page_size);
458
459 // check against the current stack bottom
460 __ cmpptr(rsp, rax);
461 __ jcc(Assembler::above, after_frame_check);
462
463 __ pop(rax); // get return address
464 __ jump(ExternalAddress(Interpreter::throw_StackOverflowError_entry()));
465
466 // all done with frame size check
467 __ bind(after_frame_check);
468 }
469
470 // Allocate monitor and lock method (asm interpreter)
471 //
472 // Args:
473 // rbx: methodOop
474 // r14: locals
475 //
476 // Kills:
477 // rax
1489 // right size, as determined by a previous call to this method.
1490 // It is also guaranteed to be walkable even though it is in a skeletal state
1491
1492 // fixed size of an interpreter frame:
1493 int max_locals = method->max_locals() * Interpreter::stackElementWords();
1494 int extra_locals = (method->max_locals() - method->size_of_parameters()) *
1495 Interpreter::stackElementWords();
1496
1497 int overhead = frame::sender_sp_offset -
1498 frame::interpreter_frame_initial_sp_offset;
1499 // Our locals were accounted for by the caller (or last_frame_adjust
1500 // on the transistion) Since the callee parameters already account
1501 // for the callee's params we only need to account for the extra
1502 // locals.
1503 int size = overhead +
1504 (callee_locals - callee_param_count)*Interpreter::stackElementWords() +
1505 moncount * frame::interpreter_frame_monitor_size() +
1506 tempcount* Interpreter::stackElementWords() + popframe_extra_args;
1507 if (interpreter_frame != NULL) {
1508 #ifdef ASSERT
1509 if (!EnableMethodHandles)
1510 // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
1511 // Probably, since deoptimization doesn't work yet.
1512 assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
1513 assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
1514 #endif
1515
1516 interpreter_frame->interpreter_frame_set_method(method);
1517 // NOTE the difference in using sender_sp and
1518 // interpreter_frame_sender_sp interpreter_frame_sender_sp is
1519 // the original sp of the caller (the unextended_sp) and
1520 // sender_sp is fp+16 XXX
1521 intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
1522
1523 interpreter_frame->interpreter_frame_set_locals(locals);
1524 BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
1525 BasicObjectLock* monbot = montop - moncount;
1526 interpreter_frame->interpreter_frame_set_monitor_end(monbot);
1527
1528 // Set last_sp
1529 intptr_t* esp = (intptr_t*) monbot -
1530 tempcount*Interpreter::stackElementWords() -
1531 popframe_extra_args;
1532 interpreter_frame->interpreter_frame_set_last_sp(esp);
|