< prev index next >

src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp

Print this page

  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  *
 23  */
 24 
 25 #include "precompiled.hpp"

 26 #include "classfile/classLoaderData.hpp"
 27 #include "gc/shared/barrierSet.hpp"
 28 #include "gc/shared/barrierSetAssembler.hpp"
 29 #include "gc/shared/barrierSetNMethod.hpp"

 30 #include "gc/shared/collectedHeap.hpp"
 31 #include "interpreter/interp_masm.hpp"
 32 #include "memory/universe.hpp"
 33 #include "runtime/javaThread.hpp"
 34 #include "runtime/jniHandles.hpp"
 35 #include "runtime/sharedRuntime.hpp"
 36 #include "runtime/stubRoutines.hpp"
 37 
 38 #define __ masm->
 39 
 40 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 41                                   Register dst, Address src, Register tmp1, Register tmp_thread) {
 42   bool in_heap = (decorators & IN_HEAP) != 0;
 43   bool in_native = (decorators & IN_NATIVE) != 0;
 44   bool is_not_null = (decorators & IS_NOT_NULL) != 0;
 45   bool atomic = (decorators & MO_RELAXED) != 0;
 46 
 47   switch (type) {
 48   case T_OBJECT:
 49   case T_ARRAY: {

178       __ movptr(dst, rax);
179       __ movptr(dst.plus_disp(wordSize), rdx);
180     }
181 #endif
182     break;
183   case T_FLOAT:
184     assert(val == noreg, "only tos");
185     __ store_float(dst);
186     break;
187   case T_DOUBLE:
188     assert(val == noreg, "only tos");
189     __ store_double(dst);
190     break;
191   case T_ADDRESS:
192     __ movptr(dst, val);
193     break;
194   default: Unimplemented();
195   }
196 }
197 













198 void BarrierSetAssembler::copy_load_at(MacroAssembler* masm,
199                                        DecoratorSet decorators,
200                                        BasicType type,
201                                        size_t bytes,
202                                        Register dst,
203                                        Address src,
204                                        Register tmp) {
205   assert(bytes <= 8, "can only deal with non-vector registers");
206   switch (bytes) {
207   case 1:
208     __ movb(dst, src);
209     break;
210   case 2:
211     __ movw(dst, src);
212     break;
213   case 4:
214     __ movl(dst, src);
215     break;
216   case 8:
217 #ifdef _LP64

  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  *
 23  */
 24 
 25 #include "precompiled.hpp"
 26 #include "asm/macroAssembler.inline.hpp"
 27 #include "classfile/classLoaderData.hpp"
 28 #include "gc/shared/barrierSet.hpp"
 29 #include "gc/shared/barrierSetAssembler.hpp"
 30 #include "gc/shared/barrierSetNMethod.hpp"
 31 #include "gc/shared/barrierSetRuntime.hpp"
 32 #include "gc/shared/collectedHeap.hpp"
 33 #include "interpreter/interp_masm.hpp"
 34 #include "memory/universe.hpp"
 35 #include "runtime/javaThread.hpp"
 36 #include "runtime/jniHandles.hpp"
 37 #include "runtime/sharedRuntime.hpp"
 38 #include "runtime/stubRoutines.hpp"
 39 
 40 #define __ masm->
 41 
 42 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 43                                   Register dst, Address src, Register tmp1, Register tmp_thread) {
 44   bool in_heap = (decorators & IN_HEAP) != 0;
 45   bool in_native = (decorators & IN_NATIVE) != 0;
 46   bool is_not_null = (decorators & IS_NOT_NULL) != 0;
 47   bool atomic = (decorators & MO_RELAXED) != 0;
 48 
 49   switch (type) {
 50   case T_OBJECT:
 51   case T_ARRAY: {

180       __ movptr(dst, rax);
181       __ movptr(dst.plus_disp(wordSize), rdx);
182     }
183 #endif
184     break;
185   case T_FLOAT:
186     assert(val == noreg, "only tos");
187     __ store_float(dst);
188     break;
189   case T_DOUBLE:
190     assert(val == noreg, "only tos");
191     __ store_double(dst);
192     break;
193   case T_ADDRESS:
194     __ movptr(dst, val);
195     break;
196   default: Unimplemented();
197   }
198 }
199 
200 void BarrierSetAssembler::value_copy(MacroAssembler* masm, DecoratorSet decorators,
201                                      Register src, Register dst, Register value_klass) {
202   // value_copy implementation is fairly complex, and there are not any
203   // "short-cuts" to be made from asm. What there is, appears to have the same
204   // cost in C++, so just "call_VM_leaf" for now rather than maintain hundreds
205   // of hand-rolled instructions...
206   if (decorators & IS_DEST_UNINITIALIZED) {
207     __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSetRuntime::value_copy_is_dest_uninitialized), src, dst, value_klass);
208   } else {
209     __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSetRuntime::value_copy), src, dst, value_klass);
210   }
211 }
212 
213 void BarrierSetAssembler::copy_load_at(MacroAssembler* masm,
214                                        DecoratorSet decorators,
215                                        BasicType type,
216                                        size_t bytes,
217                                        Register dst,
218                                        Address src,
219                                        Register tmp) {
220   assert(bytes <= 8, "can only deal with non-vector registers");
221   switch (bytes) {
222   case 1:
223     __ movb(dst, src);
224     break;
225   case 2:
226     __ movw(dst, src);
227     break;
228   case 4:
229     __ movl(dst, src);
230     break;
231   case 8:
232 #ifdef _LP64
< prev index next >