Skip to content

Commit 234c2b1

Browse files
committed
v0.15.9+luau694
1 parent b6652a9 commit 234c2b1

File tree

11 files changed

+157
-189
lines changed

11 files changed

+157
-189
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "luau0-src"
3-
version = "0.15.8+luau693"
3+
version = "0.15.9+luau694"
44
authors = ["Aleksandr Orlenko <[email protected]>"]
55
edition = "2021"
66
repository = "https://github.com/mlua-rs/luau-src-rs"

luau/CodeGen/include/Luau/IrData.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -236,14 +236,14 @@ enum class IrCmd : uint8_t
236236
// Perform a comparison of two tags. Result is an integer register containing 0 or 1
237237
CMP_TAG,
238238
// A, B: tag
239-
// C: condition (eq/neq)
239+
// C: condition (eq/not_eq)
240240

241241
// Perform tag and value comparison. Result is an integer register containing 0 or 1
242242
CMP_SPLIT_TVALUE,
243243
// A: tag
244-
// B: tag (constant: boolean/string)
244+
// B: tag (constant: boolean/number/string)
245245
// C, D: value
246-
// E: condition (eq/neq)
246+
// E: condition (eq/not_eq)
247247

248248
// Unconditional jump
249249
// A: block/vmexit/undef

luau/CodeGen/include/Luau/IrVisitUseDef.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include "Luau/Common.h"
55
#include "Luau/IrData.h"
66

7-
LUAU_FASTFLAG(LuauCodegenDirectCompare)
7+
LUAU_FASTFLAG(LuauCodegenDirectCompare2)
88

99
namespace Luau
1010
{
@@ -40,15 +40,15 @@ static void visitVmRegDefsUses(T& visitor, IrFunction& function, const IrInst& i
4040
visitor.use(inst.b);
4141
break;
4242
case IrCmd::CMP_TAG:
43-
if (FFlag::LuauCodegenDirectCompare)
43+
if (FFlag::LuauCodegenDirectCompare2)
4444
visitor.maybeUse(inst.a);
4545
break;
4646
case IrCmd::JUMP_IF_TRUTHY:
4747
case IrCmd::JUMP_IF_FALSY:
4848
visitor.use(inst.a);
4949
break;
5050
case IrCmd::JUMP_EQ_TAG:
51-
if (FFlag::LuauCodegenDirectCompare)
51+
if (FFlag::LuauCodegenDirectCompare2)
5252
visitor.maybeUse(inst.a);
5353
break;
5454
// A <- B, C

luau/CodeGen/src/BytecodeAnalysis.cpp

Lines changed: 41 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@
1010

1111
#include <algorithm>
1212

13-
LUAU_FASTFLAGVARIABLE(LuauCodeGenBetterBytecodeAnalysis)
14-
1513
namespace Luau
1614
{
1715
namespace CodeGen
@@ -774,26 +772,16 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
774772
}
775773
case LOP_GETTABLE:
776774
{
777-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
778-
{
779-
int ra = LUAU_INSN_A(*pc);
780-
int rb = LUAU_INSN_B(*pc);
781-
int rc = LUAU_INSN_C(*pc);
775+
int ra = LUAU_INSN_A(*pc);
776+
int rb = LUAU_INSN_B(*pc);
777+
int rc = LUAU_INSN_C(*pc);
782778

783-
regTags[ra] = LBC_TYPE_ANY;
779+
regTags[ra] = LBC_TYPE_ANY;
784780

785-
bcType.a = regTags[rb];
786-
bcType.b = regTags[rc];
781+
bcType.a = regTags[rb];
782+
bcType.b = regTags[rc];
787783

788-
bcType.result = regTags[ra];
789-
}
790-
else
791-
{
792-
int rb = LUAU_INSN_B(*pc);
793-
int rc = LUAU_INSN_C(*pc);
794-
bcType.a = regTags[rb];
795-
bcType.b = regTags[rc];
796-
}
784+
bcType.result = regTags[ra];
797785
break;
798786
}
799787
case LOP_SETTABLE:
@@ -851,25 +839,15 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
851839
}
852840
case LOP_GETTABLEN:
853841
{
854-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
855-
{
856-
int ra = LUAU_INSN_A(*pc);
857-
int rb = LUAU_INSN_B(*pc);
842+
int ra = LUAU_INSN_A(*pc);
843+
int rb = LUAU_INSN_B(*pc);
858844

859-
regTags[ra] = LBC_TYPE_ANY;
845+
regTags[ra] = LBC_TYPE_ANY;
860846

861-
bcType.a = regTags[rb];
862-
bcType.b = LBC_TYPE_NUMBER;
847+
bcType.a = regTags[rb];
848+
bcType.b = LBC_TYPE_NUMBER;
863849

864-
bcType.result = regTags[ra];
865-
}
866-
else
867-
{
868-
int rb = LUAU_INSN_B(*pc);
869-
bcType.a = regTags[rb];
870-
bcType.b = LBC_TYPE_NUMBER;
871-
break;
872-
}
850+
bcType.result = regTags[ra];
873851
break;
874852
}
875853
case LOP_SETTABLEN:
@@ -1157,11 +1135,8 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
11571135

11581136
refineRegType(bcTypeInfo, ra, i, bcType.result);
11591137

1160-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1161-
{
1162-
// Fastcall failure fallback is skipped from result propagation
1163-
i += skip;
1164-
}
1138+
// Fastcall failure fallback is skipped from result propagation
1139+
i += skip;
11651140
break;
11661141
}
11671142
case LOP_FASTCALL1:
@@ -1181,11 +1156,8 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
11811156

11821157
refineRegType(bcTypeInfo, ra, i, bcType.result);
11831158

1184-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1185-
{
1186-
// Fastcall failure fallback is skipped from result propagation
1187-
i += skip;
1188-
}
1159+
// Fastcall failure fallback is skipped from result propagation
1160+
i += skip;
11891161
break;
11901162
}
11911163
case LOP_FASTCALL2:
@@ -1205,11 +1177,8 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
12051177

12061178
refineRegType(bcTypeInfo, ra, i, bcType.result);
12071179

1208-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1209-
{
1210-
// Fastcall failure fallback is skipped from result propagation
1211-
i += skip;
1212-
}
1180+
// Fastcall failure fallback is skipped from result propagation
1181+
i += skip;
12131182
break;
12141183
}
12151184
case LOP_FASTCALL3:
@@ -1231,11 +1200,8 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
12311200

12321201
refineRegType(bcTypeInfo, ra, i, bcType.result);
12331202

1234-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1235-
{
1236-
// Fastcall failure fallback is skipped from result propagation
1237-
i += skip;
1238-
}
1203+
// Fastcall failure fallback is skipped from result propagation
1204+
i += skip;
12391205
break;
12401206
}
12411207
case LOP_FORNPREP:
@@ -1347,13 +1313,10 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
13471313
}
13481314
case LOP_GETGLOBAL:
13491315
{
1350-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1351-
{
1352-
int ra = LUAU_INSN_A(*pc);
1316+
int ra = LUAU_INSN_A(*pc);
13531317

1354-
regTags[ra] = LBC_TYPE_ANY;
1355-
bcType.result = regTags[ra];
1356-
}
1318+
regTags[ra] = LBC_TYPE_ANY;
1319+
bcType.result = regTags[ra];
13571320
break;
13581321
}
13591322
case LOP_SETGLOBAL:
@@ -1382,48 +1345,39 @@ void analyzeBytecodeTypes(IrFunction& function, const HostIrHooks& hostHooks)
13821345
case LOP_AND:
13831346
case LOP_OR:
13841347
{
1385-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1386-
{
1387-
int ra = LUAU_INSN_A(*pc);
1388-
int rb = LUAU_INSN_B(*pc);
1389-
int rc = LUAU_INSN_C(*pc);
1348+
int ra = LUAU_INSN_A(*pc);
1349+
int rb = LUAU_INSN_B(*pc);
1350+
int rc = LUAU_INSN_C(*pc);
13901351

1391-
bcType.a = regTags[rb];
1392-
bcType.b = regTags[rc];
1352+
bcType.a = regTags[rb];
1353+
bcType.b = regTags[rc];
13931354

1394-
regTags[ra] = LBC_TYPE_ANY;
1395-
bcType.result = regTags[ra];
1396-
}
1355+
regTags[ra] = LBC_TYPE_ANY;
1356+
bcType.result = regTags[ra];
13971357
break;
13981358
}
13991359
case LOP_ANDK:
14001360
case LOP_ORK:
14011361
{
1402-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1403-
{
1404-
int ra = LUAU_INSN_A(*pc);
1405-
int rb = LUAU_INSN_B(*pc);
1406-
int kc = LUAU_INSN_C(*pc);
1362+
int ra = LUAU_INSN_A(*pc);
1363+
int rb = LUAU_INSN_B(*pc);
1364+
int kc = LUAU_INSN_C(*pc);
14071365

1408-
bcType.a = regTags[rb];
1409-
bcType.b = getBytecodeConstantTag(proto, kc);
1366+
bcType.a = regTags[rb];
1367+
bcType.b = getBytecodeConstantTag(proto, kc);
14101368

1411-
regTags[ra] = LBC_TYPE_ANY;
1412-
bcType.result = regTags[ra];
1413-
}
1369+
regTags[ra] = LBC_TYPE_ANY;
1370+
bcType.result = regTags[ra];
14141371
break;
14151372
}
14161373
case LOP_COVERAGE:
14171374
break;
14181375
case LOP_GETIMPORT:
14191376
{
1420-
if (FFlag::LuauCodeGenBetterBytecodeAnalysis)
1421-
{
1422-
int ra = LUAU_INSN_A(*pc);
1377+
int ra = LUAU_INSN_A(*pc);
14231378

1424-
regTags[ra] = LBC_TYPE_ANY;
1425-
bcType.result = regTags[ra];
1426-
}
1379+
regTags[ra] = LBC_TYPE_ANY;
1380+
bcType.result = regTags[ra];
14271381
break;
14281382
}
14291383
case LOP_CAPTURE:

luau/CodeGen/src/IrBuilder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
#include <string.h>
1414

15-
LUAU_FASTFLAGVARIABLE(LuauCodegenDirectCompare)
15+
LUAU_FASTFLAGVARIABLE(LuauCodegenDirectCompare2)
1616

1717
namespace Luau
1818
{
@@ -381,7 +381,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
381381
translateInstJumpX(*this, pc, i);
382382
break;
383383
case LOP_JUMPXEQKNIL:
384-
if (FFlag::LuauCodegenDirectCompare && isDirectCompare(function.proto, pc, i))
384+
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
385385
{
386386
translateInstJumpxEqNilShortcut(*this, pc, i);
387387

@@ -394,7 +394,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
394394
translateInstJumpxEqNil(*this, pc, i);
395395
break;
396396
case LOP_JUMPXEQKB:
397-
if (FFlag::LuauCodegenDirectCompare && isDirectCompare(function.proto, pc, i))
397+
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
398398
{
399399
translateInstJumpxEqBShortcut(*this, pc, i);
400400

@@ -407,7 +407,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
407407
translateInstJumpxEqB(*this, pc, i);
408408
break;
409409
case LOP_JUMPXEQKN:
410-
if (FFlag::LuauCodegenDirectCompare && isDirectCompare(function.proto, pc, i))
410+
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
411411
{
412412
translateInstJumpxEqNShortcut(*this, pc, i);
413413

@@ -420,7 +420,7 @@ void IrBuilder::translateInst(LuauOpcode op, const Instruction* pc, int i)
420420
translateInstJumpxEqN(*this, pc, i);
421421
break;
422422
case LOP_JUMPXEQKS:
423-
if (FFlag::LuauCodegenDirectCompare && isDirectCompare(function.proto, pc, i))
423+
if (FFlag::LuauCodegenDirectCompare2 && isDirectCompare(function.proto, pc, i))
424424
{
425425
translateInstJumpxEqSShortcut(*this, pc, i);
426426

luau/CodeGen/src/IrLoweringA64.cpp

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
#include "lgc.h"
1414

1515
LUAU_FASTFLAG(LuauCodeGenUnassignedBcTargetAbort)
16-
LUAU_FASTFLAG(LuauCodeGenDirectBtest)
1716
LUAU_FASTFLAG(LuauCodeGenRegAutoSpillA64)
18-
LUAU_FASTFLAG(LuauCodegenDirectCompare)
17+
LUAU_FASTFLAG(LuauCodegenDirectCompare2)
1918

2019
namespace Luau
2120
{
@@ -870,8 +869,6 @@ void IrLoweringA64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
870869
}
871870
case IrCmd::CMP_INT:
872871
{
873-
CODEGEN_ASSERT(FFlag::LuauCodeGenDirectBtest);
874-
875872
inst.regA64 = regs.allocReuse(KindA64::w, index, {inst.a, inst.b});
876873

877874
IrCondition cond = conditionOp(inst.c);
@@ -919,7 +916,7 @@ void IrLoweringA64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
919916
}
920917
case IrCmd::CMP_TAG:
921918
{
922-
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare);
919+
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare2);
923920
inst.regA64 = regs.allocReuse(KindA64::w, index, {inst.a, inst.b});
924921

925922
IrCondition cond = conditionOp(inst.c);
@@ -976,7 +973,7 @@ void IrLoweringA64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
976973
}
977974
case IrCmd::CMP_SPLIT_TVALUE:
978975
{
979-
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare);
976+
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare2);
980977
inst.regA64 = regs.allocReuse(KindA64::w, index, {inst.a, inst.b});
981978

982979
// Second operand of this instruction must be a constant
@@ -1086,7 +1083,7 @@ void IrLoweringA64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
10861083
{
10871084
RegisterA64 zr = noreg;
10881085

1089-
if (FFlag::LuauCodegenDirectCompare)
1086+
if (FFlag::LuauCodegenDirectCompare2)
10901087
{
10911088
RegisterA64 aReg = noreg;
10921089
RegisterA64 bReg = noreg;

luau/CodeGen/src/IrLoweringX64.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@
1717
#include "lgc.h"
1818

1919
LUAU_FASTFLAG(LuauCodeGenUnassignedBcTargetAbort)
20-
LUAU_FASTFLAG(LuauCodeGenDirectBtest)
2120
LUAU_FASTFLAGVARIABLE(LuauCodeGenVBlendpdReorder)
2221
LUAU_FASTFLAG(LuauCodeGenRegAutoSpillA64)
23-
LUAU_FASTFLAG(LuauCodegenDirectCompare)
22+
LUAU_FASTFLAG(LuauCodegenDirectCompare2)
2423

2524
namespace Luau
2625
{
@@ -873,8 +872,6 @@ void IrLoweringX64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
873872
}
874873
case IrCmd::CMP_INT:
875874
{
876-
CODEGEN_ASSERT(FFlag::LuauCodeGenDirectBtest);
877-
878875
// Cannot reuse operand registers as a target because we have to modify it before the comparison
879876
inst.regX64 = regs.allocReg(SizeX64::dword, index);
880877

@@ -924,7 +921,7 @@ void IrLoweringX64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
924921
}
925922
case IrCmd::CMP_TAG:
926923
{
927-
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare);
924+
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare2);
928925
// Cannot reuse operand registers as a target because we have to modify it before the comparison
929926
inst.regX64 = regs.allocReg(SizeX64::dword, index);
930927

@@ -946,7 +943,7 @@ void IrLoweringX64::lowerInst(IrInst& inst, uint32_t index, const IrBlock& next)
946943
}
947944
case IrCmd::CMP_SPLIT_TVALUE:
948945
{
949-
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare);
946+
CODEGEN_ASSERT(FFlag::LuauCodegenDirectCompare2);
950947
// Cannot reuse operand registers as a target because we have to modify it before the comparison
951948
inst.regX64 = regs.allocReg(SizeX64::dword, index);
952949

0 commit comments

Comments
 (0)