413 __ addptr(rax, overhead_size);
414
415 #ifdef ASSERT
416 Label stack_base_okay, stack_size_okay;
417 // verify that thread stack base is non-zero
418 __ cmpptr(stack_base, (int32_t)NULL_WORD);
419 __ jcc(Assembler::notEqual, stack_base_okay);
420 __ stop("stack base is zero");
421 __ bind(stack_base_okay);
422 // verify that thread stack size is non-zero
423 __ cmpptr(stack_size, 0);
424 __ jcc(Assembler::notEqual, stack_size_okay);
425 __ stop("stack size is zero");
426 __ bind(stack_size_okay);
427 #endif
428
429 // Add stack base to locals and subtract stack size
430 __ addptr(rax, stack_base);
431 __ subptr(rax, stack_size);
432
433 // add in the red and yellow zone sizes
434 __ addptr(rax, (StackRedPages + StackYellowPages) * page_size);
435
436 // check against the current stack bottom
437 __ cmpptr(rsp, rax);
438 __ jcc(Assembler::above, after_frame_check);
439
440 __ pop(rax); // get return address
441 __ jump(ExternalAddress(Interpreter::throw_StackOverflowError_entry()));
442
443 // all done with frame size check
444 __ bind(after_frame_check);
445 }
446
447 // Allocate monitor and lock method (asm interpreter)
448 //
449 // Args:
450 // rbx: methodOop
451 // r14: locals
452 //
453 // Kills:
454 // rax
1466 // right size, as determined by a previous call to this method.
1467 // It is also guaranteed to be walkable even though it is in a skeletal state
1468
1469 // fixed size of an interpreter frame:
1470 int max_locals = method->max_locals() * Interpreter::stackElementWords();
1471 int extra_locals = (method->max_locals() - method->size_of_parameters()) *
1472 Interpreter::stackElementWords();
1473
1474 int overhead = frame::sender_sp_offset -
1475 frame::interpreter_frame_initial_sp_offset;
1476 // Our locals were accounted for by the caller (or last_frame_adjust
1477 // on the transistion) Since the callee parameters already account
1478 // for the callee's params we only need to account for the extra
1479 // locals.
1480 int size = overhead +
1481 (callee_locals - callee_param_count)*Interpreter::stackElementWords() +
1482 moncount * frame::interpreter_frame_monitor_size() +
1483 tempcount* Interpreter::stackElementWords() + popframe_extra_args;
1484 if (interpreter_frame != NULL) {
1485 #ifdef ASSERT
1486 assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(),
1487 "Frame not properly walkable");
1488 assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
1489 #endif
1490
1491 interpreter_frame->interpreter_frame_set_method(method);
1492 // NOTE the difference in using sender_sp and
1493 // interpreter_frame_sender_sp interpreter_frame_sender_sp is
1494 // the original sp of the caller (the unextended_sp) and
1495 // sender_sp is fp+16 XXX
1496 intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
1497
1498 interpreter_frame->interpreter_frame_set_locals(locals);
1499 BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
1500 BasicObjectLock* monbot = montop - moncount;
1501 interpreter_frame->interpreter_frame_set_monitor_end(monbot);
1502
1503 // Set last_sp
1504 intptr_t* esp = (intptr_t*) monbot -
1505 tempcount*Interpreter::stackElementWords() -
1506 popframe_extra_args;
1507 interpreter_frame->interpreter_frame_set_last_sp(esp);
|
413 __ addptr(rax, overhead_size);
414
415 #ifdef ASSERT
416 Label stack_base_okay, stack_size_okay;
417 // verify that thread stack base is non-zero
418 __ cmpptr(stack_base, (int32_t)NULL_WORD);
419 __ jcc(Assembler::notEqual, stack_base_okay);
420 __ stop("stack base is zero");
421 __ bind(stack_base_okay);
422 // verify that thread stack size is non-zero
423 __ cmpptr(stack_size, 0);
424 __ jcc(Assembler::notEqual, stack_size_okay);
425 __ stop("stack size is zero");
426 __ bind(stack_size_okay);
427 #endif
428
429 // Add stack base to locals and subtract stack size
430 __ addptr(rax, stack_base);
431 __ subptr(rax, stack_size);
432
433 // Use the maximum number of pages we might bang.
434 const int max_pages = StackShadowPages > (StackRedPages+StackYellowPages) ? StackShadowPages :
435 (StackRedPages+StackYellowPages);
436
437 // add in the red and yellow zone sizes
438 __ addptr(rax, max_pages * page_size);
439
440 // check against the current stack bottom
441 __ cmpptr(rsp, rax);
442 __ jcc(Assembler::above, after_frame_check);
443
444 __ pop(rax); // get return address
445 __ jump(ExternalAddress(Interpreter::throw_StackOverflowError_entry()));
446
447 // all done with frame size check
448 __ bind(after_frame_check);
449 }
450
451 // Allocate monitor and lock method (asm interpreter)
452 //
453 // Args:
454 // rbx: methodOop
455 // r14: locals
456 //
457 // Kills:
458 // rax
1470 // right size, as determined by a previous call to this method.
1471 // It is also guaranteed to be walkable even though it is in a skeletal state
1472
1473 // fixed size of an interpreter frame:
1474 int max_locals = method->max_locals() * Interpreter::stackElementWords();
1475 int extra_locals = (method->max_locals() - method->size_of_parameters()) *
1476 Interpreter::stackElementWords();
1477
1478 int overhead = frame::sender_sp_offset -
1479 frame::interpreter_frame_initial_sp_offset;
1480 // Our locals were accounted for by the caller (or last_frame_adjust
1481 // on the transistion) Since the callee parameters already account
1482 // for the callee's params we only need to account for the extra
1483 // locals.
1484 int size = overhead +
1485 (callee_locals - callee_param_count)*Interpreter::stackElementWords() +
1486 moncount * frame::interpreter_frame_monitor_size() +
1487 tempcount* Interpreter::stackElementWords() + popframe_extra_args;
1488 if (interpreter_frame != NULL) {
1489 #ifdef ASSERT
1490 if (!EnableMethodHandles)
1491 // @@@ FIXME: Should we correct interpreter_frame_sender_sp in the calling sequences?
1492 // Probably, since deoptimization doesn't work yet.
1493 assert(caller->unextended_sp() == interpreter_frame->interpreter_frame_sender_sp(), "Frame not properly walkable");
1494 assert(caller->sp() == interpreter_frame->sender_sp(), "Frame not properly walkable(2)");
1495 #endif
1496
1497 interpreter_frame->interpreter_frame_set_method(method);
1498 // NOTE the difference in using sender_sp and
1499 // interpreter_frame_sender_sp interpreter_frame_sender_sp is
1500 // the original sp of the caller (the unextended_sp) and
1501 // sender_sp is fp+16 XXX
1502 intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1;
1503
1504 interpreter_frame->interpreter_frame_set_locals(locals);
1505 BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin();
1506 BasicObjectLock* monbot = montop - moncount;
1507 interpreter_frame->interpreter_frame_set_monitor_end(monbot);
1508
1509 // Set last_sp
1510 intptr_t* esp = (intptr_t*) monbot -
1511 tempcount*Interpreter::stackElementWords() -
1512 popframe_extra_args;
1513 interpreter_frame->interpreter_frame_set_last_sp(esp);
|