Skip to content

Commit 2b8b9fe

Browse files
committed
v0.8.2+luau613
1 parent 49b3643 commit 2b8b9fe

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+813
-752
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.8.1+luau611"
3+
version = "0.8.2+luau613"
44
authors = ["Aleksandr Orlenko <[email protected]>"]
55
edition = "2021"
66
repository = "https://github.com/khvzak/luau-src-rs"

luau/Ast/src/Ast.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,8 +522,8 @@ void AstStatLocal::visit(AstVisitor* visitor)
522522
}
523523
}
524524

525-
AstStatFor::AstStatFor(const Location& location, AstLocal* var, AstExpr* from, AstExpr* to, AstExpr* step, AstStatBlock* body, bool hasDo,
526-
const Location& doLocation)
525+
AstStatFor::AstStatFor(
526+
const Location& location, AstLocal* var, AstExpr* from, AstExpr* to, AstExpr* step, AstStatBlock* body, bool hasDo, const Location& doLocation)
527527
: AstStat(ClassIndex(), location)
528528
, var(var)
529529
, from(from)

luau/Ast/src/Parser.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -599,8 +599,7 @@ AstStat* Parser::parseFor()
599599
bool hasEnd = expectMatchEndAndConsume(Lexeme::ReservedEnd, matchDo);
600600
body->hasEnd = hasEnd;
601601

602-
return allocator.alloc<AstStatForIn>(
603-
Location(start, end), copy(vars), copy(values), body, hasIn, inLocation, hasDo, matchDo.location);
602+
return allocator.alloc<AstStatForIn>(Location(start, end), copy(vars), copy(values), body, hasIn, inLocation, hasDo, matchDo.location);
604603
}
605604
}
606605

@@ -907,8 +906,7 @@ AstStat* Parser::parseDeclaration(const Location& start)
907906
{
908907
props.push_back(parseDeclaredClassMethod());
909908
}
910-
else if (lexer.current().type == '[' && (lexer.lookahead().type == Lexeme::RawString ||
911-
lexer.lookahead().type == Lexeme::QuotedString))
909+
else if (lexer.current().type == '[' && (lexer.lookahead().type == Lexeme::RawString || lexer.lookahead().type == Lexeme::QuotedString))
912910
{
913911
const Lexeme begin = lexer.current();
914912
nextLexeme(); // [

luau/CodeGen/include/Luau/AddressA64.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ struct AddressA64
3232
, offset(xzr)
3333
, data(off)
3434
{
35-
LUAU_ASSERT(base.kind == KindA64::x || base == sp);
36-
LUAU_ASSERT(kind != AddressKindA64::reg);
35+
CODEGEN_ASSERT(base.kind == KindA64::x || base == sp);
36+
CODEGEN_ASSERT(kind != AddressKindA64::reg);
3737
}
3838

3939
constexpr AddressA64(RegisterA64 base, RegisterA64 offset)
@@ -42,8 +42,8 @@ struct AddressA64
4242
, offset(offset)
4343
, data(0)
4444
{
45-
LUAU_ASSERT(base.kind == KindA64::x);
46-
LUAU_ASSERT(offset.kind == KindA64::x);
45+
CODEGEN_ASSERT(base.kind == KindA64::x);
46+
CODEGEN_ASSERT(offset.kind == KindA64::x);
4747
}
4848

4949
AddressKindA64 kind;

luau/CodeGen/include/Luau/AssemblyBuilderA64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ class AssemblyBuilderA64
176176
// Extracts code offset (in bytes) from label
177177
uint32_t getLabelOffset(const Label& label)
178178
{
179-
LUAU_ASSERT(label.location != ~0u);
179+
CODEGEN_ASSERT(label.location != ~0u);
180180
return label.location * 4;
181181
}
182182

luau/CodeGen/include/Luau/AssemblyBuilderX64.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ class AssemblyBuilderX64
179179
// Extracts code offset (in bytes) from label
180180
uint32_t getLabelOffset(const Label& label)
181181
{
182-
LUAU_ASSERT(label.location != ~0u);
182+
CODEGEN_ASSERT(label.location != ~0u);
183183
return label.location;
184184
}
185185

luau/CodeGen/include/Luau/BytecodeSummary.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
22
#pragma once
33

4-
#include "Luau/Common.h"
4+
#include "Luau/CodeGenCommon.h"
55
#include "Luau/Bytecode.h"
66

77
#include <string>
@@ -49,21 +49,21 @@ class FunctionBytecodeSummary
4949

5050
void incCount(unsigned nesting, uint8_t op)
5151
{
52-
LUAU_ASSERT(nesting <= getNestingLimit());
53-
LUAU_ASSERT(op < getOpLimit());
52+
CODEGEN_ASSERT(nesting <= getNestingLimit());
53+
CODEGEN_ASSERT(op < getOpLimit());
5454
++counts[nesting][op];
5555
}
5656

5757
unsigned getCount(unsigned nesting, uint8_t op) const
5858
{
59-
LUAU_ASSERT(nesting <= getNestingLimit());
60-
LUAU_ASSERT(op < getOpLimit());
59+
CODEGEN_ASSERT(nesting <= getNestingLimit());
60+
CODEGEN_ASSERT(op < getOpLimit());
6161
return counts[nesting][op];
6262
}
6363

6464
const std::vector<unsigned>& getCounts(unsigned nesting) const
6565
{
66-
LUAU_ASSERT(nesting <= getNestingLimit());
66+
CODEGEN_ASSERT(nesting <= getNestingLimit());
6767
return counts[nesting];
6868
}
6969

luau/CodeGen/include/Luau/CodeGen.h

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,21 @@ enum CodeGenFlags
2323
CodeGen_ColdFunctions = 1 << 1,
2424
};
2525

26+
// These enum values can be reported through telemetry.
27+
// To ensure consistency, changes should be additive.
2628
enum class CodeGenCompilationResult
2729
{
28-
Success, // Successfully generated code for at least one function
29-
NothingToCompile, // There were no new functions to compile
30-
31-
CodeGenNotInitialized, // Native codegen system is not initialized
32-
CodeGenFailed, // Native codegen failed due to an internal compiler error
33-
AllocationFailed, // Native codegen failed due to an allocation error
30+
Success = 0, // Successfully generated code for at least one function
31+
NothingToCompile = 1, // There were no new functions to compile
32+
NotNativeModule = 2, // Module does not have `--!native` comment
33+
34+
CodeGenNotInitialized = 3, // Native codegen system is not initialized
35+
CodeGenOverflowInstructionLimit = 4, // Instruction limit overflow
36+
CodeGenOverflowBlockLimit = 5, // Block limit overflow
37+
CodeGenOverflowBlockInstructionLimit = 6, // Block instruction limit overflow
38+
CodeGenAssemblerFinalizationFailure = 7, // Failure during assembler finalization
39+
CodeGenLoweringFailure = 8, // Lowering failed
40+
AllocationFailed = 9, // Native codegen failed due to an allocation error
3441
};
3542

3643
struct CompilationStats
@@ -40,6 +47,7 @@ struct CompilationStats
4047
size_t nativeDataSizeBytes = 0;
4148
size_t nativeMetadataSizeBytes = 0;
4249

50+
uint32_t functionsTotal = 0;
4351
uint32_t functionsCompiled = 0;
4452
};
4553

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
2+
#pragma once
3+
4+
#include "Luau/Common.h"
5+
6+
#if defined(LUAU_ASSERTENABLED)
7+
#define CODEGEN_ASSERT(expr) ((void)(!!(expr) || (Luau::assertCallHandler(#expr, __FILE__, __LINE__, __FUNCTION__) && (LUAU_DEBUGBREAK(), 0))))
8+
#elif defined(CODEGEN_ENABLE_ASSERT_HANDLER)
9+
#define CODEGEN_ASSERT(expr) ((void)(!!(expr) || Luau::assertCallHandler(#expr, __FILE__, __LINE__, __FUNCTION__)))
10+
#else
11+
#define CODEGEN_ASSERT(expr) (void)sizeof(!!(expr))
12+
#endif

luau/CodeGen/include/Luau/ConditionX64.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
22
#pragma once
33

4-
#include "Luau/Common.h"
4+
#include "Luau/CodeGenCommon.h"
55

66
namespace Luau
77
{
@@ -102,7 +102,7 @@ inline ConditionX64 getReverseCondition(ConditionX64 cond)
102102
case ConditionX64::NotParity:
103103
return ConditionX64::Parity;
104104
case ConditionX64::Count:
105-
LUAU_ASSERT(!"invalid ConditionX64 value");
105+
CODEGEN_ASSERT(!"invalid ConditionX64 value");
106106
}
107107

108108
return ConditionX64::Count;

luau/CodeGen/include/Luau/IrAnalysis.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
22
#pragma once
33

4-
#include "Luau/Common.h"
4+
#include "Luau/CodeGenCommon.h"
55

66
#include <bitset>
77
#include <queue>
@@ -167,7 +167,7 @@ struct BlockIteratorWrapper
167167

168168
uint32_t operator[](size_t pos) const
169169
{
170-
LUAU_ASSERT(pos < size_t(itEnd - itBegin));
170+
CODEGEN_ASSERT(pos < size_t(itEnd - itBegin));
171171
return itBegin[pos];
172172
}
173173
};

luau/CodeGen/include/Luau/IrData.h

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -995,13 +995,13 @@ struct IrFunction
995995

996996
IrBlock& blockOp(IrOp op)
997997
{
998-
LUAU_ASSERT(op.kind == IrOpKind::Block);
998+
CODEGEN_ASSERT(op.kind == IrOpKind::Block);
999999
return blocks[op.index];
10001000
}
10011001

10021002
IrInst& instOp(IrOp op)
10031003
{
1004-
LUAU_ASSERT(op.kind == IrOpKind::Inst);
1004+
CODEGEN_ASSERT(op.kind == IrOpKind::Inst);
10051005
return instructions[op.index];
10061006
}
10071007

@@ -1015,15 +1015,15 @@ struct IrFunction
10151015

10161016
IrConst& constOp(IrOp op)
10171017
{
1018-
LUAU_ASSERT(op.kind == IrOpKind::Constant);
1018+
CODEGEN_ASSERT(op.kind == IrOpKind::Constant);
10191019
return constants[op.index];
10201020
}
10211021

10221022
uint8_t tagOp(IrOp op)
10231023
{
10241024
IrConst& value = constOp(op);
10251025

1026-
LUAU_ASSERT(value.kind == IrConstKind::Tag);
1026+
CODEGEN_ASSERT(value.kind == IrConstKind::Tag);
10271027
return value.valueTag;
10281028
}
10291029

@@ -1044,7 +1044,7 @@ struct IrFunction
10441044
{
10451045
IrConst& value = constOp(op);
10461046

1047-
LUAU_ASSERT(value.kind == IrConstKind::Int);
1047+
CODEGEN_ASSERT(value.kind == IrConstKind::Int);
10481048
return value.valueInt;
10491049
}
10501050

@@ -1065,7 +1065,7 @@ struct IrFunction
10651065
{
10661066
IrConst& value = constOp(op);
10671067

1068-
LUAU_ASSERT(value.kind == IrConstKind::Uint);
1068+
CODEGEN_ASSERT(value.kind == IrConstKind::Uint);
10691069
return value.valueUint;
10701070
}
10711071

@@ -1086,7 +1086,7 @@ struct IrFunction
10861086
{
10871087
IrConst& value = constOp(op);
10881088

1089-
LUAU_ASSERT(value.kind == IrConstKind::Double);
1089+
CODEGEN_ASSERT(value.kind == IrConstKind::Double);
10901090
return value.valueDouble;
10911091
}
10921092

@@ -1106,14 +1106,14 @@ struct IrFunction
11061106
uint32_t getBlockIndex(const IrBlock& block) const
11071107
{
11081108
// Can only be called with blocks from our vector
1109-
LUAU_ASSERT(&block >= blocks.data() && &block <= blocks.data() + blocks.size());
1109+
CODEGEN_ASSERT(&block >= blocks.data() && &block <= blocks.data() + blocks.size());
11101110
return uint32_t(&block - blocks.data());
11111111
}
11121112

11131113
uint32_t getInstIndex(const IrInst& inst) const
11141114
{
11151115
// Can only be called with instructions from our vector
1116-
LUAU_ASSERT(&inst >= instructions.data() && &inst <= instructions.data() + instructions.size());
1116+
CODEGEN_ASSERT(&inst >= instructions.data() && &inst <= instructions.data() + instructions.size());
11171117
return uint32_t(&inst - instructions.data());
11181118
}
11191119

@@ -1154,7 +1154,7 @@ struct IrFunction
11541154

11551155
BytecodeTypes getBytecodeTypesAt(int pcpos) const
11561156
{
1157-
LUAU_ASSERT(pcpos >= 0);
1157+
CODEGEN_ASSERT(pcpos >= 0);
11581158

11591159
if (size_t(pcpos) < bcTypes.size())
11601160
return bcTypes[pcpos];
@@ -1165,31 +1165,31 @@ struct IrFunction
11651165

11661166
inline IrCondition conditionOp(IrOp op)
11671167
{
1168-
LUAU_ASSERT(op.kind == IrOpKind::Condition);
1168+
CODEGEN_ASSERT(op.kind == IrOpKind::Condition);
11691169
return IrCondition(op.index);
11701170
}
11711171

11721172
inline int vmRegOp(IrOp op)
11731173
{
1174-
LUAU_ASSERT(op.kind == IrOpKind::VmReg);
1174+
CODEGEN_ASSERT(op.kind == IrOpKind::VmReg);
11751175
return op.index;
11761176
}
11771177

11781178
inline int vmConstOp(IrOp op)
11791179
{
1180-
LUAU_ASSERT(op.kind == IrOpKind::VmConst);
1180+
CODEGEN_ASSERT(op.kind == IrOpKind::VmConst);
11811181
return op.index;
11821182
}
11831183

11841184
inline int vmUpvalueOp(IrOp op)
11851185
{
1186-
LUAU_ASSERT(op.kind == IrOpKind::VmUpvalue);
1186+
CODEGEN_ASSERT(op.kind == IrOpKind::VmUpvalue);
11871187
return op.index;
11881188
}
11891189

11901190
inline uint32_t vmExitOp(IrOp op)
11911191
{
1192-
LUAU_ASSERT(op.kind == IrOpKind::VmExit);
1192+
CODEGEN_ASSERT(op.kind == IrOpKind::VmExit);
11931193
return op.index;
11941194
}
11951195

luau/CodeGen/include/Luau/IrVisitUseDef.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ static void visitVmRegDefsUses(T& visitor, IrFunction& function, const IrInst& i
117117
{
118118
if (count >= 3)
119119
{
120-
LUAU_ASSERT(inst.d.kind == IrOpKind::VmReg && vmRegOp(inst.d) == vmRegOp(inst.c) + 1);
120+
CODEGEN_ASSERT(inst.d.kind == IrOpKind::VmReg && vmRegOp(inst.d) == vmRegOp(inst.c) + 1);
121121

122122
visitor.useRange(vmRegOp(inst.c), count);
123123
}
@@ -206,12 +206,12 @@ static void visitVmRegDefsUses(T& visitor, IrFunction& function, const IrInst& i
206206

207207
default:
208208
// All instructions which reference registers have to be handled explicitly
209-
LUAU_ASSERT(inst.a.kind != IrOpKind::VmReg);
210-
LUAU_ASSERT(inst.b.kind != IrOpKind::VmReg);
211-
LUAU_ASSERT(inst.c.kind != IrOpKind::VmReg);
212-
LUAU_ASSERT(inst.d.kind != IrOpKind::VmReg);
213-
LUAU_ASSERT(inst.e.kind != IrOpKind::VmReg);
214-
LUAU_ASSERT(inst.f.kind != IrOpKind::VmReg);
209+
CODEGEN_ASSERT(inst.a.kind != IrOpKind::VmReg);
210+
CODEGEN_ASSERT(inst.b.kind != IrOpKind::VmReg);
211+
CODEGEN_ASSERT(inst.c.kind != IrOpKind::VmReg);
212+
CODEGEN_ASSERT(inst.d.kind != IrOpKind::VmReg);
213+
CODEGEN_ASSERT(inst.e.kind != IrOpKind::VmReg);
214+
CODEGEN_ASSERT(inst.f.kind != IrOpKind::VmReg);
215215
break;
216216
}
217217
}

0 commit comments

Comments
 (0)