aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Pall <mike>2010-10-05 01:43:22 +0200
committerMike Pall <mike>2010-10-05 01:46:23 +0200
commit2f5f6290e7e7cde6e9ce5636acfbe33345c59bb5 (patch)
tree4fdfd562474398d497beb2e8c0b842176f85c4d5 /src
parent08ac8b0c9611ce4c10b5f8c32a704e8438bbefae (diff)
downloadluajit-2f5f6290e7e7cde6e9ce5636acfbe33345c59bb5.tar.gz
luajit-2f5f6290e7e7cde6e9ce5636acfbe33345c59bb5.tar.bz2
luajit-2f5f6290e7e7cde6e9ce5636acfbe33345c59bb5.zip
PPC: Add tonumber() and tostring() fast functions.
Diffstat (limited to 'src')
-rw-r--r--src/buildvm_ppc.dasc52
1 files changed, 48 insertions, 4 deletions
diff --git a/src/buildvm_ppc.dasc b/src/buildvm_ppc.dasc
index 5dad8719..f96a5601 100644
--- a/src/buildvm_ppc.dasc
+++ b/src/buildvm_ppc.dasc
@@ -908,7 +908,10 @@ static void build_subroutines(BuildCtx *ctx)
908 |.endmacro 908 |.endmacro
909 | 909 |
910 |.macro ffgccheck 910 |.macro ffgccheck
911 | NYI 911 | lwz TMP0, DISPATCH_GL(gc.total)(DISPATCH)
912 | lwz TMP1, DISPATCH_GL(gc.threshold)(DISPATCH)
913 | cmplw TMP0, TMP1
914 | bgel ->fff_gcstep
912 |.endmacro 915 |.endmacro
913 | 916 |
914 |//-- Base library: checks ----------------------------------------------- 917 |//-- Base library: checks -----------------------------------------------
@@ -1029,10 +1032,38 @@ static void build_subroutines(BuildCtx *ctx)
1029 |//-- Base library: conversions ------------------------------------------ 1032 |//-- Base library: conversions ------------------------------------------
1030 | 1033 |
1031 |.ffunc tonumber 1034 |.ffunc tonumber
1032 | NYI 1035 | // Only handles the number case inline (without a base argument).
1036 | cmplwi NARGS8:RC, 8
1037 | evldd CARG1, 0(BASE)
1038 | bne ->fff_fallback // Exactly one argument.
1039 | checknum CARG1
1040 | checkok ->fff_restv
1041 | b ->fff_fallback
1033 | 1042 |
1034 |.ffunc_1 tostring 1043 |.ffunc_1 tostring
1035 | NYI 1044 | // Only handles the string or number case inline.
1045 | checkstr CARG1
1046 | // A __tostring method in the string base metatable is ignored.
1047 | checkok ->fff_restv // String key?
1048 | // Handle numbers inline, unless a number base metatable is present.
1049 | lwz TMP0, DISPATCH_GL(gcroot[GCROOT_BASEMT_NUM])(DISPATCH)
1050 | checknum CARG1
1051 | cmplwi cr1, TMP0, 0
1052 | stw BASE, L->base // Add frame since C call can throw.
1053 |.if SPE
1054 | crand 4*cr0+eq, 4*cr0+lt, 4*cr1+eq
1055 |.else
1056 |.error "NYI"
1057 |.endif
1058 | stw PC, SAVE_PC // Redundant (but a defined value).
1059 | bne ->fff_fallback
1060 | ffgccheck
1061 | mr CARG1, L
1062 | mr CARG2, BASE
1063 | bl extern lj_str_fromnum // (lua_State *L, lua_Number *np)
1064 | // Returns GCstr *.
1065 | evmergelo STR:CRET1, TISSTR, STR:CRET1
1066 | b ->fff_restv
1036 | 1067 |
1037 |//-- Base library: iterators ------------------------------------------- 1068 |//-- Base library: iterators -------------------------------------------
1038 | 1069 |
@@ -1405,7 +1436,20 @@ static void build_subroutines(BuildCtx *ctx)
1405 | b <1 1436 | b <1
1406 | 1437 |
1407 |->fff_gcstep: // Call GC step function. 1438 |->fff_gcstep: // Call GC step function.
1408 | NYI 1439 | // BASE = new base, RC = nargs*8
1440 | mflr SAVE0
1441 | stw BASE, L->base
1442 | add TMP0, BASE, NARGS8:RC
1443 | stw PC, SAVE_PC // Redundant (but a defined value).
1444 | stw TMP0, L->top
1445 | mr CARG1, L
1446 | bl extern lj_gc_step // (lua_State *L)
1447 | lwz BASE, L->base
1448 | mtlr SAVE0
1449 | lwz TMP0, L->top
1450 | sub NARGS8:RC, TMP0, BASE
1451 | lwz CFUNC:RB, FRAME_FUNC(BASE)
1452 | blr
1409 | 1453 |
1410 |//----------------------------------------------------------------------- 1454 |//-----------------------------------------------------------------------
1411 |//-- Special dispatch targets ------------------------------------------- 1455 |//-- Special dispatch targets -------------------------------------------