< 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 "interpreter/interpreterRuntime.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"

  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);

10810 // Resotres back legacy GPRs state from stack.
10811 void MacroAssembler::restore_legacy_gprs() {
10812   movq(r15, Address(rsp, 0));
10813   movq(r14, Address(rsp, wordSize));
10814   movq(r13, Address(rsp, 2 * wordSize));
10815   movq(r12, Address(rsp, 3 * wordSize));
10816   movq(r11, Address(rsp, 4 * wordSize));
10817   movq(r10, Address(rsp, 5 * wordSize));
10818   movq(r9,  Address(rsp, 6 * wordSize));
10819   movq(r8,  Address(rsp, 7 * wordSize));
10820   movq(rdi, Address(rsp, 8 * wordSize));
10821   movq(rsi, Address(rsp, 9 * wordSize));
10822   movq(rbp, Address(rsp, 10 * wordSize));
10823   movq(rbx, Address(rsp, 12 * wordSize));
10824   movq(rdx, Address(rsp, 13 * wordSize));
10825   movq(rcx, Address(rsp, 14 * wordSize));
10826   movq(rax, Address(rsp, 15 * wordSize));
10827   addq(rsp, 16 * wordSize);
10828 }
10829 














10830 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10831   if (VM_Version::supports_apx_f()) {
10832     esetzucc(comparison, dst);
10833   } else {
10834     setb(comparison, dst);
10835     movzbl(dst, dst);
10836   }
10837 }

10838 #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 "interpreter/interpreterRuntime.hpp"
   40 #include "jvm.h"
   41 #include "memory/resourceArea.hpp"
   42 #include "memory/universe.hpp"
   43 #include "oops/accessDecorators.hpp"
   44 #include "oops/compressedKlass.inline.hpp"
   45 #include "oops/compressedOops.inline.hpp"
   46 #include "oops/klass.inline.hpp"
   47 #include "prims/methodHandles.hpp"
   48 #include "runtime/continuation.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);

10812 // Resotres back legacy GPRs state from stack.
10813 void MacroAssembler::restore_legacy_gprs() {
10814   movq(r15, Address(rsp, 0));
10815   movq(r14, Address(rsp, wordSize));
10816   movq(r13, Address(rsp, 2 * wordSize));
10817   movq(r12, Address(rsp, 3 * wordSize));
10818   movq(r11, Address(rsp, 4 * wordSize));
10819   movq(r10, Address(rsp, 5 * wordSize));
10820   movq(r9,  Address(rsp, 6 * wordSize));
10821   movq(r8,  Address(rsp, 7 * wordSize));
10822   movq(rdi, Address(rsp, 8 * wordSize));
10823   movq(rsi, Address(rsp, 9 * wordSize));
10824   movq(rbp, Address(rsp, 10 * wordSize));
10825   movq(rbx, Address(rsp, 12 * wordSize));
10826   movq(rdx, Address(rsp, 13 * wordSize));
10827   movq(rcx, Address(rsp, 14 * wordSize));
10828   movq(rax, Address(rsp, 15 * wordSize));
10829   addq(rsp, 16 * wordSize);
10830 }
10831 
10832 void MacroAssembler::load_aotrc_address(Register reg, address a) {
10833 #if INCLUDE_CDS
10834   assert(AOTRuntimeConstants::contains(a), "address out of range for data area");
10835   if (SCCache::is_on_for_write()) {
10836     // all aotrc field addresses should be registered in the SCC address table
10837     lea(reg, ExternalAddress(a));
10838   } else {
10839     mov64(reg, (uint64_t)a);
10840   }
10841 #else
10842   ShouldNotReachHere();
10843 #endif
10844 }
10845 
10846 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10847   if (VM_Version::supports_apx_f()) {
10848     esetzucc(comparison, dst);
10849   } else {
10850     setb(comparison, dst);
10851     movzbl(dst, dst);
10852   }
10853 }
10854 
10855 #endif
< prev index next >