diff options
Diffstat (limited to '')
-rw-r--r-- | src/vm_arm.dasc | 64 |
1 files changed, 19 insertions, 45 deletions
diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index 4579b263..5a15c409 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc | |||
@@ -99,6 +99,7 @@ | |||
99 | |.type NODE, Node | 99 | |.type NODE, Node |
100 | |.type NARGS8, int | 100 | |.type NARGS8, int |
101 | |.type TRACE, GCtrace | 101 | |.type TRACE, GCtrace |
102 | |.type SBUF, SBuf | ||
102 | | | 103 | | |
103 | |//----------------------------------------------------------------------- | 104 | |//----------------------------------------------------------------------- |
104 | | | 105 | | |
@@ -1743,6 +1744,7 @@ static void build_subroutines(BuildCtx *ctx) | |||
1743 | | mov CARG1, L | 1744 | | mov CARG1, L |
1744 | | str PC, SAVE_PC | 1745 | | str PC, SAVE_PC |
1745 | | bl extern lj_str_new // (lua_State *L, char *str, size_t l) | 1746 | | bl extern lj_str_new // (lua_State *L, char *str, size_t l) |
1747 | |->fff_resstr: | ||
1746 | | // Returns GCstr *. | 1748 | | // Returns GCstr *. |
1747 | | ldr BASE, L->base | 1749 | | ldr BASE, L->base |
1748 | | mvn CARG2, #~LJ_TSTR | 1750 | | mvn CARG2, #~LJ_TSTR |
@@ -1813,56 +1815,28 @@ static void build_subroutines(BuildCtx *ctx) | |||
1813 | | bge <1 | 1815 | | bge <1 |
1814 | | b ->fff_newstr | 1816 | | b ->fff_newstr |
1815 | | | 1817 | | |
1816 | |.ffunc string_reverse | 1818 | |.macro ffstring_op, name |
1819 | | .ffunc string_ .. name | ||
1817 | | ffgccheck | 1820 | | ffgccheck |
1818 | | ldrd CARG12, [BASE] | 1821 | | ldr CARG3, [BASE, #4] |
1819 | | cmp NARGS8:RC, #8 | ||
1820 | | blo ->fff_fallback | ||
1821 | | checkstr CARG2, ->fff_fallback | ||
1822 | | ldr CARG3, STR:CARG1->len | ||
1823 | | ldr CARG2, [DISPATCH, #DISPATCH_GL(tmpbuf.b)] | ||
1824 | | ldr RB, [DISPATCH, #DISPATCH_GL(tmpbuf.e)] | ||
1825 | | mov CARG4, CARG3 | ||
1826 | | add CARG1, STR:CARG1, #sizeof(GCstr) | ||
1827 | | add INS, CARG2, CARG3 | ||
1828 | | cmp RB, INS | ||
1829 | | blo ->fff_fallback | ||
1830 | |1: // Reverse string copy. | ||
1831 | | ldrb RB, [CARG1], #1 | ||
1832 | | subs CARG4, CARG4, #1 | ||
1833 | | blt ->fff_newstr | ||
1834 | | strb RB, [CARG2, CARG4] | ||
1835 | | b <1 | ||
1836 | | | ||
1837 | |.macro ffstring_case, name, lo | ||
1838 | | .ffunc name | ||
1839 | | ffgccheck | ||
1840 | | ldrd CARG12, [BASE] | ||
1841 | | cmp NARGS8:RC, #8 | 1822 | | cmp NARGS8:RC, #8 |
1823 | | ldr STR:CARG2, [BASE] | ||
1842 | | blo ->fff_fallback | 1824 | | blo ->fff_fallback |
1843 | | checkstr CARG2, ->fff_fallback | 1825 | | sub SBUF:CARG1, DISPATCH, #-DISPATCH_GL(tmpbuf) |
1844 | | ldr CARG3, STR:CARG1->len | 1826 | | checkstr CARG3, ->fff_fallback |
1845 | | ldr CARG2, [DISPATCH, #DISPATCH_GL(tmpbuf.b)] | 1827 | | ldr CARG4, SBUF:CARG1->b |
1846 | | ldr RB, [DISPATCH, #DISPATCH_GL(tmpbuf.e)] | 1828 | | str BASE, L->base |
1847 | | mov CARG4, #0 | 1829 | | str PC, SAVE_PC |
1848 | | add CARG1, STR:CARG1, #sizeof(GCstr) | 1830 | | str L, SBUF:CARG1->L |
1849 | | add INS, CARG2, CARG3 | 1831 | | str CARG4, SBUF:CARG1->p |
1850 | | cmp RB, INS | 1832 | | bl extern lj_buf_putstr_ .. name |
1851 | | blo ->fff_fallback | 1833 | | bl extern lj_buf_tostr |
1852 | |1: // ASCII case conversion. | 1834 | | b ->fff_resstr |
1853 | | ldrb RB, [CARG1, CARG4] | ||
1854 | | cmp CARG4, CARG3 | ||
1855 | | bhs ->fff_newstr | ||
1856 | | sub RC, RB, #lo | ||
1857 | | cmp RC, #26 | ||
1858 | | eorlo RB, RB, #0x20 | ||
1859 | | strb RB, [CARG2, CARG4] | ||
1860 | | add CARG4, CARG4, #1 | ||
1861 | | b <1 | ||
1862 | |.endmacro | 1835 | |.endmacro |
1863 | | | 1836 | | |
1864 | |ffstring_case string_lower, 65 | 1837 | |ffstring_op reverse |
1865 | |ffstring_case string_upper, 97 | 1838 | |ffstring_op lower |
1839 | |ffstring_op upper | ||
1866 | | | 1840 | | |
1867 | |//-- Bit library -------------------------------------------------------- | 1841 | |//-- Bit library -------------------------------------------------------- |
1868 | | | 1842 | | |