Skip to content

Commit 4c7fbf4

Browse files
committed
Bump Luau to 0.710
1 parent 5acbc9d commit 4c7fbf4

35 files changed

Lines changed: 810 additions & 1003 deletions

luau/Ast/src/Ast.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
#include "Luau/Common.h"
55

6-
LUAU_FASTFLAGVARIABLE(LuauStandaloneParseType)
76

87
LUAU_FASTFLAG(LuauExplicitTypeInstantiationSyntax)
98

luau/Ast/src/Parser.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ LUAU_FASTINTVARIABLE(LuauParseErrorLimit, 100)
2020
LUAU_FASTFLAGVARIABLE(LuauSolverV2)
2121
LUAU_DYNAMIC_FASTFLAGVARIABLE(DebugLuauReportReturnTypeVariadicWithTypeSuffix, false)
2222
LUAU_FASTFLAGVARIABLE(LuauExplicitTypeInstantiationSyntax)
23-
LUAU_FASTFLAG(LuauStandaloneParseType)
2423
LUAU_FASTFLAGVARIABLE(LuauCstStatDoWithStatsStart)
2524
LUAU_FASTFLAGVARIABLE(DesugaredArrayTypeReferenceIsEmpty)
2625

@@ -244,14 +243,11 @@ ParseNodeResult<Node> Parser::runParse(const char* buffer, size_t bufferSize, As
244243
Node* expr = f(p);
245244
size_t lines = p.lexer.current().location.end.line + (bufferSize > 0 && buffer[bufferSize - 1] != '\n');
246245

247-
if (FFlag::LuauStandaloneParseType)
246+
Lexeme eof = p.lexer.next();
247+
if (eof.type != Lexeme::Eof)
248248
{
249-
Lexeme eof = p.lexer.next();
250-
if (eof.type != Lexeme::Eof)
251-
{
252-
expr = nullptr;
253-
p.parseErrors.emplace_back(eof.location, "Expected end of file");
254-
}
249+
expr = nullptr;
250+
p.parseErrors.emplace_back(eof.location, "Expected end of file");
255251
}
256252

257253
return ParseNodeResult<Node>{

luau/CodeGen/include/Luau/CodeGenOptions.h

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ enum CodeGenFlags
1919
CodeGen_ColdFunctions = 1 << 1,
2020
};
2121

22+
enum class CodeGenCounter : unsigned
23+
{
24+
RegularBlockExecuted = 1,
25+
FallbackBlockExecuted = 2,
26+
VmExitTaken = 3,
27+
};
28+
2229
using AllocationCallback = void(void* context, void* oldPointer, size_t oldSize, void* newPointer, size_t newSize);
2330

2431
struct IrBuilder;
@@ -119,8 +126,9 @@ struct CompilationOptions
119126

120127
// null-terminated array of userdata types names that might have custom lowering
121128
const char* const* userdataTypes = nullptr;
122-
};
123129

130+
bool recordCounters = false;
131+
};
124132

125133
using AnnotatorFn = void (*)(void* context, std::string& result, int fid, int instpos);
126134

luau/CodeGen/include/Luau/ConditionX64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ inline ConditionX64 getInverseCondition(ConditionX64 cond)
120120
case ConditionX64::BelowEqual:
121121
return ConditionX64::AboveEqual;
122122
case ConditionX64::Above:
123-
return ConditionX64::Above;
123+
return ConditionX64::Below;
124124
case ConditionX64::AboveEqual:
125125
return ConditionX64::BelowEqual;
126126
case ConditionX64::Equal:

luau/CodeGen/include/Luau/IrBuilder.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ struct IrBuilder
6262

6363
IrOp block(IrBlockKind kind); // Requested kind can be ignored if we are in an outlined sequence
6464
IrOp blockAtInst(uint32_t index);
65+
IrOp fallbackBlock(uint32_t pcpos);
6566

6667
IrOp vmReg(uint8_t index);
6768
IrOp vmConst(uint32_t index);

luau/CodeGen/include/Luau/IrData.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#pragma once
33

44
#include "Luau/Bytecode.h"
5+
#include "Luau/DenseHash.h"
56
#include "Luau/IrAnalysis.h"
67
#include "Luau/Label.h"
78
#include "Luau/RegisterX64.h"
@@ -1202,6 +1203,7 @@ struct IrBlock
12021203
uint32_t chainkey = 0;
12031204
uint32_t expectedNextBlock = ~0u;
12041205

1206+
// Bytecode PC position at which the block was generated
12051207
uint32_t startpc = kBlockNoStartPc;
12061208

12071209
Label label;
@@ -1268,6 +1270,8 @@ struct IrFunction
12681270
uint32_t entryLocation = 0;
12691271
uint32_t endLocation = 0;
12701272

1273+
std::vector<uint32_t> extraNativeData;
1274+
12711275
// For each instruction, an operand that can be used to recompute the value
12721276
std::vector<ValueRestoreLocation> valueRestoreOps;
12731277
std::vector<uint32_t> validRestoreOpBlocks;
@@ -1282,6 +1286,8 @@ struct IrFunction
12821286

12831287
LoweringStats* stats = nullptr;
12841288

1289+
bool recordCounters = false; // Taken from CompilationOptions for easy access
1290+
12851291
IrBlock& blockOp(IrOp op)
12861292
{
12871293
CODEGEN_ASSERT(op.kind == IrOpKind::Block);

luau/CodeGen/include/Luau/IrUtils.h

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
#include "Luau/Common.h"
66
#include "Luau/IrData.h"
77

8-
LUAU_FASTFLAG(LuauCodegenUpvalueLoadProp2)
9-
108
namespace Luau
119
{
1210
namespace CodeGen
@@ -184,9 +182,8 @@ inline bool hasResult(IrCmd cmd)
184182
case IrCmd::BUFFER_READI32:
185183
case IrCmd::BUFFER_READF32:
186184
case IrCmd::BUFFER_READF64:
187-
return true;
188185
case IrCmd::GET_UPVALUE:
189-
return FFlag::LuauCodegenUpvalueLoadProp2;
186+
return true;
190187
default:
191188
break;
192189
}

luau/CodeGen/include/Luau/IrVisitUseDef.h

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

7-
LUAU_FASTFLAG(LuauCodegenUpvalueLoadProp2)
8-
97
namespace Luau
108
{
119
namespace CodeGen
@@ -82,12 +80,8 @@ static void visitVmRegDefsUses(T& visitor, IrFunction& function, IrInst& inst)
8280
visitor.defRange(vmRegOp(OP_A(inst)), function.uintOp(OP_B(inst)));
8381
break;
8482
case IrCmd::GET_UPVALUE:
85-
if (!FFlag::LuauCodegenUpvalueLoadProp2)
86-
visitor.def(OP_A(inst));
8783
break;
8884
case IrCmd::SET_UPVALUE:
89-
if (!FFlag::LuauCodegenUpvalueLoadProp2)
90-
visitor.use(OP_B(inst));
9185
break;
9286
case IrCmd::INTERRUPT:
9387
break;

luau/CodeGen/include/Luau/NativeProtoExecData.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ struct NativeProtoExecDataHeader
3232
// elements in the instruction offsets array following this header.
3333
uint32_t bytecodeInstructionCount = 0;
3434

35+
// The number of extra uin32_t elements of custom data after the bytecode offsets
36+
uint32_t extraDataCount = 0;
37+
3538
// The size of the native code for this NativeProto, in bytes.
3639
size_t nativeCodeSize = 0;
3740
};
@@ -47,7 +50,7 @@ struct NativeProtoExecDataDeleter
4750

4851
using NativeProtoExecDataPtr = std::unique_ptr<uint32_t[], NativeProtoExecDataDeleter>;
4952

50-
[[nodiscard]] NativeProtoExecDataPtr createNativeProtoExecData(uint32_t bytecodeInstructionCount);
53+
[[nodiscard]] NativeProtoExecDataPtr createNativeProtoExecData(uint32_t bytecodeInstructionCount, uint32_t extraDataCount);
5154
void destroyNativeProtoExecData(const uint32_t* instructionOffsets) noexcept;
5255

5356
[[nodiscard]] NativeProtoExecDataHeader& getNativeProtoExecDataHeader(uint32_t* instructionOffsets) noexcept;

luau/CodeGen/src/AssemblyBuilderA64.cpp

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@
77
#include <stdarg.h>
88
#include <stdio.h>
99

10-
LUAU_FASTFLAG(LuauCodegenUpvalueLoadProp2)
11-
LUAU_FASTFLAG(LuauCodegenSplitFloat)
12-
LUAU_FASTFLAG(LuauCodegenLocationEndFix)
13-
LUAU_FASTFLAG(LuauCodegenUintToFloat)
10+
LUAU_FASTFLAG(LuauCodegenA64ClosureOffset)
1411

1512
namespace Luau
1613
{
@@ -1032,23 +1029,13 @@ void AssemblyBuilderA64::scvtf(RegisterA64 dst, RegisterA64 src)
10321029

10331030
void AssemblyBuilderA64::ucvtf(RegisterA64 dst, RegisterA64 src)
10341031
{
1035-
if (FFlag::LuauCodegenUintToFloat)
1036-
{
1037-
CODEGEN_ASSERT(dst.kind == KindA64::d || dst.kind == KindA64::s);
1038-
CODEGEN_ASSERT(src.kind == KindA64::w || src.kind == KindA64::x);
1039-
1040-
if (dst.kind == KindA64::d)
1041-
placeR1("ucvtf", dst, src, 0b000'11110'01'1'00'011'000000);
1042-
else
1043-
placeR1("ucvtf", dst, src, 0b000'11110'00'1'00'011'000000);
1044-
}
1045-
else
1046-
{
1047-
CODEGEN_ASSERT(dst.kind == KindA64::d);
1048-
CODEGEN_ASSERT(src.kind == KindA64::w || src.kind == KindA64::x);
1032+
CODEGEN_ASSERT(dst.kind == KindA64::d || dst.kind == KindA64::s);
1033+
CODEGEN_ASSERT(src.kind == KindA64::w || src.kind == KindA64::x);
10491034

1035+
if (dst.kind == KindA64::d)
10501036
placeR1("ucvtf", dst, src, 0b000'11110'01'1'00'011'000000);
1051-
}
1037+
else
1038+
placeR1("ucvtf", dst, src, 0b000'11110'00'1'00'011'000000);
10521039
}
10531040

10541041
void AssemblyBuilderA64::fjcvtzs(RegisterA64 dst, RegisterA64 src)
@@ -1168,7 +1155,7 @@ uint32_t AssemblyBuilderA64::getCodeSize() const
11681155

11691156
unsigned AssemblyBuilderA64::getInstructionCount() const
11701157
{
1171-
return FFlag::LuauCodegenLocationEndFix ? unsigned(getCodeSize()) : unsigned(getCodeSize()) / 4;
1158+
return unsigned(getCodeSize());
11721159
}
11731160

11741161
bool AssemblyBuilderA64::isMaskSupported(uint32_t mask)
@@ -1298,11 +1285,20 @@ void AssemblyBuilderA64::placeA(const char* name, RegisterA64 dst, AddressA64 sr
12981285
break;
12991286
case AddressKindA64::imm:
13001287
if (unsigned(src.data >> sizelog) < 1024 && (src.data & ((1 << sizelog) - 1)) == 0)
1288+
{
13011289
place(dst.index | (src.base.index << 5) | ((src.data >> sizelog) << 10) | (opsize << 22) | (1 << 24));
1290+
}
13021291
else if (src.data >= -256 && src.data <= 255)
1292+
{
13031293
place(dst.index | (src.base.index << 5) | ((src.data & ((1 << 9) - 1)) << 12) | (opsize << 22));
1294+
}
13041295
else
1296+
{
1297+
if (FFlag::LuauCodegenA64ClosureOffset)
1298+
overflowed = true;
1299+
13051300
CODEGEN_ASSERT(!"Unable to encode large immediate offset");
1301+
}
13061302
break;
13071303
case AddressKindA64::pre:
13081304
CODEGEN_ASSERT(src.data >= -256 && src.data <= 255);

0 commit comments

Comments
 (0)