mirror of
https://github.com/love2d/megasource.git
synced 2026-08-20 04:30:45 +02:00
update luajit to LuaJIT/LuaJIT@8e6520a
This commit is contained in:
+101
-5
@@ -1,6 +1,6 @@
|
||||
|// Low-level VM code for x86 CPUs.
|
||||
|// Bytecode interpreter, fast functions and helper functions.
|
||||
|// Copyright (C) 2005-2025 Mike Pall. See Copyright Notice in luajit.h
|
||||
|// Copyright (C) 2005-2026 Mike Pall. See Copyright Notice in luajit.h
|
||||
|
|
||||
|.if P64
|
||||
|.arch x64
|
||||
@@ -1730,10 +1730,9 @@ static void build_subroutines(BuildCtx *ctx)
|
||||
| mov dword [BASE-4], LJ_TISNUM
|
||||
| mov dword [BASE-8], RD
|
||||
|.else
|
||||
| movsd xmm0, qword [BASE+8]
|
||||
| sseconst_1 xmm1, RBa
|
||||
| addsd xmm0, xmm1
|
||||
| cvttsd2si RD, xmm0
|
||||
| cvttsd2si RD, qword [BASE+8]
|
||||
| add RD, 1
|
||||
| cvtsi2sd xmm0, RD
|
||||
| movsd qword [BASE-8], xmm0
|
||||
|.endif
|
||||
| mov TAB:RB, [BASE]
|
||||
@@ -3059,6 +3058,98 @@ static void build_subroutines(BuildCtx *ctx)
|
||||
| ret
|
||||
|
|
||||
|//-----------------------------------------------------------------------
|
||||
|//-- Number conversion functions ----------------------------------------
|
||||
|//-----------------------------------------------------------------------
|
||||
|
|
||||
|// int64_t lj_vm_num2int_check(double x)
|
||||
|->vm_num2int_check:
|
||||
|.if not X64
|
||||
| movsd xmm0, qword [esp+4]
|
||||
|.endif
|
||||
| cvttsd2si eax, xmm0
|
||||
| xorps xmm1, xmm1
|
||||
| cvtsi2sd xmm1, eax
|
||||
| ucomisd xmm1, xmm0
|
||||
| jp >1
|
||||
| jne >1
|
||||
|.if not X64
|
||||
| xor edx, edx
|
||||
|.endif
|
||||
| ret
|
||||
|1:
|
||||
|.if X64
|
||||
| mov64 rax, U64x(80000000,80000000)
|
||||
|.else
|
||||
| mov eax, 0x80000000
|
||||
| mov edx, eax
|
||||
|.endif
|
||||
| ret
|
||||
|
|
||||
|// int64_t lj_vm_num2i64(double x)
|
||||
|->vm_num2i64:
|
||||
|.if X64
|
||||
| cvttsd2si rax, xmm0
|
||||
| ret
|
||||
|.else
|
||||
| sub esp, 12
|
||||
| fld qword [esp+16]
|
||||
| fisttp qword [esp]
|
||||
| mov eax, dword [esp]
|
||||
| mov edx, dword [esp+4]
|
||||
| add esp, 12
|
||||
| ret
|
||||
|.endif
|
||||
|
|
||||
|// uint64_t lj_vm_num2u64(double x)
|
||||
|->vm_num2u64:
|
||||
|.if X64
|
||||
| cvttsd2si rax, xmm0 // Convert [-2^63..2^63) range.
|
||||
| cmp rax, 1 // Indefinite result -0x8000000000000000LL - 1 sets overflow.
|
||||
| jo >1
|
||||
| ret
|
||||
|1:
|
||||
| mov64 rdx, U64x(c3f00000,00000000) // -0x1p64 (double).
|
||||
| movd xmm1, rdx
|
||||
| addsd xmm0, xmm1
|
||||
| cvttsd2si rax, xmm0 // Convert [2^63..2^64+2^63) range.
|
||||
| // Note that -0x1p63 converts to -0x8000000000000000LL either way.
|
||||
| ret
|
||||
|.else
|
||||
| sub esp, 12
|
||||
| fld qword [esp+16]
|
||||
| fld st0
|
||||
| fisttp qword [esp]
|
||||
| mov edx, dword [esp+4]
|
||||
| mov eax, dword [esp]
|
||||
| cmp edx, 1
|
||||
| jo >2
|
||||
|1:
|
||||
| fpop
|
||||
| add esp, 12
|
||||
| ret
|
||||
|2:
|
||||
| cmp eax, 0
|
||||
| jne <1
|
||||
| mov dword [esp+8], 0xdf800000 // -0x1p64 (float).
|
||||
| fadd dword [esp+8]
|
||||
| fisttp qword [esp]
|
||||
| mov eax, dword [esp]
|
||||
| mov edx, dword [esp+4]
|
||||
| add esp, 12
|
||||
| ret
|
||||
|.endif
|
||||
|
|
||||
|// int32_t lj_vm_tobit(double x)
|
||||
|->vm_tobit:
|
||||
|.if not X64
|
||||
| movsd xmm0, qword [esp+4]
|
||||
|.endif
|
||||
| sseconst_tobit xmm1, RCa
|
||||
| addsd xmm0, xmm1
|
||||
| movd eax, xmm0
|
||||
| ret
|
||||
|
|
||||
|//-----------------------------------------------------------------------
|
||||
|//-- Miscellaneous functions --------------------------------------------
|
||||
|//-----------------------------------------------------------------------
|
||||
|
|
||||
@@ -3764,11 +3855,16 @@ static void build_ins(BuildCtx *ctx, BCOp op, int defop)
|
||||
| checkint RD, >5
|
||||
| mov RB, [BASE+RD*8]
|
||||
| neg RB
|
||||
| jz >3
|
||||
| jo >4
|
||||
| mov dword [BASE+RA*8+4], LJ_TISNUM
|
||||
|8:
|
||||
| mov dword [BASE+RA*8], RB
|
||||
|9:
|
||||
| ins_next
|
||||
|3:
|
||||
| mov dword [BASE+RA*8+4], 0x80000000 // -0.
|
||||
| jmp <8
|
||||
|4:
|
||||
| mov dword [BASE+RA*8+4], 0x41e00000 // 2^31.
|
||||
| mov dword [BASE+RA*8], 0
|
||||
|
||||
Reference in New Issue
Block a user