< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.hpp

Print this page

   1 /*
   2  * Copyright (c) 1997, 2022, 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  *

 131 
 132   // Support for fast byte/short loading with zero extension (depending on particular CPU)
 133   int load_unsigned_byte(Register dst, Address src);
 134   int load_unsigned_short(Register dst, Address src);
 135 
 136   // Support for fast byte/short loading with sign extension (depending on particular CPU)
 137   int load_signed_byte(Register dst, Address src);
 138   int load_signed_short(Register dst, Address src);
 139 
 140   // Support for sign-extension (hi:lo = extend_sign(lo))
 141   void extend_sign(Register hi, Register lo);
 142 
 143   // Load and store values by size and signed-ness
 144   void load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed, Register dst2 = noreg);
 145   void store_sized_value(Address dst, Register src, size_t size_in_bytes, Register src2 = noreg);
 146 
 147   // Support for inc/dec with optimal instruction selection depending on value
 148 
 149   void increment(Register reg, int value = 1) { LP64_ONLY(incrementq(reg, value)) NOT_LP64(incrementl(reg, value)) ; }
 150   void decrement(Register reg, int value = 1) { LP64_ONLY(decrementq(reg, value)) NOT_LP64(decrementl(reg, value)) ; }


 151 
 152   void decrementl(Address dst, int value = 1);
 153   void decrementl(Register reg, int value = 1);
 154 
 155   void decrementq(Register reg, int value = 1);
 156   void decrementq(Address dst, int value = 1);
 157 
 158   void incrementl(Address dst, int value = 1);
 159   void incrementl(Register reg, int value = 1);
 160 
 161   void incrementq(Register reg, int value = 1);
 162   void incrementq(Address dst, int value = 1);
 163 
 164   // Support optimal SSE move instructions.
 165   void movflt(XMMRegister dst, XMMRegister src) {
 166     if (dst-> encoding() == src->encoding()) return;
 167     if (UseXmmRegToRegMoveAll) { movaps(dst, src); return; }
 168     else                       { movss (dst, src); return; }
 169   }
 170   void movflt(XMMRegister dst, Address src) { movss(dst, src); }

 322   void resolve_jobject(Register value, Register thread, Register tmp);
 323 
 324   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 325   void c2bool(Register x);
 326 
 327   // C++ bool manipulation
 328 
 329   void movbool(Register dst, Address src);
 330   void movbool(Address dst, bool boolconst);
 331   void movbool(Address dst, Register src);
 332   void testbool(Register dst);
 333 
 334   void resolve_oop_handle(Register result, Register tmp = rscratch2);
 335   void resolve_weak_handle(Register result, Register tmp);
 336   void load_mirror(Register mirror, Register method, Register tmp = rscratch2);
 337   void load_method_holder_cld(Register rresult, Register rmethod);
 338 
 339   void load_method_holder(Register holder, Register method);
 340 
 341   // oop manipulations
 342   void load_klass(Register dst, Register src, Register tmp);



 343   void store_klass(Register dst, Register src, Register tmp);
 344 








 345   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 346                       Register tmp1, Register thread_tmp);
 347   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
 348                        Register tmp1, Register tmp2);
 349 
 350   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 351                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 352   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 353                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 354   void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
 355                       Register tmp2 = noreg, DecoratorSet decorators = 0);
 356 
 357   // Used for storing NULL. All other oop constants should be
 358   // stored using routines that take a jobject.
 359   void store_heap_oop_null(Address dst);
 360 
 361   void load_prototype_header(Register dst, Register src, Register tmp);
 362 
 363 #ifdef _LP64
 364   void store_klass_gap(Register dst, Register src);

1896   void copy64_masked_avx(Register dst, Register src, XMMRegister xmm,
1897                          KRegister mask, Register length, Register index,
1898                          Register temp, int shift = Address::times_1, int offset = 0,
1899                          bool use64byteVector = false);
1900 
1901   void copy32_masked_avx(Register dst, Register src, XMMRegister xmm,
1902                          KRegister mask, Register length, Register index,
1903                          Register temp, int shift = Address::times_1, int offset = 0);
1904 
1905   void copy32_avx(Register dst, Register src, Register index, XMMRegister xmm,
1906                   int shift = Address::times_1, int offset = 0);
1907 
1908   void copy64_avx(Register dst, Register src, Register index, XMMRegister xmm,
1909                   bool conjoint, int shift = Address::times_1, int offset = 0,
1910                   bool use64byteVector = false);
1911 #endif // COMPILER2_OR_JVMCI
1912 
1913 #endif // _LP64
1914 
1915   void vallones(XMMRegister dst, int vector_len);



1916 };
1917 
1918 /**
1919  * class SkipIfEqual:
1920  *
1921  * Instantiating this class will result in assembly code being output that will
1922  * jump around any code emitted between the creation of the instance and it's
1923  * automatic destruction at the end of a scope block, depending on the value of
1924  * the flag passed to the constructor, which will be checked at run-time.
1925  */
1926 class SkipIfEqual {
1927  private:
1928   MacroAssembler* _masm;
1929   Label _label;
1930 
1931  public:
1932    SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value);
1933    ~SkipIfEqual();
1934 };
1935 

   1 /*
   2  * Copyright (c) 1997, 2024, 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  *

 131 
 132   // Support for fast byte/short loading with zero extension (depending on particular CPU)
 133   int load_unsigned_byte(Register dst, Address src);
 134   int load_unsigned_short(Register dst, Address src);
 135 
 136   // Support for fast byte/short loading with sign extension (depending on particular CPU)
 137   int load_signed_byte(Register dst, Address src);
 138   int load_signed_short(Register dst, Address src);
 139 
 140   // Support for sign-extension (hi:lo = extend_sign(lo))
 141   void extend_sign(Register hi, Register lo);
 142 
 143   // Load and store values by size and signed-ness
 144   void load_sized_value(Register dst, Address src, size_t size_in_bytes, bool is_signed, Register dst2 = noreg);
 145   void store_sized_value(Address dst, Register src, size_t size_in_bytes, Register src2 = noreg);
 146 
 147   // Support for inc/dec with optimal instruction selection depending on value
 148 
 149   void increment(Register reg, int value = 1) { LP64_ONLY(incrementq(reg, value)) NOT_LP64(incrementl(reg, value)) ; }
 150   void decrement(Register reg, int value = 1) { LP64_ONLY(decrementq(reg, value)) NOT_LP64(decrementl(reg, value)) ; }
 151   void increment(Address dst, int value = 1)  { LP64_ONLY(incrementq(dst, value)) NOT_LP64(incrementl(dst, value)) ; }
 152   void decrement(Address dst, int value = 1)  { LP64_ONLY(decrementq(dst, value)) NOT_LP64(decrementl(dst, value)) ; }
 153 
 154   void decrementl(Address dst, int value = 1);
 155   void decrementl(Register reg, int value = 1);
 156 
 157   void decrementq(Register reg, int value = 1);
 158   void decrementq(Address dst, int value = 1);
 159 
 160   void incrementl(Address dst, int value = 1);
 161   void incrementl(Register reg, int value = 1);
 162 
 163   void incrementq(Register reg, int value = 1);
 164   void incrementq(Address dst, int value = 1);
 165 
 166   // Support optimal SSE move instructions.
 167   void movflt(XMMRegister dst, XMMRegister src) {
 168     if (dst-> encoding() == src->encoding()) return;
 169     if (UseXmmRegToRegMoveAll) { movaps(dst, src); return; }
 170     else                       { movss (dst, src); return; }
 171   }
 172   void movflt(XMMRegister dst, Address src) { movss(dst, src); }

 324   void resolve_jobject(Register value, Register thread, Register tmp);
 325 
 326   // C 'boolean' to Java boolean: x == 0 ? 0 : 1
 327   void c2bool(Register x);
 328 
 329   // C++ bool manipulation
 330 
 331   void movbool(Register dst, Address src);
 332   void movbool(Address dst, bool boolconst);
 333   void movbool(Address dst, Register src);
 334   void testbool(Register dst);
 335 
 336   void resolve_oop_handle(Register result, Register tmp = rscratch2);
 337   void resolve_weak_handle(Register result, Register tmp);
 338   void load_mirror(Register mirror, Register method, Register tmp = rscratch2);
 339   void load_method_holder_cld(Register rresult, Register rmethod);
 340 
 341   void load_method_holder(Register holder, Register method);
 342 
 343   // oop manipulations
 344   void load_klass(Register dst, Register src, Register tmp, bool null_check_src = false);
 345 #ifdef _LP64
 346   void load_nklass(Register dst, Register src);
 347 #endif
 348   void store_klass(Register dst, Register src, Register tmp);
 349 
 350   // Compares the Klass pointer of an object to a given Klass (which might be narrow,
 351   // depending on UseCompressedClassPointers).
 352   void cmp_klass(Register klass, Register dst, Register tmp);
 353 
 354   // Compares the Klass pointer of two objects o1 and o2. Result is in the condition flags.
 355   // Uses t1 and t2 as temporary registers.
 356   void cmp_klass(Register src, Register dst, Register tmp1, Register tmp2);
 357 
 358   void access_load_at(BasicType type, DecoratorSet decorators, Register dst, Address src,
 359                       Register tmp1, Register thread_tmp);
 360   void access_store_at(BasicType type, DecoratorSet decorators, Address dst, Register src,
 361                        Register tmp1, Register tmp2);
 362 
 363   void load_heap_oop(Register dst, Address src, Register tmp1 = noreg,
 364                      Register thread_tmp = noreg, DecoratorSet decorators = 0);
 365   void load_heap_oop_not_null(Register dst, Address src, Register tmp1 = noreg,
 366                               Register thread_tmp = noreg, DecoratorSet decorators = 0);
 367   void store_heap_oop(Address dst, Register src, Register tmp1 = noreg,
 368                       Register tmp2 = noreg, DecoratorSet decorators = 0);
 369 
 370   // Used for storing NULL. All other oop constants should be
 371   // stored using routines that take a jobject.
 372   void store_heap_oop_null(Address dst);
 373 
 374   void load_prototype_header(Register dst, Register src, Register tmp);
 375 
 376 #ifdef _LP64
 377   void store_klass_gap(Register dst, Register src);

1909   void copy64_masked_avx(Register dst, Register src, XMMRegister xmm,
1910                          KRegister mask, Register length, Register index,
1911                          Register temp, int shift = Address::times_1, int offset = 0,
1912                          bool use64byteVector = false);
1913 
1914   void copy32_masked_avx(Register dst, Register src, XMMRegister xmm,
1915                          KRegister mask, Register length, Register index,
1916                          Register temp, int shift = Address::times_1, int offset = 0);
1917 
1918   void copy32_avx(Register dst, Register src, Register index, XMMRegister xmm,
1919                   int shift = Address::times_1, int offset = 0);
1920 
1921   void copy64_avx(Register dst, Register src, Register index, XMMRegister xmm,
1922                   bool conjoint, int shift = Address::times_1, int offset = 0,
1923                   bool use64byteVector = false);
1924 #endif // COMPILER2_OR_JVMCI
1925 
1926 #endif // _LP64
1927 
1928   void vallones(XMMRegister dst, int vector_len);
1929 
1930   void lightweight_lock(Register obj, Register reg_rax, Register thread, Register tmp, Label& slow);
1931   void lightweight_unlock(Register obj, Register reg_rax, Register thread, Register tmp, Label& slow);
1932 };
1933 
1934 /**
1935  * class SkipIfEqual:
1936  *
1937  * Instantiating this class will result in assembly code being output that will
1938  * jump around any code emitted between the creation of the instance and it's
1939  * automatic destruction at the end of a scope block, depending on the value of
1940  * the flag passed to the constructor, which will be checked at run-time.
1941  */
1942 class SkipIfEqual {
1943  private:
1944   MacroAssembler* _masm;
1945   Label _label;
1946 
1947  public:
1948    SkipIfEqual(MacroAssembler*, const bool* flag_addr, bool value);
1949    ~SkipIfEqual();
1950 };
1951 
< prev index next >