mirror of
https://github.com/luau-lang/luau.git
synced 2025-04-15 09:23:51 +01:00
### What's new * Fixed many of the false positive errors in indexing of table unions and table intersections * It is now possible to run custom checks over Luau AST during typechecking by setting `customModuleCheck` in `FrontendOptions` * Fixed codegen issue on arm, where number->vector cast could corrupt that number value for the next time it's read ### New Solver * `error` type now behaves as the bottom type during subtyping checks * Fixed the scope that is used in subtyping with generic types * Fixed `astOriginalCallTypes` table often used by LSP to match the old solver --- ### Internal Contributors Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Vighnesh Vijay <vvijay@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
75 lines
2.2 KiB
C++
75 lines
2.2 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "EmitBuiltinsX64.h"
|
|
|
|
#include "Luau/Bytecode.h"
|
|
|
|
#include "Luau/AssemblyBuilderX64.h"
|
|
#include "Luau/IrCallWrapperX64.h"
|
|
#include "Luau/IrRegAllocX64.h"
|
|
|
|
#include "EmitCommonX64.h"
|
|
#include "NativeState.h"
|
|
|
|
#include "lstate.h"
|
|
|
|
namespace Luau
|
|
{
|
|
namespace CodeGen
|
|
{
|
|
namespace X64
|
|
{
|
|
|
|
static void emitBuiltinMathFrexp(IrRegAllocX64& regs, AssemblyBuilderX64& build, int ra, int arg, int nresults)
|
|
{
|
|
IrCallWrapperX64 callWrap(regs, build);
|
|
callWrap.addArgument(SizeX64::xmmword, luauRegValue(arg));
|
|
callWrap.addArgument(SizeX64::qword, sTemporarySlot);
|
|
callWrap.call(qword[rNativeContext + offsetof(NativeContext, libm_frexp)]);
|
|
|
|
build.vmovsd(luauRegValue(ra), xmm0);
|
|
build.mov(luauRegTag(ra), LUA_TNUMBER);
|
|
|
|
if (nresults > 1)
|
|
{
|
|
build.vcvtsi2sd(xmm0, xmm0, dword[sTemporarySlot + 0]);
|
|
build.vmovsd(luauRegValue(ra + 1), xmm0);
|
|
build.mov(luauRegTag(ra + 1), LUA_TNUMBER);
|
|
}
|
|
}
|
|
|
|
static void emitBuiltinMathModf(IrRegAllocX64& regs, AssemblyBuilderX64& build, int ra, int arg, int nresults)
|
|
{
|
|
IrCallWrapperX64 callWrap(regs, build);
|
|
callWrap.addArgument(SizeX64::xmmword, luauRegValue(arg));
|
|
callWrap.addArgument(SizeX64::qword, sTemporarySlot);
|
|
callWrap.call(qword[rNativeContext + offsetof(NativeContext, libm_modf)]);
|
|
|
|
build.vmovsd(xmm1, qword[sTemporarySlot + 0]);
|
|
build.vmovsd(luauRegValue(ra), xmm1);
|
|
build.mov(luauRegTag(ra), LUA_TNUMBER);
|
|
|
|
if (nresults > 1)
|
|
{
|
|
build.vmovsd(luauRegValue(ra + 1), xmm0);
|
|
build.mov(luauRegTag(ra + 1), LUA_TNUMBER);
|
|
}
|
|
}
|
|
|
|
void emitBuiltin(IrRegAllocX64& regs, AssemblyBuilderX64& build, int bfid, int ra, int arg, int nresults)
|
|
{
|
|
switch (bfid)
|
|
{
|
|
case LBF_MATH_FREXP:
|
|
CODEGEN_ASSERT(nresults == 1 || nresults == 2);
|
|
return emitBuiltinMathFrexp(regs, build, ra, arg, nresults);
|
|
case LBF_MATH_MODF:
|
|
CODEGEN_ASSERT(nresults == 1 || nresults == 2);
|
|
return emitBuiltinMathModf(regs, build, ra, arg, nresults);
|
|
default:
|
|
CODEGEN_ASSERT(!"Missing x64 lowering");
|
|
}
|
|
}
|
|
|
|
} // namespace X64
|
|
} // namespace CodeGen
|
|
} // namespace Luau
|