src/cpu/x86/vm/c1_Runtime1_x86.cpp

Print this page


   1 /*
   2  * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1606       {
1607         StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments);
1608         // arg0 : previous value of memory
1609 
1610         BarrierSet* bs = Universe::heap()->barrier_set();
1611         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
1612           __ movptr(rax, (int)id);
1613           __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax);
1614           __ should_not_reach_here();
1615           break;
1616         }
1617         __ push(rax);
1618         __ push(rdx);
1619 
1620         const Register pre_val = rax;
1621         const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1622         const Register tmp = rdx;
1623 
1624         NOT_LP64(__ get_thread(thread);)
1625 


1626         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1627                                              SATBMarkQueue::byte_offset_of_index()));
1628         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1629                                         SATBMarkQueue::byte_offset_of_buf()));
1630 
1631         Label done;
1632         Label runtime;









1633 
1634         // Can we store original value in the thread's buffer?
1635 
1636         __ movptr(tmp, queue_index);
1637         __ testptr(tmp, tmp);
1638         __ jcc(Assembler::zero, runtime);
1639         __ subptr(tmp, wordSize);
1640         __ movptr(queue_index, tmp);
1641         __ addptr(tmp, buffer);
1642 
1643         // prev_val (rax)
1644         f.load_argument(0, pre_val);
1645         __ movptr(Address(tmp, 0), pre_val);
1646         __ jmp(done);
1647 
1648         __ bind(runtime);
1649 
1650         save_live_registers(sasm, 3);
1651 
1652         // load the pre-value


   1 /*
   2  * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


1606       {
1607         StubFrame f(sasm, "g1_pre_barrier", dont_gc_arguments);
1608         // arg0 : previous value of memory
1609 
1610         BarrierSet* bs = Universe::heap()->barrier_set();
1611         if (bs->kind() != BarrierSet::G1SATBCTLogging) {
1612           __ movptr(rax, (int)id);
1613           __ call_RT(noreg, noreg, CAST_FROM_FN_PTR(address, unimplemented_entry), rax);
1614           __ should_not_reach_here();
1615           break;
1616         }
1617         __ push(rax);
1618         __ push(rdx);
1619 
1620         const Register pre_val = rax;
1621         const Register thread = NOT_LP64(rax) LP64_ONLY(r15_thread);
1622         const Register tmp = rdx;
1623 
1624         NOT_LP64(__ get_thread(thread);)
1625 
1626         Address queue_active(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1627                                               SATBMarkQueue::byte_offset_of_active()));
1628         Address queue_index(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1629                                              SATBMarkQueue::byte_offset_of_index()));
1630         Address buffer(thread, in_bytes(JavaThread::satb_mark_queue_offset() +
1631                                         SATBMarkQueue::byte_offset_of_buf()));
1632 
1633         Label done;
1634         Label runtime;
1635         
1636         // Is marking still active?
1637         if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
1638           __ cmpl(queue_active, 0);
1639         } else {
1640           assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
1641           __ cmpb(queue_active, 0);
1642         }
1643         __ jcc(Assembler::equal, done);
1644 
1645         // Can we store original value in the thread's buffer?
1646 
1647         __ movptr(tmp, queue_index);
1648         __ testptr(tmp, tmp);
1649         __ jcc(Assembler::zero, runtime);
1650         __ subptr(tmp, wordSize);
1651         __ movptr(queue_index, tmp);
1652         __ addptr(tmp, buffer);
1653 
1654         // prev_val (rax)
1655         f.load_argument(0, pre_val);
1656         __ movptr(Address(tmp, 0), pre_val);
1657         __ jmp(done);
1658 
1659         __ bind(runtime);
1660 
1661         save_live_registers(sasm, 3);
1662 
1663         // load the pre-value