< 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 #ifdef COMPILER2
 38 #include "gc/shared/c2/barrierSetC2.hpp"
 39 #endif // COMPILER2
 40 
 41 #define __ masm->
 42 
 43 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 44                                   Register dst, Address src, Register tmp1, Register tmp_thread) {
 45   bool in_heap = (decorators & IN_HEAP) != 0;
 46   bool in_native = (decorators & IN_NATIVE) != 0;
 47   bool is_not_null = (decorators & IS_NOT_NULL) != 0;
 48   bool atomic = (decorators & MO_RELAXED) != 0;
 49 

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


























201 void BarrierSetAssembler::copy_load_at(MacroAssembler* masm,
202                                        DecoratorSet decorators,
203                                        BasicType type,
204                                        size_t bytes,
205                                        Register dst,
206                                        Address src,
207                                        Register tmp) {
208   assert(bytes <= 8, "can only deal with non-vector registers");
209   switch (bytes) {
210   case 1:
211     __ movb(dst, src);
212     break;
213   case 2:
214     __ movw(dst, src);
215     break;
216   case 4:
217     __ movl(dst, src);
218     break;
219   case 8:
220 #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 #ifdef COMPILER2
 40 #include "gc/shared/c2/barrierSetC2.hpp"
 41 #endif // COMPILER2
 42 
 43 #define __ masm->
 44 
 45 void BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type,
 46                                   Register dst, Address src, Register tmp1, Register tmp_thread) {
 47   bool in_heap = (decorators & IN_HEAP) != 0;
 48   bool in_native = (decorators & IN_NATIVE) != 0;
 49   bool is_not_null = (decorators & IS_NOT_NULL) != 0;
 50   bool atomic = (decorators & MO_RELAXED) != 0;
 51 

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