< prev index next >

src/hotspot/cpu/x86/macroAssembler_x86.cpp

Print this page

    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/assembler.hpp"
   27 #include "asm/assembler.inline.hpp"

   28 #include "code/compiledIC.hpp"
   29 #include "compiler/compiler_globals.hpp"
   30 #include "compiler/disassembler.hpp"
   31 #include "crc32c.h"
   32 #include "gc/shared/barrierSet.hpp"
   33 #include "gc/shared/barrierSetAssembler.hpp"
   34 #include "gc/shared/collectedHeap.inline.hpp"
   35 #include "gc/shared/tlab_globals.hpp"
   36 #include "interpreter/bytecodeHistogram.hpp"
   37 #include "interpreter/interpreter.hpp"
   38 #include "jvm.h"
   39 #include "memory/resourceArea.hpp"
   40 #include "memory/universe.hpp"
   41 #include "oops/accessDecorators.hpp"
   42 #include "oops/compressedKlass.inline.hpp"
   43 #include "oops/compressedOops.inline.hpp"
   44 #include "oops/klass.inline.hpp"
   45 #include "prims/methodHandles.hpp"
   46 #include "runtime/continuation.hpp"
   47 #include "runtime/interfaceSupport.inline.hpp"

  754   }
  755 }
  756 
  757 static void pass_arg3(MacroAssembler* masm, Register arg) {
  758   if (c_rarg3 != arg ) {
  759     masm->mov(c_rarg3, arg);
  760   }
  761 }
  762 
  763 void MacroAssembler::stop(const char* msg) {
  764   if (ShowMessageBoxOnError) {
  765     address rip = pc();
  766     pusha(); // get regs on stack
  767     lea(c_rarg1, InternalAddress(rip));
  768     movq(c_rarg2, rsp); // pass pointer to regs array
  769   }
  770   lea(c_rarg0, ExternalAddress((address) msg));
  771   andq(rsp, -16); // align stack as required by ABI
  772   call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
  773   hlt();

  774 }
  775 
  776 void MacroAssembler::warn(const char* msg) {
  777   push(rbp);
  778   movq(rbp, rsp);
  779   andq(rsp, -16);     // align stack as required by push_CPU_state and call
  780   push_CPU_state();   // keeps alignment at 16 bytes
  781 
  782   lea(c_rarg0, ExternalAddress((address) msg));
  783   call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
  784 
  785   pop_CPU_state();
  786   mov(rsp, rbp);
  787   pop(rbp);
  788 }
  789 
  790 void MacroAssembler::print_state() {
  791   address rip = pc();
  792   pusha();            // get regs on stack
  793   push(rbp);

10406 // Resotres back legacy GPRs state from stack.
10407 void MacroAssembler::restore_legacy_gprs() {
10408   movq(r15, Address(rsp, 0));
10409   movq(r14, Address(rsp, wordSize));
10410   movq(r13, Address(rsp, 2 * wordSize));
10411   movq(r12, Address(rsp, 3 * wordSize));
10412   movq(r11, Address(rsp, 4 * wordSize));
10413   movq(r10, Address(rsp, 5 * wordSize));
10414   movq(r9,  Address(rsp, 6 * wordSize));
10415   movq(r8,  Address(rsp, 7 * wordSize));
10416   movq(rdi, Address(rsp, 8 * wordSize));
10417   movq(rsi, Address(rsp, 9 * wordSize));
10418   movq(rbp, Address(rsp, 10 * wordSize));
10419   movq(rbx, Address(rsp, 12 * wordSize));
10420   movq(rdx, Address(rsp, 13 * wordSize));
10421   movq(rcx, Address(rsp, 14 * wordSize));
10422   movq(rax, Address(rsp, 15 * wordSize));
10423   addq(rsp, 16 * wordSize);
10424 }
10425 














10426 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10427   if (VM_Version::supports_apx_f()) {
10428     esetzucc(comparison, dst);
10429   } else {
10430     setb(comparison, dst);
10431     movzbl(dst, dst);
10432   }
10433 }

10434 #endif

    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/assembler.hpp"
   27 #include "asm/assembler.inline.hpp"
   28 #include "code/SCCache.hpp"
   29 #include "code/compiledIC.hpp"
   30 #include "compiler/compiler_globals.hpp"
   31 #include "compiler/disassembler.hpp"
   32 #include "crc32c.h"
   33 #include "gc/shared/barrierSet.hpp"
   34 #include "gc/shared/barrierSetAssembler.hpp"
   35 #include "gc/shared/collectedHeap.inline.hpp"
   36 #include "gc/shared/tlab_globals.hpp"
   37 #include "interpreter/bytecodeHistogram.hpp"
   38 #include "interpreter/interpreter.hpp"
   39 #include "jvm.h"
   40 #include "memory/resourceArea.hpp"
   41 #include "memory/universe.hpp"
   42 #include "oops/accessDecorators.hpp"
   43 #include "oops/compressedKlass.inline.hpp"
   44 #include "oops/compressedOops.inline.hpp"
   45 #include "oops/klass.inline.hpp"
   46 #include "prims/methodHandles.hpp"
   47 #include "runtime/continuation.hpp"
   48 #include "runtime/interfaceSupport.inline.hpp"

  755   }
  756 }
  757 
  758 static void pass_arg3(MacroAssembler* masm, Register arg) {
  759   if (c_rarg3 != arg ) {
  760     masm->mov(c_rarg3, arg);
  761   }
  762 }
  763 
  764 void MacroAssembler::stop(const char* msg) {
  765   if (ShowMessageBoxOnError) {
  766     address rip = pc();
  767     pusha(); // get regs on stack
  768     lea(c_rarg1, InternalAddress(rip));
  769     movq(c_rarg2, rsp); // pass pointer to regs array
  770   }
  771   lea(c_rarg0, ExternalAddress((address) msg));
  772   andq(rsp, -16); // align stack as required by ABI
  773   call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
  774   hlt();
  775   SCCache::add_C_string(msg);
  776 }
  777 
  778 void MacroAssembler::warn(const char* msg) {
  779   push(rbp);
  780   movq(rbp, rsp);
  781   andq(rsp, -16);     // align stack as required by push_CPU_state and call
  782   push_CPU_state();   // keeps alignment at 16 bytes
  783 
  784   lea(c_rarg0, ExternalAddress((address) msg));
  785   call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
  786 
  787   pop_CPU_state();
  788   mov(rsp, rbp);
  789   pop(rbp);
  790 }
  791 
  792 void MacroAssembler::print_state() {
  793   address rip = pc();
  794   pusha();            // get regs on stack
  795   push(rbp);

10408 // Resotres back legacy GPRs state from stack.
10409 void MacroAssembler::restore_legacy_gprs() {
10410   movq(r15, Address(rsp, 0));
10411   movq(r14, Address(rsp, wordSize));
10412   movq(r13, Address(rsp, 2 * wordSize));
10413   movq(r12, Address(rsp, 3 * wordSize));
10414   movq(r11, Address(rsp, 4 * wordSize));
10415   movq(r10, Address(rsp, 5 * wordSize));
10416   movq(r9,  Address(rsp, 6 * wordSize));
10417   movq(r8,  Address(rsp, 7 * wordSize));
10418   movq(rdi, Address(rsp, 8 * wordSize));
10419   movq(rsi, Address(rsp, 9 * wordSize));
10420   movq(rbp, Address(rsp, 10 * wordSize));
10421   movq(rbx, Address(rsp, 12 * wordSize));
10422   movq(rdx, Address(rsp, 13 * wordSize));
10423   movq(rcx, Address(rsp, 14 * wordSize));
10424   movq(rax, Address(rsp, 15 * wordSize));
10425   addq(rsp, 16 * wordSize);
10426 }
10427 
10428 void MacroAssembler::load_aotrc_address(Register reg, address a) {
10429 #if INCLUDE_CDS
10430   assert(AOTRuntimeConstants::contains(a), "address out of range for data area");
10431   if (SCCache::is_on_for_write()) {
10432     // all aotrc field addresses should be registered in the SCC address table
10433     lea(reg, ExternalAddress(a));
10434   } else {
10435     mov64(reg, (uint64_t)a);
10436   }
10437 #else
10438   ShouldNotReachHere();
10439 #endif
10440 }
10441 
10442 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10443   if (VM_Version::supports_apx_f()) {
10444     esetzucc(comparison, dst);
10445   } else {
10446     setb(comparison, dst);
10447     movzbl(dst, dst);
10448   }
10449 }
10450 
10451 #endif
< prev index next >