12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/g1/g1BarrierSet.hpp"
29 #include "gc/g1/g1BarrierSetAssembler.hpp"
30 #include "gc/g1/g1BarrierSetRuntime.hpp"
31 #include "gc/g1/g1CardTable.hpp"
32 #include "gc/g1/g1ThreadLocalData.hpp"
33 #include "gc/g1/heapRegion.hpp"
34 #include "interpreter/interp_masm.hpp"
35 #include "runtime/sharedRuntime.hpp"
36 #ifdef COMPILER1
37 #include "c1/c1_LIRAssembler.hpp"
38 #include "c1/c1_MacroAssembler.hpp"
39 #include "gc/g1/c1/g1BarrierSetC1.hpp"
40 #endif
41
42 #define __ masm->
43
44 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
45 Register from, Register to, Register count,
46 Register preserve1, Register preserve2) {
47 bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
48 // With G1, don't generate the call if we statically know that the target in uninitialized
49 if (!dest_uninitialized) {
50 int spill_slots = 3;
51 if (preserve1 != noreg) { spill_slots++; }
441
442 __ ld(tmp2, satb_q_buf_byte_offset, R16_thread);
443 __ ld(pre_val, -8, R1_SP); // Load from stack.
444 __ addi(tmp, tmp, -oopSize);
445
446 __ std(tmp, satb_q_index_byte_offset, R16_thread);
447 __ stdx(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
448
449 __ bind(marking_not_active);
450 // Restore temp registers and return-from-leaf.
451 __ ld(tmp2, -24, R1_SP);
452 __ ld(tmp, -16, R1_SP);
453 __ blr();
454
455 __ bind(refill);
456 const int nbytes_save = (MacroAssembler::num_volatile_regs + stack_slots) * BytesPerWord;
457 __ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
458 __ mflr(R0);
459 __ std(R0, _abi(lr), R1_SP);
460 __ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
461 __ call_VM_leaf(CAST_FROM_FN_PTR(address, SATBMarkQueueSet::handle_zero_index_for_thread), R16_thread);
462 __ pop_frame();
463 __ ld(R0, _abi(lr), R1_SP);
464 __ mtlr(R0);
465 __ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
466 __ b(restart);
467 }
468
469 void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) {
470 G1BarrierSet* bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
471
472 __ set_info("g1_post_barrier_slow_id", false);
473
474 // Using stack slots: spill addr, spill tmp2
475 const int stack_slots = 2;
476 Register tmp = R0;
477 Register addr = R14;
478 Register tmp2 = R15;
479 jbyte* byte_map_base = bs->card_table()->byte_map_base();
480
481 Label restart, refill, ret;
|
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * version 2 for more details (a copy is included in the LICENSE file that
14 * accompanied this code).
15 *
16 * You should have received a copy of the GNU General Public License version
17 * 2 along with this work; if not, write to the Free Software Foundation,
18 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
19 *
20 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
21 * or visit www.oracle.com if you need additional information or have any
22 * questions.
23 *
24 */
25
26 #include "precompiled.hpp"
27 #include "asm/macroAssembler.inline.hpp"
28 #include "gc/g1/g1BarrierSet.hpp"
29 #include "gc/g1/g1BarrierSetAssembler.hpp"
30 #include "gc/g1/g1BarrierSetRuntime.hpp"
31 #include "gc/g1/g1CardTable.hpp"
32 #include "gc/g1/g1SATBMarkQueueSet.hpp"
33 #include "gc/g1/g1ThreadLocalData.hpp"
34 #include "gc/g1/heapRegion.hpp"
35 #include "interpreter/interp_masm.hpp"
36 #include "runtime/sharedRuntime.hpp"
37 #ifdef COMPILER1
38 #include "c1/c1_LIRAssembler.hpp"
39 #include "c1/c1_MacroAssembler.hpp"
40 #include "gc/g1/c1/g1BarrierSetC1.hpp"
41 #endif
42
43 #define __ masm->
44
45 void G1BarrierSetAssembler::gen_write_ref_array_pre_barrier(MacroAssembler* masm, DecoratorSet decorators,
46 Register from, Register to, Register count,
47 Register preserve1, Register preserve2) {
48 bool dest_uninitialized = (decorators & IS_DEST_UNINITIALIZED) != 0;
49 // With G1, don't generate the call if we statically know that the target in uninitialized
50 if (!dest_uninitialized) {
51 int spill_slots = 3;
52 if (preserve1 != noreg) { spill_slots++; }
442
443 __ ld(tmp2, satb_q_buf_byte_offset, R16_thread);
444 __ ld(pre_val, -8, R1_SP); // Load from stack.
445 __ addi(tmp, tmp, -oopSize);
446
447 __ std(tmp, satb_q_index_byte_offset, R16_thread);
448 __ stdx(pre_val, tmp2, tmp); // [_buf + index] := <address_of_card>
449
450 __ bind(marking_not_active);
451 // Restore temp registers and return-from-leaf.
452 __ ld(tmp2, -24, R1_SP);
453 __ ld(tmp, -16, R1_SP);
454 __ blr();
455
456 __ bind(refill);
457 const int nbytes_save = (MacroAssembler::num_volatile_regs + stack_slots) * BytesPerWord;
458 __ save_volatile_gprs(R1_SP, -nbytes_save); // except R0
459 __ mflr(R0);
460 __ std(R0, _abi(lr), R1_SP);
461 __ push_frame_reg_args(nbytes_save, R0); // dummy frame for C call
462 __ call_VM_leaf(CAST_FROM_FN_PTR(address, G1SATBMarkQueueSet::handle_zero_index_for_thread), R16_thread);
463 __ pop_frame();
464 __ ld(R0, _abi(lr), R1_SP);
465 __ mtlr(R0);
466 __ restore_volatile_gprs(R1_SP, -nbytes_save); // except R0
467 __ b(restart);
468 }
469
470 void G1BarrierSetAssembler::generate_c1_post_barrier_runtime_stub(StubAssembler* sasm) {
471 G1BarrierSet* bs = barrier_set_cast<G1BarrierSet>(BarrierSet::barrier_set());
472
473 __ set_info("g1_post_barrier_slow_id", false);
474
475 // Using stack slots: spill addr, spill tmp2
476 const int stack_slots = 2;
477 Register tmp = R0;
478 Register addr = R14;
479 Register tmp2 = R15;
480 jbyte* byte_map_base = bs->card_table()->byte_map_base();
481
482 Label restart, refill, ret;
|