1815 |
1815 |
1816 ld_ptr(obj, thread, in_bytes(JavaThread::tlab_top_offset())); |
1816 ld_ptr(obj, thread, in_bytes(JavaThread::tlab_top_offset())); |
1817 |
1817 |
1818 if (var_size_in_bytes == NOREG) { |
1818 if (var_size_in_bytes == NOREG) { |
1819 // i dont think we need move con_size_in_bytes to a register first. |
1819 // i dont think we need move con_size_in_bytes to a register first. |
1820 // by yjl 8/17/2005 |
|
1821 assert(is_simm16(con_size_in_bytes), "fixme by moving imm to a register first"); |
1820 assert(is_simm16(con_size_in_bytes), "fixme by moving imm to a register first"); |
1822 addi(end, obj, con_size_in_bytes); |
1821 addi(end, obj, con_size_in_bytes); |
1823 } else { |
1822 } else { |
1824 add(end, obj, var_size_in_bytes); |
1823 add(end, obj, var_size_in_bytes); |
1825 } |
1824 } |
1830 delayed()->nop(); |
1829 delayed()->nop(); |
1831 |
1830 |
1832 |
1831 |
1833 // update the tlab top pointer |
1832 // update the tlab top pointer |
1834 st_ptr(end, thread, in_bytes(JavaThread::tlab_top_offset())); |
1833 st_ptr(end, thread, in_bytes(JavaThread::tlab_top_offset())); |
1835 |
|
1836 // recover var_size_in_bytes if necessary |
|
1837 /*if (var_size_in_bytes == end) { |
|
1838 sub(var_size_in_bytes, end, obj); |
|
1839 }*/ |
|
1840 |
1834 |
1841 verify_tlab(t1, t2); |
1835 verify_tlab(t1, t2); |
1842 } |
1836 } |
1843 |
1837 |
1844 // Defines obj, preserves var_size_in_bytes |
1838 // Defines obj, preserves var_size_in_bytes |
1845 void MacroAssembler::eden_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, |
1839 void MacroAssembler::eden_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, |
1846 Register t1, Register t2, Label& slow_case) { |
1840 Register t1, Register t2, Label& slow_case) { |
1847 assert_different_registers(obj, var_size_in_bytes, t1, AT); |
1841 assert_different_registers(obj, var_size_in_bytes, t1, AT); |
1848 if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { //by yyq |
1842 if (CMSIncrementalMode || !Universe::heap()->supports_inline_contig_alloc()) { |
1849 // No allocation in the shared eden. |
1843 // No allocation in the shared eden. |
1850 b_far(slow_case); |
1844 b_far(slow_case); |
1851 delayed()->nop(); |
1845 delayed()->nop(); |
1852 } else { |
1846 } else { |
1853 |
1847 |
2045 static const double pi_4 = 0.7853981633974483; |
2039 static const double pi_4 = 0.7853981633974483; |
2046 |
2040 |
2047 // the x86 version is to clumsy, i dont think we need that fuss. maybe i'm wrong, FIXME |
2041 // the x86 version is to clumsy, i dont think we need that fuss. maybe i'm wrong, FIXME |
2048 // must get argument(a double) in F12/F13 |
2042 // must get argument(a double) in F12/F13 |
2049 //void MacroAssembler::trigfunc(char trig, bool preserve_cpu_regs, int num_fpu_regs_in_use) { |
2043 //void MacroAssembler::trigfunc(char trig, bool preserve_cpu_regs, int num_fpu_regs_in_use) { |
2050 //We need to preseve the register which maybe modified during the Call @Jerome |
2044 //We need to preseve the register which maybe modified during the Call |
2051 void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) { |
2045 void MacroAssembler::trigfunc(char trig, int num_fpu_regs_in_use) { |
2052 //save all modified register here |
2046 //save all modified register here |
2053 // if (preserve_cpu_regs) { |
|
2054 // } |
|
2055 //FIXME, in the disassembly of tirgfunc, only used V0,V1,T9, SP,RA,so we ony save V0,V1,T9 |
2047 //FIXME, in the disassembly of tirgfunc, only used V0,V1,T9, SP,RA,so we ony save V0,V1,T9 |
2056 pushad(); |
2048 pushad(); |
2057 //we should preserve the stack space before we call |
2049 //we should preserve the stack space before we call |
2058 addi(SP, SP, -wordSize * 2); |
2050 addi(SP, SP, -wordSize * 2); |
2059 switch (trig){ |
2051 switch (trig){ |
2105 } |
2093 } |
2106 #endif |
2094 #endif |
2107 |
2095 |
2108 void MacroAssembler::li32(Register reg, int imm) { |
2096 void MacroAssembler::li32(Register reg, int imm) { |
2109 if (is_simm16(imm)) { |
2097 if (is_simm16(imm)) { |
2110 /* Jin: for imm < 0, we should use addi instead of addiu. |
2098 /* for imm < 0, we should use addi instead of addiu. |
2111 * |
2099 * |
2112 * java.lang.StringCoding$StringDecoder.decode(jobject, jint, jint) |
2100 * java.lang.StringCoding$StringDecoder.decode(jobject, jint, jint) |
2113 * |
2101 * |
2114 * 78 move [int:-1|I] [a0|I] |
2102 * 78 move [int:-1|I] [a0|I] |
2115 * : daddi a0, zero, 0xffffffff (correct) |
2103 * : daddi a0, zero, 0xffffffff (correct) |
2626 |
2614 |
2627 #ifdef _LP64 |
2615 #ifdef _LP64 |
2628 |
2616 |
2629 /* do 32-bit CAS using MIPS64 lld/scd |
2617 /* do 32-bit CAS using MIPS64 lld/scd |
2630 |
2618 |
2631 Jin: cas_int should only compare 32-bits of the memory value. |
2619 cas_int should only compare 32-bits of the memory value. |
2632 However, lld/scd will do 64-bit operation, which violates the intention of cas_int. |
2620 However, lld/scd will do 64-bit operation, which violates the intention of cas_int. |
2633 To simulate a 32-bit atomic operation, the value loaded with LLD should be split into |
2621 To simulate a 32-bit atomic operation, the value loaded with LLD should be split into |
2634 tow halves, and only the low-32 bits is compared. If equals, the low-32 bits of newval, |
2622 tow halves, and only the low-32 bits is compared. If equals, the low-32 bits of newval, |
2635 plus the high-32 bits or memory value, are stored togethor with SCD. |
2623 plus the high-32 bits or memory value, are stored togethor with SCD. |
2636 |
2624 |
2637 Example: |
2625 Example: |
2638 |
2626 |
2639 double d = 3.1415926; |
2627 double d = 3.1415926; |
2640 System.err.println("hello" + d); |
2628 System.err.println("hello" + d); |
3201 |
3189 |
3202 #ifdef _LP64 |
3190 #ifdef _LP64 |
3203 Register caller_saved_registers[] = {AT, V0, V1, A0, A1, A2, A3, A4, A5, A6, A7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3191 Register caller_saved_registers[] = {AT, V0, V1, A0, A1, A2, A3, A4, A5, A6, A7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3204 Register caller_saved_registers_except_v0[] = {AT, V1, A0, A1, A2, A3, A4, A5, A6, A7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3192 Register caller_saved_registers_except_v0[] = {AT, V1, A0, A1, A2, A3, A4, A5, A6, A7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3205 |
3193 |
3206 /* FIXME: Jin: In MIPS64, F0~23 are all caller-saved registers */ |
3194 //In MIPS64, F0~23 are all caller-saved registers |
3207 FloatRegister caller_saved_fpu_registers[] = {F0, F12, F13}; |
3195 FloatRegister caller_saved_fpu_registers[] = {F0, F12, F13}; |
3208 #else |
3196 #else |
3209 Register caller_saved_registers[] = {AT, V0, V1, A0, A1, A2, A3, T4, T5, T6, T7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3197 Register caller_saved_registers[] = {AT, V0, V1, A0, A1, A2, A3, T4, T5, T6, T7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3210 Register caller_saved_registers_except_v0[] = {AT, V1, A0, A1, A2, A3, T4, T5, T6, T7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3198 Register caller_saved_registers_except_v0[] = {AT, V1, A0, A1, A2, A3, T4, T5, T6, T7, T0, T1, T2, T3, T8, T9, GP, RA, FP}; |
3211 |
3199 |
3926 // Set NZ/Z based on last compare. |
3914 // Set NZ/Z based on last compare. |
3927 // Z flag value will not be set by 'repne' if RCX == 0 since 'repne' does |
3915 // Z flag value will not be set by 'repne' if RCX == 0 since 'repne' does |
3928 // not change flags (only scas instruction which is repeated sets flags). |
3916 // not change flags (only scas instruction which is repeated sets flags). |
3929 // Set Z = 0 (not equal) before 'repne' to indicate that class was not found. |
3917 // Set Z = 0 (not equal) before 'repne' to indicate that class was not found. |
3930 |
3918 |
3931 /* 2013/4/3 Jin: OpenJDK8 never compresses klass pointers in secondary-super array. */ |
3919 // OpenJDK8 never compresses klass pointers in secondary-super array. |
3932 Label Loop, subtype; |
3920 Label Loop, subtype; |
3933 bind(Loop); |
3921 bind(Loop); |
3934 beq(temp2_reg, R0, *L_failure); |
3922 beq(temp2_reg, R0, *L_failure); |
3935 delayed()->nop(); |
3923 delayed()->nop(); |
3936 ld(AT, temp_reg, 0); |
3924 ld(AT, temp_reg, 0); |
3978 offset += arg_slot.as_constant() * stackElementSize; |
3966 offset += arg_slot.as_constant() * stackElementSize; |
3979 } else { |
3967 } else { |
3980 scale_reg = arg_slot.as_register(); |
3968 scale_reg = arg_slot.as_register(); |
3981 scale_factor = Address::times_8; |
3969 scale_factor = Address::times_8; |
3982 } |
3970 } |
3983 // 2014/07/31 Fu: We don't push RA on stack in prepare_invoke. |
3971 // We don't push RA on stack in prepare_invoke. |
3984 // offset += wordSize; // return PC is on stack |
3972 // offset += wordSize; // return PC is on stack |
3985 if(scale_reg==NOREG) return Address(SP, offset); |
3973 if(scale_reg==NOREG) return Address(SP, offset); |
3986 else { |
3974 else { |
3987 dsll(scale_reg, scale_reg, scale_factor); |
3975 dsll(scale_reg, scale_reg, scale_factor); |
3988 daddu(scale_reg, SP, scale_reg); |
3976 daddu(scale_reg, SP, scale_reg); |