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"
753 }
754 }
755
756 static void pass_arg3(MacroAssembler* masm, Register arg) {
757 if (c_rarg3 != arg ) {
758 masm->mov(c_rarg3, arg);
759 }
760 }
761
762 void MacroAssembler::stop(const char* msg) {
763 if (ShowMessageBoxOnError) {
764 address rip = pc();
765 pusha(); // get regs on stack
766 lea(c_rarg1, InternalAddress(rip));
767 movq(c_rarg2, rsp); // pass pointer to regs array
768 }
769 lea(c_rarg0, ExternalAddress((address) msg));
770 andq(rsp, -16); // align stack as required by ABI
771 call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64)));
772 hlt();
773 }
774
775 void MacroAssembler::warn(const char* msg) {
776 push(rbp);
777 movq(rbp, rsp);
778 andq(rsp, -16); // align stack as required by push_CPU_state and call
779 push_CPU_state(); // keeps alignment at 16 bytes
780
781 #ifdef _WIN64
782 // Windows always allocates space for its register args
783 subq(rsp, frame::arg_reg_save_area_bytes);
784 #endif
785 lea(c_rarg0, ExternalAddress((address) msg));
786 call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
787
788 #ifdef _WIN64
789 // restore stack pointer
790 addq(rsp, frame::arg_reg_save_area_bytes);
791 #endif
792 pop_CPU_state();
10854 // Resotres back legacy GPRs state from stack.
10855 void MacroAssembler::restore_legacy_gprs() {
10856 movq(r15, Address(rsp, 0));
10857 movq(r14, Address(rsp, wordSize));
10858 movq(r13, Address(rsp, 2 * wordSize));
10859 movq(r12, Address(rsp, 3 * wordSize));
10860 movq(r11, Address(rsp, 4 * wordSize));
10861 movq(r10, Address(rsp, 5 * wordSize));
10862 movq(r9, Address(rsp, 6 * wordSize));
10863 movq(r8, Address(rsp, 7 * wordSize));
10864 movq(rdi, Address(rsp, 8 * wordSize));
10865 movq(rsi, Address(rsp, 9 * wordSize));
10866 movq(rbp, Address(rsp, 10 * wordSize));
10867 movq(rbx, Address(rsp, 12 * wordSize));
10868 movq(rdx, Address(rsp, 13 * wordSize));
10869 movq(rcx, Address(rsp, 14 * wordSize));
10870 movq(rax, Address(rsp, 15 * wordSize));
10871 addq(rsp, 16 * wordSize);
10872 }
10873
10874 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10875 if (VM_Version::supports_apx_f()) {
10876 esetzucc(comparison, dst);
10877 } else {
10878 setb(comparison, dst);
10879 movzbl(dst, dst);
10880 }
10881 }
10882 #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"
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 SCCache::add_C_string(msg);
775 }
776
777 void MacroAssembler::warn(const char* msg) {
778 push(rbp);
779 movq(rbp, rsp);
780 andq(rsp, -16); // align stack as required by push_CPU_state and call
781 push_CPU_state(); // keeps alignment at 16 bytes
782
783 #ifdef _WIN64
784 // Windows always allocates space for its register args
785 subq(rsp, frame::arg_reg_save_area_bytes);
786 #endif
787 lea(c_rarg0, ExternalAddress((address) msg));
788 call(RuntimeAddress(CAST_FROM_FN_PTR(address, warning)));
789
790 #ifdef _WIN64
791 // restore stack pointer
792 addq(rsp, frame::arg_reg_save_area_bytes);
793 #endif
794 pop_CPU_state();
10856 // Resotres back legacy GPRs state from stack.
10857 void MacroAssembler::restore_legacy_gprs() {
10858 movq(r15, Address(rsp, 0));
10859 movq(r14, Address(rsp, wordSize));
10860 movq(r13, Address(rsp, 2 * wordSize));
10861 movq(r12, Address(rsp, 3 * wordSize));
10862 movq(r11, Address(rsp, 4 * wordSize));
10863 movq(r10, Address(rsp, 5 * wordSize));
10864 movq(r9, Address(rsp, 6 * wordSize));
10865 movq(r8, Address(rsp, 7 * wordSize));
10866 movq(rdi, Address(rsp, 8 * wordSize));
10867 movq(rsi, Address(rsp, 9 * wordSize));
10868 movq(rbp, Address(rsp, 10 * wordSize));
10869 movq(rbx, Address(rsp, 12 * wordSize));
10870 movq(rdx, Address(rsp, 13 * wordSize));
10871 movq(rcx, Address(rsp, 14 * wordSize));
10872 movq(rax, Address(rsp, 15 * wordSize));
10873 addq(rsp, 16 * wordSize);
10874 }
10875
10876 void MacroAssembler::load_aotrc_address(Register reg, address a) {
10877 #if INCLUDE_CDS
10878 assert(AOTRuntimeConstants::contains(a), "address out of range for data area");
10879 if (SCCache::is_on_for_write()) {
10880 // all aotrc field addresses should be registered in the SCC address table
10881 lea(reg, ExternalAddress(a));
10882 } else {
10883 mov64(reg, (uint64_t)a);
10884 }
10885 #else
10886 ShouldNotReachHere();
10887 #endif
10888 }
10889
10890 void MacroAssembler::setcc(Assembler::Condition comparison, Register dst) {
10891 if (VM_Version::supports_apx_f()) {
10892 esetzucc(comparison, dst);
10893 } else {
10894 setb(comparison, dst);
10895 movzbl(dst, dst);
10896 }
10897 }
10898
10899 #endif
|