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/assembler.hpp"
26 #include "asm/assembler.inline.hpp"
27 #include "code/compiledIC.hpp"
28 #include "compiler/compiler_globals.hpp"
29 #include "compiler/disassembler.hpp"
30 #include "crc32c.h"
31 #include "gc/shared/barrierSet.hpp"
32 #include "gc/shared/barrierSetAssembler.hpp"
33 #include "gc/shared/collectedHeap.inline.hpp"
34 #include "gc/shared/tlab_globals.hpp"
35 #include "interpreter/bytecodeHistogram.hpp"
36 #include "interpreter/interpreter.hpp"
37 #include "interpreter/interpreterRuntime.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"
742 }
743 }
744
745 static void pass_arg3(MacroAssembler* masm, Register arg) {
746 if (c_rarg3 != arg ) {
747 masm->mov(c_rarg3, arg);
748 }
749 }
750
751 void MacroAssembler::stop(const char* msg) {
752 if (ShowMessageBoxOnError) {
753 address rip = pc();
754 pusha(); // get regs on stack
755 lea(c_rarg1, InternalAddress(rip));
756 movq(c_rarg2, rsp); // pass pointer to regs array
757 }
758 lea(c_rarg0, ExternalAddress((address) msg));
759 andq(rsp, -16); // align stack as required by ABI
760 call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
761 hlt();
762 }
763
764 void MacroAssembler::warn(const char* msg) {
765 push(rbp);
766 movq(rbp, rsp);
767 andq(rsp, -16); // align stack as required by push_CPU_state and call
768 push_CPU_state(); // keeps alignment at 16 bytes
769
770 #ifdef _WIN64
771 // Windows always allocates space for its register args
772 subq(rsp, frame::arg_reg_save_area_bytes);
773 #endif
774 lea(c_rarg0, ExternalAddress((address) msg));
775 call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
776
777 #ifdef _WIN64
778 // restore stack pointer
779 addq(rsp, frame::arg_reg_save_area_bytes);
780 #endif
781 pop_CPU_state();
10874 // Resotres back legacy GPRs state from stack.
10875 void MacroAssembler::restore_legacy_gprs() {
10876 movq(r15, Address(rsp, 0));
10877 movq(r14, Address(rsp, wordSize));
10878 movq(r13, Address(rsp, 2 * wordSize));
10879 movq(r12, Address(rsp, 3 * wordSize));
10880 movq(r11, Address(rsp, 4 * wordSize));
10881 movq(r10, Address(rsp, 5 * wordSize));
10882 movq(r9, Address(rsp, 6 * wordSize));
10883 movq(r8, Address(rsp, 7 * wordSize));
10884 movq(rdi, Address(rsp, 8 * wordSize));
10885 movq(rsi, Address(rsp, 9 * wordSize));
10886 movq(rbp, Address(rsp, 10 * wordSize));
10887 movq(rbx, Address(rsp, 12 * wordSize));
10888 movq(rdx, Address(rsp, 13 * wordSize));
10889 movq(rcx, Address(rsp, 14 * wordSize));
10890 movq(rax, Address(rsp, 15 * wordSize));
10891 addq(rsp, 16 * wordSize);
10892 }
10893
10894 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10895 if (VM_Version::supports_apx_f()) {
10896 esetzucc(comparison, dst);
10897 } else {
10898 setb(comparison, dst);
10899 movzbl(dst, dst);
10900 }
10901 }
10902 #endif
|
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/assembler.hpp"
26 #include "asm/assembler.inline.hpp"
27 #include "code/SCCache.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"
743 }
744 }
745
746 static void pass_arg3(MacroAssembler* masm, Register arg) {
747 if (c_rarg3 != arg ) {
748 masm->mov(c_rarg3, arg);
749 }
750 }
751
752 void MacroAssembler::stop(const char* msg) {
753 if (ShowMessageBoxOnError) {
754 address rip = pc();
755 pusha(); // get regs on stack
756 lea(c_rarg1, InternalAddress(rip));
757 movq(c_rarg2, rsp); // pass pointer to regs array
758 }
759 lea(c_rarg0, ExternalAddress((address) msg));
760 andq(rsp, -16); // align stack as required by ABI
761 call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
762 hlt();
763 SCCache::add_C_string(msg);
764 }
765
766 void MacroAssembler::warn(const char* msg) {
767 push(rbp);
768 movq(rbp, rsp);
769 andq(rsp, -16); // align stack as required by push_CPU_state and call
770 push_CPU_state(); // keeps alignment at 16 bytes
771
772 #ifdef _WIN64
773 // Windows always allocates space for its register args
774 subq(rsp, frame::arg_reg_save_area_bytes);
775 #endif
776 lea(c_rarg0, ExternalAddress((address) msg));
777 call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
778
779 #ifdef _WIN64
780 // restore stack pointer
781 addq(rsp, frame::arg_reg_save_area_bytes);
782 #endif
783 pop_CPU_state();
10876 // Resotres back legacy GPRs state from stack.
10877 void MacroAssembler::restore_legacy_gprs() {
10878 movq(r15, Address(rsp, 0));
10879 movq(r14, Address(rsp, wordSize));
10880 movq(r13, Address(rsp, 2 * wordSize));
10881 movq(r12, Address(rsp, 3 * wordSize));
10882 movq(r11, Address(rsp, 4 * wordSize));
10883 movq(r10, Address(rsp, 5 * wordSize));
10884 movq(r9, Address(rsp, 6 * wordSize));
10885 movq(r8, Address(rsp, 7 * wordSize));
10886 movq(rdi, Address(rsp, 8 * wordSize));
10887 movq(rsi, Address(rsp, 9 * wordSize));
10888 movq(rbp, Address(rsp, 10 * wordSize));
10889 movq(rbx, Address(rsp, 12 * wordSize));
10890 movq(rdx, Address(rsp, 13 * wordSize));
10891 movq(rcx, Address(rsp, 14 * wordSize));
10892 movq(rax, Address(rsp, 15 * wordSize));
10893 addq(rsp, 16 * wordSize);
10894 }
10895
10896 void MacroAssembler::load_aotrc_address(Register reg, address a) {
10897 #if INCLUDE_CDS
10898 assert(AOTRuntimeConstants::contains(a), "address out of range for data area");
10899 if (SCCache::is_on_for_write()) {
10900 // all aotrc field addresses should be registered in the SCC address table
10901 lea(reg, ExternalAddress(a));
10902 } else {
10903 mov64(reg, (uint64_t)a);
10904 }
10905 #else
10906 ShouldNotReachHere();
10907 #endif
10908 }
10909
10910 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10911 if (VM_Version::supports_apx_f()) {
10912 esetzucc(comparison, dst);
10913 } else {
10914 setb(comparison, dst);
10915 movzbl(dst, dst);
10916 }
10917 }
10918
10919 #endif
|