mirror of
https://github.com/luau-lang/luau.git
synced 2024-11-15 14:25:44 +08:00
31a017c5c7
* Rerun clang-format on the code * Fix the variance on indexer result subtyping. This fixes some issues with inconsistent error reporting. * Fix a bug in the normalization logic for intersections of strings New Type Solver * New overload selection logic * Subtype tests now correctly treat a generic as its upper bound within that generic's scope * Semantic subtyping for negation types * Semantic subtyping between strings and compatible table types like `{lower: (string) -> string}` * Further work toward finalizing our new subtype test * Correctly generalize module-scope symbols Native Codegen * Lowering statistics for assembly * Make executable allocation size/limit configurable without a rebuild. Use `FInt::LuauCodeGenBlockSize` and `FInt::LuauCodeGenMaxTotalSize`. --------- Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com>
59 lines
1.4 KiB
C++
59 lines
1.4 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#include "Luau/IrRegAllocX64.h"
|
|
|
|
#include "doctest.h"
|
|
|
|
using namespace Luau::CodeGen;
|
|
using namespace Luau::CodeGen::X64;
|
|
|
|
class IrRegAllocX64Fixture
|
|
{
|
|
public:
|
|
IrRegAllocX64Fixture()
|
|
: build(/* logText */ true, ABIX64::Windows)
|
|
, regs(build, function, nullptr)
|
|
{
|
|
}
|
|
|
|
void checkMatch(std::string expected)
|
|
{
|
|
build.finalize();
|
|
|
|
CHECK("\n" + build.text == expected);
|
|
}
|
|
|
|
AssemblyBuilderX64 build;
|
|
IrFunction function;
|
|
IrRegAllocX64 regs;
|
|
};
|
|
|
|
TEST_SUITE_BEGIN("IrRegAllocX64");
|
|
|
|
TEST_CASE_FIXTURE(IrRegAllocX64Fixture, "RelocateFix")
|
|
{
|
|
IrInst irInst0{IrCmd::LOAD_DOUBLE};
|
|
irInst0.lastUse = 2;
|
|
function.instructions.push_back(irInst0);
|
|
|
|
IrInst irInst1{IrCmd::LOAD_DOUBLE};
|
|
irInst1.lastUse = 2;
|
|
function.instructions.push_back(irInst1);
|
|
|
|
function.instructions[0].regX64 = regs.takeReg(rax, 0);
|
|
regs.preserve(function.instructions[0]);
|
|
|
|
function.instructions[1].regX64 = regs.takeReg(rax, 1);
|
|
regs.restore(function.instructions[0], true);
|
|
|
|
LUAU_ASSERT(function.instructions[0].regX64 == rax);
|
|
LUAU_ASSERT(function.instructions[1].spilled);
|
|
|
|
checkMatch(R"(
|
|
vmovsd qword ptr [rsp+048h],rax
|
|
vmovsd qword ptr [rsp+050h],rax
|
|
vmovsd rax,qword ptr [rsp+048h]
|
|
)");
|
|
}
|
|
|
|
TEST_SUITE_END();
|