< prev index next >

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

Print this page

  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  *
 23  */
 24 

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

 29 #include "gc/shared/collectedHeap.hpp"
 30 #include "interpreter/interp_masm.hpp"
 31 #include "memory/universe.hpp"
 32 #include "runtime/javaThread.hpp"
 33 #include "runtime/jniHandles.hpp"
 34 #include "runtime/sharedRuntime.hpp"
 35 #include "runtime/stubRoutines.hpp"
 36 #ifdef COMPILER2
 37 #include "gc/shared/c2/barrierSetC2.hpp"
 38 #endif // COMPILER2
 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 

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

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

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