3454 eden_allocate(top, t1, 0, t2, t3, slow_case); 3455 3456 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset())); 3457 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_top_offset())); 3458 #ifdef ASSERT 3459 // check that tlab_size (t1) is still valid 3460 { 3461 Label ok; 3462 ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t2); 3463 sll_ptr(t2, LogHeapWordSize, t2); 3464 cmp_and_br_short(t1, t2, Assembler::equal, Assembler::pt, ok); 3465 STOP("assert(t1 == tlab_size)"); 3466 should_not_reach_here(); 3467 3468 bind(ok); 3469 } 3470 #endif // ASSERT 3471 add(top, t1, top); // t1 is tlab_size 3472 sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top); 3473 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset())); 3474 verify_tlab(); 3475 ba(retry); 3476 delayed()->nop(); 3477 } 3478 3479 void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes, 3480 Register t1, Register t2) { 3481 // Bump total bytes allocated by this thread 3482 assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch 3483 assert_different_registers(size_in_bytes.register_or_noreg(), t1, t2); 3484 // v8 support has gone the way of the dodo 3485 ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1); 3486 add(t1, ensure_simm13_or_reg(size_in_bytes, t2), t1); 3487 stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset())); 3488 } 3489 3490 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { 3491 switch (cond) { 3492 // Note some conditions are synonyms for others 3493 case Assembler::never: return Assembler::always; 3494 case Assembler::zero: return Assembler::notZero; 3495 case Assembler::lessEqual: return Assembler::greater; 3496 case Assembler::less: return Assembler::greaterEqual; | 3454 eden_allocate(top, t1, 0, t2, t3, slow_case); 3455 3456 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_start_offset())); 3457 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_top_offset())); 3458 #ifdef ASSERT 3459 // check that tlab_size (t1) is still valid 3460 { 3461 Label ok; 3462 ld_ptr(G2_thread, in_bytes(JavaThread::tlab_size_offset()), t2); 3463 sll_ptr(t2, LogHeapWordSize, t2); 3464 cmp_and_br_short(t1, t2, Assembler::equal, Assembler::pt, ok); 3465 STOP("assert(t1 == tlab_size)"); 3466 should_not_reach_here(); 3467 3468 bind(ok); 3469 } 3470 #endif // ASSERT 3471 add(top, t1, top); // t1 is tlab_size 3472 sub(top, ThreadLocalAllocBuffer::alignment_reserve_in_bytes(), top); 3473 st_ptr(top, G2_thread, in_bytes(JavaThread::tlab_end_offset())); 3474 3475 if (ZeroTLAB) { 3476 // This is a fast TLAB refill, therefore the GC is not notified of it. 3477 // So compiled code must fill the new TLAB with zeroes. 3478 ld_ptr(G2_thread, in_bytes(JavaThread::tlab_start_offset()), t2); 3479 zero_memory(t2, t1); 3480 } 3481 verify_tlab(); 3482 ba(retry); 3483 delayed()->nop(); 3484 } 3485 3486 void MacroAssembler::zero_memory(Register base, Register index) { 3487 assert_different_registers(base, index); 3488 Label loop; 3489 bind(loop); 3490 subcc(index, HeapWordSize, index); 3491 brx(Assembler::greaterEqual, true, Assembler::pt, loop); 3492 delayed()->st_ptr(G0, base, index); 3493 } 3494 3495 void MacroAssembler::incr_allocated_bytes(RegisterOrConstant size_in_bytes, 3496 Register t1, Register t2) { 3497 // Bump total bytes allocated by this thread 3498 assert(t1->is_global(), "must be global reg"); // so all 64 bits are saved on a context switch 3499 assert_different_registers(size_in_bytes.register_or_noreg(), t1, t2); 3500 // v8 support has gone the way of the dodo 3501 ldx(G2_thread, in_bytes(JavaThread::allocated_bytes_offset()), t1); 3502 add(t1, ensure_simm13_or_reg(size_in_bytes, t2), t1); 3503 stx(t1, G2_thread, in_bytes(JavaThread::allocated_bytes_offset())); 3504 } 3505 3506 Assembler::Condition MacroAssembler::negate_condition(Assembler::Condition cond) { 3507 switch (cond) { 3508 // Note some conditions are synonyms for others 3509 case Assembler::never: return Assembler::always; 3510 case Assembler::zero: return Assembler::notZero; 3511 case Assembler::lessEqual: return Assembler::greater; 3512 case Assembler::less: return Assembler::greaterEqual; |