aboutsummaryrefslogtreecommitdiff
path: root/src/vm_mips.dasc
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/vm_mips.dasc71
1 files changed, 21 insertions, 50 deletions
diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc
index c4f01e81..fa53a554 100644
--- a/src/vm_mips.dasc
+++ b/src/vm_mips.dasc
@@ -138,6 +138,7 @@
138|.type NODE, Node 138|.type NODE, Node
139|.type NARGS8, int 139|.type NARGS8, int
140|.type TRACE, GCtrace 140|.type TRACE, GCtrace
141|.type SBUF, SBuf
141| 142|
142|//----------------------------------------------------------------------- 143|//-----------------------------------------------------------------------
143| 144|
@@ -1668,6 +1669,7 @@ static void build_subroutines(BuildCtx *ctx)
1668 |. move CARG1, L 1669 |. move CARG1, L
1669 | // Returns GCstr *. 1670 | // Returns GCstr *.
1670 | lw BASE, L->base 1671 | lw BASE, L->base
1672 |->fff_resstr:
1671 | move CARG1, CRET1 1673 | move CARG1, CRET1
1672 | b ->fff_restv 1674 | b ->fff_restv
1673 |. li CARG3, LJ_TSTR 1675 |. li CARG3, LJ_TSTR
@@ -1756,63 +1758,32 @@ static void build_subroutines(BuildCtx *ctx)
1756 | b ->fff_newstr 1758 | b ->fff_newstr
1757 |. nop 1759 |. nop
1758 | 1760 |
1759 |.ffunc string_reverse 1761 |.macro ffstring_op, name
1762 | .ffunc string_ .. name
1760 | ffgccheck 1763 | ffgccheck
1761 | lw CARG3, HI(BASE) 1764 | lw CARG3, HI(BASE)
1762 | lw STR:CARG1, LO(BASE) 1765 | lw STR:CARG2, LO(BASE)
1763 | beqz NARGS8:RC, ->fff_fallback 1766 | beqz NARGS8:RC, ->fff_fallback
1764 |. li AT, LJ_TSTR 1767 |. li AT, LJ_TSTR
1765 | bne CARG3, AT, ->fff_fallback 1768 | bne CARG3, AT, ->fff_fallback
1766 |. lw CARG2, DISPATCH_GL(tmpbuf.b)(DISPATCH) 1769 |. addiu SBUF:CARG1, DISPATCH, DISPATCH_GL(tmpbuf)
1767 | lw CARG3, STR:CARG1->len 1770 | load_got lj_buf_putstr_ .. name
1768 | lw TMP1, DISPATCH_GL(tmpbuf.e)(DISPATCH) 1771 | lw TMP0, SBUF:CARG1->b
1769 | addiu CARG1, STR:CARG1, #STR 1772 | sw L, SBUF:CARG1->L
1770 | addu CARG4, CARG2, CARG3 1773 | sw BASE, L->base
1771 | sltu AT, TMP1, CARG4 1774 | sw TMP0, SBUF:CARG1->p
1772 | bnez AT, ->fff_fallback 1775 | call_intern extern lj_buf_putstr_ .. name
1773 |. addu TMP3, CARG1, CARG3 1776 |. sw PC, SAVE_PC
1774 |1: // Reverse string copy. 1777 | load_got lj_buf_tostr
1775 | lbu TMP1, 0(CARG1) 1778 | call_intern lj_buf_tostr
1776 | sltu AT, CARG1, TMP3 1779 |. move SBUF:CARG1, SBUF:CRET1
1777 | beqz AT, ->fff_newstr 1780 | b ->fff_resstr
1778 |. addiu CARG1, CARG1, 1 1781 |. lw BASE, L->base
1779 | addiu CARG4, CARG4, -1
1780 | b <1
1781 | sb TMP1, 0(CARG4)
1782 |
1783 |.macro ffstring_case, name, lo
1784 | .ffunc name
1785 | ffgccheck
1786 | lw CARG3, HI(BASE)
1787 | lw STR:CARG1, LO(BASE)
1788 | beqz NARGS8:RC, ->fff_fallback
1789 |. li AT, LJ_TSTR
1790 | bne CARG3, AT, ->fff_fallback
1791 |. lw CARG2, DISPATCH_GL(tmpbuf.b)(DISPATCH)
1792 | lw CARG3, STR:CARG1->len
1793 | lw TMP1, DISPATCH_GL(tmpbuf.e)(DISPATCH)
1794 | addiu CARG1, STR:CARG1, #STR
1795 | addu TMP3, CARG2, CARG3
1796 | sltu AT, TMP1, TMP3
1797 | bnez AT, ->fff_fallback
1798 |. addu TMP3, CARG1, CARG3
1799 | move CARG4, CARG2
1800 |1: // ASCII case conversion.
1801 | lbu TMP1, 0(CARG1)
1802 | sltu AT, CARG1, TMP3
1803 | beqz AT, ->fff_newstr
1804 |. addiu TMP0, TMP1, -lo
1805 | xori TMP2, TMP1, 0x20
1806 | sltiu AT, TMP0, 26
1807 | movn TMP1, TMP2, AT
1808 | addiu CARG1, CARG1, 1
1809 | sb TMP1, 0(CARG4)
1810 | b <1
1811 |. addiu CARG4, CARG4, 1
1812 |.endmacro 1782 |.endmacro
1813 | 1783 |
1814 |ffstring_case string_lower, 65 1784 |ffstring_op reverse
1815 |ffstring_case string_upper, 97 1785 |ffstring_op lower
1786 |ffstring_op upper
1816 | 1787 |
1817 |//-- Bit library -------------------------------------------------------- 1788 |//-- Bit library --------------------------------------------------------
1818 | 1789 |