Mercurial > hg > truffle
comparison src/cpu/x86/vm/c1_Runtime1_x86.cpp @ 342:37f87013dfd8
6711316: Open source the Garbage-First garbage collector
Summary: First mercurial integration of the code for the Garbage-First garbage collector.
Reviewed-by: apetrusenko, iveresov, jmasa, sgoldman, tonyp, ysr
author | ysr |
---|---|
date | Thu, 05 Jun 2008 15:57:56 -0700 |
parents | a61af66fc99e |
children | f8199438385b |
comparison
equal
deleted
inserted
replaced
189:0b27f3512f9e | 342:37f87013dfd8 |
---|---|
1383 __ popl(rsi); | 1383 __ popl(rsi); |
1384 __ ret(0); | 1384 __ ret(0); |
1385 } | 1385 } |
1386 break; | 1386 break; |
1387 | 1387 |
1388 #ifndef SERIALGC | |
1389 case g1_pre_barrier_slow_id: | |
1390 { | |
1391 StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments); | |
1392 // arg0 : previous value of memory | |
1393 | |
1394 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1395 if (bs->kind() != BarrierSet::G1SATBCTLogging) { | |
1396 __ movl(rax, (int)id); | |
1397 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); | |
1398 __ should_not_reach_here(); | |
1399 break; | |
1400 } | |
1401 | |
1402 __ pushl(rax); | |
1403 __ pushl(rdx); | |
1404 | |
1405 const Register pre_val = rax; | |
1406 const Register thread = rax; | |
1407 const Register tmp = rdx; | |
1408 | |
1409 __ get_thread(thread); | |
1410 | |
1411 Address in_progress(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1412 PtrQueue::byte_offset_of_active())); | |
1413 | |
1414 Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1415 PtrQueue::byte_offset_of_index())); | |
1416 Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() + | |
1417 PtrQueue::byte_offset_of_buf())); | |
1418 | |
1419 | |
1420 Label done; | |
1421 Label runtime; | |
1422 | |
1423 // Can we store original value in the thread's buffer? | |
1424 | |
1425 __ cmpl(queue_index, 0); | |
1426 __ jcc(Assembler::equal, runtime); | |
1427 __ subl(queue_index, wordSize); | |
1428 __ movl(tmp, buffer); | |
1429 __ addl(tmp, queue_index); | |
1430 // prev_val (rax) | |
1431 f.load_argument(0, pre_val); | |
1432 __ movl(Address(tmp, 0), pre_val); | |
1433 __ jmp(done); | |
1434 | |
1435 __ bind(runtime); | |
1436 // load the pre-value | |
1437 __ pushl(rcx); | |
1438 f.load_argument(0, rcx); | |
1439 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_pre), rcx, thread); | |
1440 __ popl(rcx); | |
1441 | |
1442 __ bind(done); | |
1443 __ popl(rdx); | |
1444 __ popl(rax); | |
1445 } | |
1446 break; | |
1447 | |
1448 case g1_post_barrier_slow_id: | |
1449 { | |
1450 StubFrame f(sasm, "g1_post_barrier", dont_gc_arguments); | |
1451 | |
1452 | |
1453 // arg0: store_address | |
1454 Address store_addr(rbp, 2*BytesPerWord); | |
1455 | |
1456 BarrierSet* bs = Universe::heap()->barrier_set(); | |
1457 CardTableModRefBS* ct = (CardTableModRefBS*)bs; | |
1458 Label done; | |
1459 Label runtime; | |
1460 | |
1461 // At this point we know new_value is non-NULL and the new_value crosses regsion. | |
1462 // Must check to see if card is already dirty | |
1463 | |
1464 const Register card_index = rdx; | |
1465 | |
1466 const Register thread = rax; | |
1467 Address queue_index(thread, in_bytes(JavaThread::dirty_card_queue_offset() + | |
1468 PtrQueue::byte_offset_of_index())); | |
1469 Address buffer(thread, in_bytes(JavaThread::dirty_card_queue_offset() + | |
1470 PtrQueue::byte_offset_of_buf())); | |
1471 | |
1472 __ pushl(rax); | |
1473 __ pushl(rdx); | |
1474 | |
1475 __ movl(card_index, store_addr); | |
1476 __ get_thread(rax); | |
1477 __ shrl(card_index, CardTableModRefBS::card_shift); | |
1478 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); | |
1479 | |
1480 ExternalAddress cardtable((address)ct->byte_map_base); | |
1481 Address index(noreg, card_index, Address::times_1); | |
1482 const Register card_addr = rdx; | |
1483 __ leal(card_addr, __ as_Address(ArrayAddress(cardtable, index))); | |
1484 __ cmpb(Address(card_addr, 0), 0); | |
1485 __ jcc(Assembler::equal, done); | |
1486 | |
1487 // storing region crossing non-NULL, card is clean. | |
1488 // dirty card and log. | |
1489 | |
1490 __ movb(Address(card_addr, 0), 0); | |
1491 | |
1492 __ cmpl(queue_index, 0); | |
1493 __ jcc(Assembler::equal, runtime); | |
1494 __ subl(queue_index, wordSize); | |
1495 | |
1496 const Register buffer_addr = rbx; | |
1497 __ pushl(rbx); | |
1498 | |
1499 __ movl(buffer_addr, buffer); | |
1500 __ addl(buffer_addr, queue_index); | |
1501 __ movl(Address(buffer_addr, 0), card_addr); | |
1502 __ popl(rbx); | |
1503 __ jmp(done); | |
1504 | |
1505 __ bind(runtime); | |
1506 __ pushl(rcx); | |
1507 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::g1_wb_post), card_addr, thread); | |
1508 __ popl(rcx); | |
1509 | |
1510 __ bind(done); | |
1511 __ popl(rdx); | |
1512 __ popl(rax); | |
1513 | |
1514 } | |
1515 break; | |
1516 #endif // !SERIALGC | |
1517 | |
1388 default: | 1518 default: |
1389 { StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); | 1519 { StubFrame f(sasm, "unimplemented entry", dont_gc_arguments); |
1390 __ movl(rax, (int)id); | 1520 __ movl(rax, (int)id); |
1391 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); | 1521 __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax); |
1392 __ should_not_reach_here(); | 1522 __ should_not_reach_here(); |