1 /*
2 * Copyright (c) 1997, 2017, 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 *
431 }
432
433 __ get_cpool_and_tags(rcx, rax);
434 const int base_offset = ConstantPool::header_size() * wordSize;
435 const int tags_offset = Array<u1>::base_offset_in_bytes();
436
437 // get type
438 __ movzbl(rdx, Address(rax, rbx, Address::times_1, tags_offset));
439
440 // unresolved class - get the resolved class
441 __ cmpl(rdx, JVM_CONSTANT_UnresolvedClass);
442 __ jccb(Assembler::equal, call_ldc);
443
444 // unresolved class in error state - call into runtime to throw the error
445 // from the first resolution attempt
446 __ cmpl(rdx, JVM_CONSTANT_UnresolvedClassInError);
447 __ jccb(Assembler::equal, call_ldc);
448
449 // resolved class - need to call vm to get java mirror of the class
450 __ cmpl(rdx, JVM_CONSTANT_Class);
451 __ jcc(Assembler::equal, call_ldc);
452
453 // unresolved value type - get the resolved class
454 __ cmpl(rdx, JVM_CONSTANT_UnresolvedValue);
455 __ jccb(Assembler::equal, call_ldc);
456
457 // unresolved value type in error state - call into runtime to throw the error
458 // from the first resolution attempt
459 __ cmpl(rdx, JVM_CONSTANT_UnresolvedValueInError);
460 __ jccb(Assembler::equal, call_ldc);
461
462 // resolved value type - need to call vm to get java mirror
463 __ cmpl(rdx, JVM_CONSTANT_Value);
464 __ jcc(Assembler::notEqual, notClass);
465
466 __ bind(call_ldc);
467
468 __ movl(rarg, wide);
469 call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), rarg);
470
471 __ push(atos);
472 __ jmp(Done);
473
474 __ bind(notClass);
475 __ cmpl(rdx, JVM_CONSTANT_Float);
476 __ jccb(Assembler::notEqual, notFloat);
477
478 // ftos
479 __ load_float(Address(rcx, rbx, Address::times_ptr, base_offset));
480 __ push(ftos);
481 __ jmp(Done);
482
483 __ bind(notFloat);
2768 __ pop(state);
2769 __ bind(no_safepoint);
2770 }
2771 #endif
2772 // This code has to be re-store before re-enabling value buffering in TLVB
2773 // if (state == qtos) {
2774 // const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread);
2775 // __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::return_value), rax);
2776 // NOT_LP64(__ get_thread(thread1));
2777 // __ get_vm_result(rax, thread1);
2778 // }
2779
2780 // Narrow result if state is itos but result type is smaller.
2781 // Need to narrow in the return bytecode rather than in generate_return_entry
2782 // since compiled code callers expect the result to already be narrowed.
2783 if (state == itos) {
2784 __ narrow(rax);
2785 }
2786
2787 #ifdef ASSERT
2788 if (EnableMVT || EnableValhalla) {
2789 if (state == atos) {
2790 const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread);
2791 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::check_areturn), rax);
2792 NOT_LP64(__ get_thread(thread1));
2793 __ get_vm_result(rax, thread1);
2794 }
2795 }
2796 #endif // ASSERT
2797
2798 __ remove_activation(state, rbcp, true, true, true, /*state == qtos*/ false && ValueTypeReturnedAsFields);
2799
2800 __ jmp(rbcp);
2801 }
2802
2803 // ----------------------------------------------------------------------------
2804 // Volatile variables demand their effects be made known to all CPU's
2805 // in order. Store buffers on most chips allow reads & writes to
2806 // reorder; the JMM's ReadAfterWrite.java test fails in -Xint mode
2807 // without some kind of memory barrier (i.e., it's not sufficient that
2808 // the interpreter does not reorder volatile references, the hardware
|
1 /*
2 * Copyright (c) 1997, 2018, 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 *
431 }
432
433 __ get_cpool_and_tags(rcx, rax);
434 const int base_offset = ConstantPool::header_size() * wordSize;
435 const int tags_offset = Array<u1>::base_offset_in_bytes();
436
437 // get type
438 __ movzbl(rdx, Address(rax, rbx, Address::times_1, tags_offset));
439
440 // unresolved class - get the resolved class
441 __ cmpl(rdx, JVM_CONSTANT_UnresolvedClass);
442 __ jccb(Assembler::equal, call_ldc);
443
444 // unresolved class in error state - call into runtime to throw the error
445 // from the first resolution attempt
446 __ cmpl(rdx, JVM_CONSTANT_UnresolvedClassInError);
447 __ jccb(Assembler::equal, call_ldc);
448
449 // resolved class - need to call vm to get java mirror of the class
450 __ cmpl(rdx, JVM_CONSTANT_Class);
451 __ jcc(Assembler::notEqual, notClass);
452
453 __ bind(call_ldc);
454
455 __ movl(rarg, wide);
456 call_VM(rax, CAST_FROM_FN_PTR(address, InterpreterRuntime::ldc), rarg);
457
458 __ push(atos);
459 __ jmp(Done);
460
461 __ bind(notClass);
462 __ cmpl(rdx, JVM_CONSTANT_Float);
463 __ jccb(Assembler::notEqual, notFloat);
464
465 // ftos
466 __ load_float(Address(rcx, rbx, Address::times_ptr, base_offset));
467 __ push(ftos);
468 __ jmp(Done);
469
470 __ bind(notFloat);
2755 __ pop(state);
2756 __ bind(no_safepoint);
2757 }
2758 #endif
2759 // This code has to be re-store before re-enabling value buffering in TLVB
2760 // if (state == qtos) {
2761 // const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread);
2762 // __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::return_value), rax);
2763 // NOT_LP64(__ get_thread(thread1));
2764 // __ get_vm_result(rax, thread1);
2765 // }
2766
2767 // Narrow result if state is itos but result type is smaller.
2768 // Need to narrow in the return bytecode rather than in generate_return_entry
2769 // since compiled code callers expect the result to already be narrowed.
2770 if (state == itos) {
2771 __ narrow(rax);
2772 }
2773
2774 #ifdef ASSERT
2775 if (EnableValhalla) {
2776 if (state == atos) {
2777 const Register thread1 = NOT_LP64(rcx) LP64_ONLY(r15_thread);
2778 __ call_VM(noreg, CAST_FROM_FN_PTR(address, InterpreterRuntime::check_areturn), rax);
2779 NOT_LP64(__ get_thread(thread1));
2780 __ get_vm_result(rax, thread1);
2781 }
2782 }
2783 #endif // ASSERT
2784
2785 __ remove_activation(state, rbcp, true, true, true, /*state == qtos*/ false && ValueTypeReturnedAsFields);
2786
2787 __ jmp(rbcp);
2788 }
2789
2790 // ----------------------------------------------------------------------------
2791 // Volatile variables demand their effects be made known to all CPU's
2792 // in order. Store buffers on most chips allow reads & writes to
2793 // reorder; the JMM's ReadAfterWrite.java test fails in -Xint mode
2794 // without some kind of memory barrier (i.e., it's not sufficient that
2795 // the interpreter does not reorder volatile references, the hardware
|