1 /*
2 * Copyright 2003-2009 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
2714 StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy");
2715
2716 // We don't generate specialized code for HeapWord-aligned source
2717 // arrays, so just use the code we've already generated
2718 StubRoutines::_arrayof_jbyte_disjoint_arraycopy = StubRoutines::_jbyte_disjoint_arraycopy;
2719 StubRoutines::_arrayof_jbyte_arraycopy = StubRoutines::_jbyte_arraycopy;
2720
2721 StubRoutines::_arrayof_jshort_disjoint_arraycopy = StubRoutines::_jshort_disjoint_arraycopy;
2722 StubRoutines::_arrayof_jshort_arraycopy = StubRoutines::_jshort_arraycopy;
2723
2724 StubRoutines::_arrayof_jint_disjoint_arraycopy = StubRoutines::_jint_disjoint_arraycopy;
2725 StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy;
2726
2727 StubRoutines::_arrayof_jlong_disjoint_arraycopy = StubRoutines::_jlong_disjoint_arraycopy;
2728 StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy;
2729
2730 StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy;
2731 StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy;
2732 }
2733
2734 #undef __
2735 #define __ masm->
2736
2737 // Continuation point for throwing of implicit exceptions that are
2738 // not handled in the current activation. Fabricates an exception
2739 // oop and initiates normal exception dispatching in this
2740 // frame. Since we need to preserve callee-saved values (currently
2741 // only for C2, but done for C1 as well) we need a callee-saved oop
2742 // map and therefore have to make these stubs into RuntimeStubs
2743 // rather than BufferBlobs. If the compiler needs all registers to
2744 // be preserved between the fault point and the exception handler
2745 // then it must assume responsibility for that in
2746 // AbstractCompiler::continuation_for_implicit_null_exception or
2747 // continuation_for_implicit_division_by_zero_exception. All other
2748 // implicit exceptions (e.g., NullPointerException or
2749 // AbstractMethodError on entry) are either at call sites or
2750 // otherwise assume that stack unwinding will be initiated, so
2751 // caller saved registers were assumed volatile in the compiler.
2752 address generate_throw_exception(const char* name,
2753 address runtime_entry,
2928 StubRoutines::x86::_float_sign_mask = generate_fp_mask("float_sign_mask", 0x7FFFFFFF7FFFFFFF);
2929 StubRoutines::x86::_float_sign_flip = generate_fp_mask("float_sign_flip", 0x8000000080000000);
2930 StubRoutines::x86::_double_sign_mask = generate_fp_mask("double_sign_mask", 0x7FFFFFFFFFFFFFFF);
2931 StubRoutines::x86::_double_sign_flip = generate_fp_mask("double_sign_flip", 0x8000000000000000);
2932
2933 // support for verify_oop (must happen after universe_init)
2934 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
2935
2936 // arraycopy stubs used by compilers
2937 generate_arraycopy_stubs();
2938
2939 // generic method handle stubs
2940 if (EnableMethodHandles && SystemDictionary::MethodHandle_klass() != NULL) {
2941 for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
2942 ek < MethodHandles::_EK_LIMIT;
2943 ek = MethodHandles::EntryKind(1 + (int)ek)) {
2944 StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
2945 MethodHandles::generate_method_handle_stub(_masm, ek);
2946 }
2947 }
2948 }
2949
2950 public:
2951 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
2952 if (all) {
2953 generate_all();
2954 } else {
2955 generate_initial();
2956 }
2957 }
2958 }; // end class declaration
2959
2960 address StubGenerator::disjoint_byte_copy_entry = NULL;
2961 address StubGenerator::disjoint_short_copy_entry = NULL;
2962 address StubGenerator::disjoint_int_copy_entry = NULL;
2963 address StubGenerator::disjoint_long_copy_entry = NULL;
2964 address StubGenerator::disjoint_oop_copy_entry = NULL;
2965
2966 address StubGenerator::byte_copy_entry = NULL;
2967 address StubGenerator::short_copy_entry = NULL;
|
1 /*
2 * Copyright 2003-2010 Sun Microsystems, Inc. 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 *
2714 StubRoutines::_generic_arraycopy = generate_generic_copy("generic_arraycopy");
2715
2716 // We don't generate specialized code for HeapWord-aligned source
2717 // arrays, so just use the code we've already generated
2718 StubRoutines::_arrayof_jbyte_disjoint_arraycopy = StubRoutines::_jbyte_disjoint_arraycopy;
2719 StubRoutines::_arrayof_jbyte_arraycopy = StubRoutines::_jbyte_arraycopy;
2720
2721 StubRoutines::_arrayof_jshort_disjoint_arraycopy = StubRoutines::_jshort_disjoint_arraycopy;
2722 StubRoutines::_arrayof_jshort_arraycopy = StubRoutines::_jshort_arraycopy;
2723
2724 StubRoutines::_arrayof_jint_disjoint_arraycopy = StubRoutines::_jint_disjoint_arraycopy;
2725 StubRoutines::_arrayof_jint_arraycopy = StubRoutines::_jint_arraycopy;
2726
2727 StubRoutines::_arrayof_jlong_disjoint_arraycopy = StubRoutines::_jlong_disjoint_arraycopy;
2728 StubRoutines::_arrayof_jlong_arraycopy = StubRoutines::_jlong_arraycopy;
2729
2730 StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy;
2731 StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy;
2732 }
2733
2734 void generate_math_stubs() {
2735 {
2736 StubCodeMark mark(this, "StubRoutines", "log");
2737 StubRoutines::_intrinsic_log = (double (*)(double)) __ pc();
2738
2739 __ subq(rsp, 8);
2740 __ movdbl(Address(rsp, 0), xmm0);
2741 __ fld_d(Address(rsp, 0));
2742 __ flog();
2743 __ fstp_d(Address(rsp, 0));
2744 __ movdbl(xmm0, Address(rsp, 0));
2745 __ addq(rsp, 8);
2746 __ ret(0);
2747 }
2748 {
2749 StubCodeMark mark(this, "StubRoutines", "log10");
2750 StubRoutines::_intrinsic_log10 = (double (*)(double)) __ pc();
2751
2752 __ subq(rsp, 8);
2753 __ movdbl(Address(rsp, 0), xmm0);
2754 __ fld_d(Address(rsp, 0));
2755 __ flog10();
2756 __ fstp_d(Address(rsp, 0));
2757 __ movdbl(xmm0, Address(rsp, 0));
2758 __ addq(rsp, 8);
2759 __ ret(0);
2760 }
2761 {
2762 StubCodeMark mark(this, "StubRoutines", "sin");
2763 StubRoutines::_intrinsic_sin = (double (*)(double)) __ pc();
2764
2765 __ subq(rsp, 8);
2766 __ movdbl(Address(rsp, 0), xmm0);
2767 __ fld_d(Address(rsp, 0));
2768 __ trigfunc('s');
2769 __ fstp_d(Address(rsp, 0));
2770 __ movdbl(xmm0, Address(rsp, 0));
2771 __ addq(rsp, 8);
2772 __ ret(0);
2773 }
2774 {
2775 StubCodeMark mark(this, "StubRoutines", "cos");
2776 StubRoutines::_intrinsic_cos = (double (*)(double)) __ pc();
2777
2778 __ subq(rsp, 8);
2779 __ movdbl(Address(rsp, 0), xmm0);
2780 __ fld_d(Address(rsp, 0));
2781 __ trigfunc('c');
2782 __ fstp_d(Address(rsp, 0));
2783 __ movdbl(xmm0, Address(rsp, 0));
2784 __ addq(rsp, 8);
2785 __ ret(0);
2786 }
2787 {
2788 StubCodeMark mark(this, "StubRoutines", "tan");
2789 StubRoutines::_intrinsic_tan = (double (*)(double)) __ pc();
2790
2791 __ subq(rsp, 8);
2792 __ movdbl(Address(rsp, 0), xmm0);
2793 __ fld_d(Address(rsp, 0));
2794 __ trigfunc('t');
2795 __ fstp_d(Address(rsp, 0));
2796 __ movdbl(xmm0, Address(rsp, 0));
2797 __ addq(rsp, 8);
2798 __ ret(0);
2799 }
2800
2801 // The intrinsic version of these seem to return the same value as
2802 // the strict version.
2803 StubRoutines::_intrinsic_exp = SharedRuntime::dexp;
2804 StubRoutines::_intrinsic_pow = SharedRuntime::dpow;
2805 }
2806
2807 #undef __
2808 #define __ masm->
2809
2810 // Continuation point for throwing of implicit exceptions that are
2811 // not handled in the current activation. Fabricates an exception
2812 // oop and initiates normal exception dispatching in this
2813 // frame. Since we need to preserve callee-saved values (currently
2814 // only for C2, but done for C1 as well) we need a callee-saved oop
2815 // map and therefore have to make these stubs into RuntimeStubs
2816 // rather than BufferBlobs. If the compiler needs all registers to
2817 // be preserved between the fault point and the exception handler
2818 // then it must assume responsibility for that in
2819 // AbstractCompiler::continuation_for_implicit_null_exception or
2820 // continuation_for_implicit_division_by_zero_exception. All other
2821 // implicit exceptions (e.g., NullPointerException or
2822 // AbstractMethodError on entry) are either at call sites or
2823 // otherwise assume that stack unwinding will be initiated, so
2824 // caller saved registers were assumed volatile in the compiler.
2825 address generate_throw_exception(const char* name,
2826 address runtime_entry,
3001 StubRoutines::x86::_float_sign_mask = generate_fp_mask("float_sign_mask", 0x7FFFFFFF7FFFFFFF);
3002 StubRoutines::x86::_float_sign_flip = generate_fp_mask("float_sign_flip", 0x8000000080000000);
3003 StubRoutines::x86::_double_sign_mask = generate_fp_mask("double_sign_mask", 0x7FFFFFFFFFFFFFFF);
3004 StubRoutines::x86::_double_sign_flip = generate_fp_mask("double_sign_flip", 0x8000000000000000);
3005
3006 // support for verify_oop (must happen after universe_init)
3007 StubRoutines::_verify_oop_subroutine_entry = generate_verify_oop();
3008
3009 // arraycopy stubs used by compilers
3010 generate_arraycopy_stubs();
3011
3012 // generic method handle stubs
3013 if (EnableMethodHandles && SystemDictionary::MethodHandle_klass() != NULL) {
3014 for (MethodHandles::EntryKind ek = MethodHandles::_EK_FIRST;
3015 ek < MethodHandles::_EK_LIMIT;
3016 ek = MethodHandles::EntryKind(1 + (int)ek)) {
3017 StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek));
3018 MethodHandles::generate_method_handle_stub(_masm, ek);
3019 }
3020 }
3021
3022 generate_math_stubs();
3023 }
3024
3025 public:
3026 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) {
3027 if (all) {
3028 generate_all();
3029 } else {
3030 generate_initial();
3031 }
3032 }
3033 }; // end class declaration
3034
3035 address StubGenerator::disjoint_byte_copy_entry = NULL;
3036 address StubGenerator::disjoint_short_copy_entry = NULL;
3037 address StubGenerator::disjoint_int_copy_entry = NULL;
3038 address StubGenerator::disjoint_long_copy_entry = NULL;
3039 address StubGenerator::disjoint_oop_copy_entry = NULL;
3040
3041 address StubGenerator::byte_copy_entry = NULL;
3042 address StubGenerator::short_copy_entry = NULL;
|