diff --git a/src/host/buildvm_libbc.h b/src/host/buildvm_libbc.h index d2d83ea6..ee97836a 100644 --- a/src/host/buildvm_libbc.h +++ b/src/host/buildvm_libbc.h @@ -3,10 +3,13 @@ static const int libbc_endian = 0; static const uint8_t libbc_code[] = { -0 +0,1,2,0,0,1,2,22,1,0,0,72,1,2,0,241,135,158,166,3,220,203,178,130,4,0,1,2,0, +0,1,2,22,1,0,0,72,1,2,0,243,244,148,165,20,198,190,199,252,3,0 }; static const struct { const char *name; int ofs; } libbc_map[] = { -{NULL,0} +{"math_deg",0}, +{"math_rad",25}, +{NULL,50} }; diff --git a/src/lib_math.c b/src/lib_math.c index b23d9a2d..e474f980 100644 --- a/src/lib_math.c +++ b/src/lib_math.c @@ -63,11 +63,8 @@ LJLIB_ASM(math_log) LJLIB_REC(math_log) return FFH_RETRY; } -LJLIB_PUSH(57.29577951308232) -LJLIB_ASM_(math_deg) LJLIB_REC(math_degrad) - -LJLIB_PUSH(0.017453292519943295) -LJLIB_ASM_(math_rad) LJLIB_REC(math_degrad) +LJLIB_LUA(math_deg) /* function(x) return x * 57.29577951308232 end */ +LJLIB_LUA(math_rad) /* function(x) return x * 0.017453292519943295 end */ LJLIB_ASM(math_atan2) LJLIB_REC(.) { diff --git a/src/lj_dispatch.h b/src/lj_dispatch.h index a56b6260..57614d99 100644 --- a/src/lj_dispatch.h +++ b/src/lj_dispatch.h @@ -60,7 +60,7 @@ typedef uint16_t HotCount; #define HOTCOUNT_CALL 1 /* This solves a circular dependency problem -- bump as needed. Sigh. */ -#define GG_NUM_ASMFF 62 +#define GG_NUM_ASMFF 60 #define GG_LEN_DDISP (BC__MAX + GG_NUM_ASMFF) #define GG_LEN_SDISP BC_FUNCF diff --git a/src/lj_ffrecord.c b/src/lj_ffrecord.c index 4aa4f064..30d5c44e 100644 --- a/src/lj_ffrecord.c +++ b/src/lj_ffrecord.c @@ -528,14 +528,6 @@ static void LJ_FASTCALL recff_math_modf(jit_State *J, RecordFFData *rd) rd->nres = 2; } -static void LJ_FASTCALL recff_math_degrad(jit_State *J, RecordFFData *rd) -{ - TRef tr = lj_ir_tonum(J, J->base[0]); - TRef trm = lj_ir_knum(J, numV(&J->fn->c.upvalue[0])); - J->base[0] = emitir(IRTN(IR_MUL), tr, trm); - UNUSED(rd); -} - static void LJ_FASTCALL recff_math_pow(jit_State *J, RecordFFData *rd) { TRef tr = lj_ir_tonum(J, J->base[0]); diff --git a/src/vm_arm.dasc b/src/vm_arm.dasc index 114416a4..c46d9243 100644 --- a/src/vm_arm.dasc +++ b/src/vm_arm.dasc @@ -1501,19 +1501,6 @@ static void build_subroutines(BuildCtx *ctx) | math_extern2 atan2 | math_extern2 fmod | - |->ff_math_deg: - |.if FPU - | .ffunc_d math_rad - | vldr d1, CFUNC:CARG3->upvalue[0] - | vmul.f64 d0, d0, d1 - | b ->fff_resd - |.else - | .ffunc_n math_rad - | ldrd CARG34, CFUNC:CARG3->upvalue[0] - | bl extern __aeabi_dmul - | b ->fff_restv - |.endif - | |.if HFABI | .ffunc math_ldexp | ldr CARG4, [BASE, #4] diff --git a/src/vm_mips.dasc b/src/vm_mips.dasc index a81dbeeb..e7c89267 100644 --- a/src/vm_mips.dasc +++ b/src/vm_mips.dasc @@ -1521,12 +1521,6 @@ static void build_subroutines(BuildCtx *ctx) | b ->fff_resn |. nop | - |->ff_math_deg: - |.ffunc_n math_rad - |. ldc1 FARG2, CFUNC:RB->upvalue[0] - | b ->fff_resn - |. mul.d FRET1, FARG1, FARG2 - | |.ffunc_nn math_ldexp | cvt.w.d FARG2, FARG2 | load_got ldexp diff --git a/src/vm_ppc.dasc b/src/vm_ppc.dasc index 685ea518..e6fd977b 100644 --- a/src/vm_ppc.dasc +++ b/src/vm_ppc.dasc @@ -1870,12 +1870,6 @@ static void build_subroutines(BuildCtx *ctx) | math_extern2 atan2 | math_extern2 fmod | - |->ff_math_deg: - |.ffunc_n math_rad - | lfd FARG2, CFUNC:RB->upvalue[0] - | fmul FARG1, FARG1, FARG2 - | b ->fff_resn - | |.if DUALNUM |.ffunc math_ldexp | cmplwi NARGS8:RC, 16 diff --git a/src/vm_ppcspe.dasc b/src/vm_ppcspe.dasc index 4fabc02f..b443f1b3 100644 --- a/src/vm_ppcspe.dasc +++ b/src/vm_ppcspe.dasc @@ -1456,12 +1456,6 @@ static void build_subroutines(BuildCtx *ctx) | math_extern2 atan2 | math_extern2 fmod | - |->ff_math_deg: - |.ffunc_n math_rad - | evldd CARG2, CFUNC:RB->upvalue[0] - | efdmul CRET1, CARG1, CARG2 - | b ->fff_restv - | |.ffunc math_ldexp | cmplwi NARGS8:RC, 16 | evldd CARG2, 0(BASE) diff --git a/src/vm_x86.dasc b/src/vm_x86.dasc index 7020eb27..bf42f5d2 100644 --- a/src/vm_x86.dasc +++ b/src/vm_x86.dasc @@ -2030,12 +2030,6 @@ static void build_subroutines(BuildCtx *ctx) | math_extern cosh | math_extern tanh | - |->ff_math_deg: - |.ffunc_nsse math_rad - | mov CFUNC:RB, [BASE-8] - | mulsd xmm0, qword CFUNC:RB->upvalue[0] - | jmp ->fff_resxmm0 - | |.ffunc_nn math_atan2; fpatan; jmp ->fff_resn |.ffunc_nnr math_ldexp; fscale; fpop1; jmp ->fff_resn |