4307 // Note: monitorenter & exit are symmetric routines; which is reflected
4308 // in the assembly code structure as well
4309 //
4310 // Stack layout:
4311 //
4312 // [expressions ] <--- rsp = expression stack top
4313 // ..
4314 // [expressions ]
4315 // [monitor entry] <--- monitor block top = expression stack bot
4316 // ..
4317 // [monitor entry]
4318 // [frame data ] <--- monitor block bot
4319 // ...
4320 // [saved rbp ] <--- rbp
4321 void TemplateTable::monitorenter() {
4322 transition(atos, vtos);
4323
4324 // check for NULL object
4325 __ null_check(rax);
4326
4327 const Address monitor_block_top(
4328 rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
4329 const Address monitor_block_bot(
4330 rbp, frame::interpreter_frame_initial_sp_offset * wordSize);
4331 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
4332
4333 Label allocated;
4334
4335 Register rtop = LP64_ONLY(c_rarg3) NOT_LP64(rcx);
4336 Register rbot = LP64_ONLY(c_rarg2) NOT_LP64(rbx);
4337 Register rmon = LP64_ONLY(c_rarg1) NOT_LP64(rdx);
4338
4339 // initialize entry pointer
4340 __ xorl(rmon, rmon); // points to free slot or NULL
4341
4342 // find a free slot in the monitor block (result in rmon)
4343 {
4344 Label entry, loop, exit;
4345 __ movptr(rtop, monitor_block_top); // points to current entry,
4346 // starting with top-most entry
4403 __ increment(rbcp);
4404
4405 // store object
4406 __ movptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), rax);
4407 __ lock_object(rmon);
4408
4409 // check to make sure this monitor doesn't cause stack overflow after locking
4410 __ save_bcp(); // in case of exception
4411 __ generate_stack_overflow_check(0);
4412
4413 // The bcp has already been incremented. Just need to dispatch to
4414 // next instruction.
4415 __ dispatch_next(vtos);
4416 }
4417
4418 void TemplateTable::monitorexit() {
4419 transition(atos, vtos);
4420
4421 // check for NULL object
4422 __ null_check(rax);
4423
4424 const Address monitor_block_top(
4425 rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
4426 const Address monitor_block_bot(
4427 rbp, frame::interpreter_frame_initial_sp_offset * wordSize);
4428 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
4429
4430 Register rtop = LP64_ONLY(c_rarg1) NOT_LP64(rdx);
4431 Register rbot = LP64_ONLY(c_rarg2) NOT_LP64(rbx);
4432
4433 Label found;
4434
4435 // find matching slot
4436 {
4437 Label entry, loop;
4438 __ movptr(rtop, monitor_block_top); // points to current entry,
4439 // starting with top-most entry
4440 __ lea(rbot, monitor_block_bot); // points to word before bottom
4441 // of monitor block
4442 __ jmpb(entry);
|
4307 // Note: monitorenter & exit are symmetric routines; which is reflected
4308 // in the assembly code structure as well
4309 //
4310 // Stack layout:
4311 //
4312 // [expressions ] <--- rsp = expression stack top
4313 // ..
4314 // [expressions ]
4315 // [monitor entry] <--- monitor block top = expression stack bot
4316 // ..
4317 // [monitor entry]
4318 // [frame data ] <--- monitor block bot
4319 // ...
4320 // [saved rbp ] <--- rbp
4321 void TemplateTable::monitorenter() {
4322 transition(atos, vtos);
4323
4324 // check for NULL object
4325 __ null_check(rax);
4326
4327 __ resolve_for_write(OOP_NOT_NULL, rax);
4328
4329 const Address monitor_block_top(
4330 rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
4331 const Address monitor_block_bot(
4332 rbp, frame::interpreter_frame_initial_sp_offset * wordSize);
4333 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
4334
4335 Label allocated;
4336
4337 Register rtop = LP64_ONLY(c_rarg3) NOT_LP64(rcx);
4338 Register rbot = LP64_ONLY(c_rarg2) NOT_LP64(rbx);
4339 Register rmon = LP64_ONLY(c_rarg1) NOT_LP64(rdx);
4340
4341 // initialize entry pointer
4342 __ xorl(rmon, rmon); // points to free slot or NULL
4343
4344 // find a free slot in the monitor block (result in rmon)
4345 {
4346 Label entry, loop, exit;
4347 __ movptr(rtop, monitor_block_top); // points to current entry,
4348 // starting with top-most entry
4405 __ increment(rbcp);
4406
4407 // store object
4408 __ movptr(Address(rmon, BasicObjectLock::obj_offset_in_bytes()), rax);
4409 __ lock_object(rmon);
4410
4411 // check to make sure this monitor doesn't cause stack overflow after locking
4412 __ save_bcp(); // in case of exception
4413 __ generate_stack_overflow_check(0);
4414
4415 // The bcp has already been incremented. Just need to dispatch to
4416 // next instruction.
4417 __ dispatch_next(vtos);
4418 }
4419
4420 void TemplateTable::monitorexit() {
4421 transition(atos, vtos);
4422
4423 // check for NULL object
4424 __ null_check(rax);
4425
4426 __ resolve_for_write(OOP_NOT_NULL, rax);
4427
4428 const Address monitor_block_top(
4429 rbp, frame::interpreter_frame_monitor_block_top_offset * wordSize);
4430 const Address monitor_block_bot(
4431 rbp, frame::interpreter_frame_initial_sp_offset * wordSize);
4432 const int entry_size = frame::interpreter_frame_monitor_size() * wordSize;
4433
4434 Register rtop = LP64_ONLY(c_rarg1) NOT_LP64(rdx);
4435 Register rbot = LP64_ONLY(c_rarg2) NOT_LP64(rbx);
4436
4437 Label found;
4438
4439 // find matching slot
4440 {
4441 Label entry, loop;
4442 __ movptr(rtop, monitor_block_top); // points to current entry,
4443 // starting with top-most entry
4444 __ lea(rbot, monitor_block_bot); // points to word before bottom
4445 // of monitor block
4446 __ jmpb(entry);
|