Mercurial > hg > truffle
comparison src/cpu/x86/vm/stubGenerator_x86_64.cpp @ 1174:ddb7834449d0
6849984: Value methods for platform dependent math functions constant fold incorrectly
Reviewed-by: kvn, twisti
author | never |
---|---|
date | Fri, 15 Jan 2010 11:53:33 -0800 |
parents | 85f13cdfbc1d |
children | 776fb94f33cc |
comparison
equal
deleted
inserted
replaced
1173:73b22f919c34 | 1174:ddb7834449d0 |
---|---|
1 /* | 1 /* |
2 * Copyright 2003-2009 Sun Microsystems, Inc. All Rights Reserved. | 2 * Copyright 2003-2010 Sun Microsystems, Inc. All Rights Reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * | 4 * |
5 * This code is free software; you can redistribute it and/or modify it | 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 | 6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
2729 | 2729 |
2730 StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy; | 2730 StubRoutines::_arrayof_oop_disjoint_arraycopy = StubRoutines::_oop_disjoint_arraycopy; |
2731 StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy; | 2731 StubRoutines::_arrayof_oop_arraycopy = StubRoutines::_oop_arraycopy; |
2732 } | 2732 } |
2733 | 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 | |
2734 #undef __ | 2807 #undef __ |
2735 #define __ masm-> | 2808 #define __ masm-> |
2736 | 2809 |
2737 // Continuation point for throwing of implicit exceptions that are | 2810 // Continuation point for throwing of implicit exceptions that are |
2738 // not handled in the current activation. Fabricates an exception | 2811 // not handled in the current activation. Fabricates an exception |
2943 ek = MethodHandles::EntryKind(1 + (int)ek)) { | 3016 ek = MethodHandles::EntryKind(1 + (int)ek)) { |
2944 StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek)); | 3017 StubCodeMark mark(this, "MethodHandle", MethodHandles::entry_name(ek)); |
2945 MethodHandles::generate_method_handle_stub(_masm, ek); | 3018 MethodHandles::generate_method_handle_stub(_masm, ek); |
2946 } | 3019 } |
2947 } | 3020 } |
3021 | |
3022 generate_math_stubs(); | |
2948 } | 3023 } |
2949 | 3024 |
2950 public: | 3025 public: |
2951 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { | 3026 StubGenerator(CodeBuffer* code, bool all) : StubCodeGenerator(code) { |
2952 if (all) { | 3027 if (all) { |