Skip to content

Commit 66b483d

Browse files
committed
v0.15.7+luau690
1 parent df81e58 commit 66b483d

33 files changed

+836
-305
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.6+luau688"
3+
version = "0.15.7+luau690"
44
authors = ["Aleksandr Orlenko <[email protected]>"]
55
edition = "2021"
66
repository = "https://github.com/mlua-rs/luau-src-rs"

luau/Ast/include/Luau/Parser.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,7 @@ class Parser
347347
// check that parser is at lexeme/symbol, move to next lexeme/symbol on success, report failure and continue on failure
348348
bool expectAndConsume(char value, const char* context = nullptr);
349349
bool expectAndConsume(Lexeme::Type type, const char* context = nullptr);
350+
bool expectAndConsumeFailWithLookahead(Lexeme::Type type, const char* context);
350351
void expectAndConsumeFail(Lexeme::Type type, const char* context);
351352

352353
struct MatchLexeme
@@ -366,7 +367,7 @@ class Parser
366367
bool expectMatchAndConsumeRecover(char value, const MatchLexeme& begin, bool searchForMissing);
367368

368369
bool expectMatchEndAndConsume(Lexeme::Type type, const MatchLexeme& begin);
369-
void expectMatchEndAndConsumeFail(Lexeme::Type type, const MatchLexeme& begin);
370+
bool expectMatchEndAndConsumeFailWithLookahead(Lexeme::Type type, const MatchLexeme& begin);
370371

371372
template<typename T>
372373
AstArray<T> copy(const T* data, std::size_t size);
@@ -399,8 +400,12 @@ class Parser
399400
// `astErrorLocation` is associated with the AstTypeError created
400401
// It can be useful to have different error locations so that the parse error can include the next lexeme, while the AstTypeError can precisely
401402
// define the location (possibly of zero size) where a type annotation is expected.
402-
AstTypeError* reportMissingTypeError(const Location& parseErrorLocation, const Location& astErrorLocation, const char* format, ...)
403-
LUAU_PRINTF_ATTR(4, 5);
403+
AstTypeError* reportMissingTypeError(
404+
const Location& parseErrorLocation,
405+
const Location& astErrorLocation,
406+
const char* format,
407+
...
408+
) LUAU_PRINTF_ATTR(4, 5);
404409

405410
AstExpr* reportFunctionArgsError(AstExpr* func, bool self);
406411
void reportAmbiguousCallError();

luau/Ast/src/Ast.cpp

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,24 @@ AstAttr::DeprecatedInfo AstAttr::deprecatedInfo() const
6464
AstAttr::DeprecatedInfo info;
6565
info.deprecated = type == AstAttr::Type::Deprecated;
6666

67-
if (info.deprecated && args.size > 0)
67+
if (info.deprecated && args.size > 0 && args.data[0]->is<AstExprTable>())
6868
{
6969
AstExprTable* table = args.data[0]->as<AstExprTable>();
7070
if (auto useValue = table->getRecord("use"))
7171
{
72-
AstArray<char> use = (*useValue)->as<AstExprConstantString>()->value;
73-
info.use = {{use.data, use.size}};
72+
if ((*useValue)->is<AstExprConstantString>())
73+
{
74+
AstArray<char> use = (*useValue)->as<AstExprConstantString>()->value;
75+
info.use = {{use.data, use.size}};
76+
}
7477
}
7578
if (auto reasonValue = table->getRecord("reason"))
7679
{
77-
AstArray<char> reason = (*reasonValue)->as<AstExprConstantString>()->value;
78-
info.reason = {{reason.data, reason.size}};
80+
if ((*reasonValue)->is<AstExprConstantString>())
81+
{
82+
AstArray<char> reason = (*reasonValue)->as<AstExprConstantString>()->value;
83+
info.reason = {{reason.data, reason.size}};
84+
}
7985
}
8086
}
8187

luau/Ast/src/Parser.cpp

Lines changed: 83 additions & 80 deletions
Original file line numberDiff line numberDiff line change
@@ -1452,9 +1452,11 @@ AstStat* Parser::parseDeclaration(const Location& start, const AstArray<AstAttr*
14521452

14531453
if (chars && !containsNull)
14541454
{
1455-
props.push_back(AstDeclaredExternTypeProperty{
1456-
AstName(chars->data), Location(nameBegin, nameEnd), type, false, Location(begin.location, lexer.previousLocation())
1457-
});
1455+
props.push_back(
1456+
AstDeclaredExternTypeProperty{
1457+
AstName(chars->data), Location(nameBegin, nameEnd), type, false, Location(begin.location, lexer.previousLocation())
1458+
}
1459+
);
14581460
}
14591461
else
14601462
{
@@ -1485,9 +1487,9 @@ AstStat* Parser::parseDeclaration(const Location& start, const AstArray<AstAttr*
14851487

14861488
expectAndConsume(':', "property type annotation");
14871489
AstType* propType = parseType();
1488-
props.push_back(AstDeclaredExternTypeProperty{
1489-
propName->name, propName->location, propType, false, Location(propStart, lexer.previousLocation())
1490-
});
1490+
props.push_back(
1491+
AstDeclaredExternTypeProperty{propName->name, propName->location, propType, false, Location(propStart, lexer.previousLocation())}
1492+
);
14911493
}
14921494
}
14931495

@@ -2118,16 +2120,18 @@ AstType* Parser::parseTableType(bool inDeclarationContext)
21182120
{
21192121
props.push_back(AstTableProp{AstName(chars->data), begin.location, type, access, accessLocation});
21202122
if (options.storeCstData)
2121-
cstItems.push_back(CstTypeTable::Item{
2122-
CstTypeTable::Item::Kind::StringProperty,
2123-
begin.location.begin,
2124-
indexerClosePosition,
2125-
colonPosition,
2126-
tableSeparator(),
2127-
lexer.current().location.begin,
2128-
allocator.alloc<CstExprConstantString>(sourceString, style, blockDepth),
2129-
stringPosition
2130-
});
2123+
cstItems.push_back(
2124+
CstTypeTable::Item{
2125+
CstTypeTable::Item::Kind::StringProperty,
2126+
begin.location.begin,
2127+
indexerClosePosition,
2128+
colonPosition,
2129+
tableSeparator(),
2130+
lexer.current().location.begin,
2131+
allocator.alloc<CstExprConstantString>(sourceString, style, blockDepth),
2132+
stringPosition
2133+
}
2134+
);
21312135
}
21322136
else
21332137
report(begin.location, "String literal contains malformed escape sequence or \\0");
@@ -2148,14 +2152,16 @@ AstType* Parser::parseTableType(bool inDeclarationContext)
21482152
auto tableIndexerResult = parseTableIndexer(access, accessLocation, begin);
21492153
indexer = tableIndexerResult.node;
21502154
if (options.storeCstData)
2151-
cstItems.push_back(CstTypeTable::Item{
2152-
CstTypeTable::Item::Kind::Indexer,
2153-
tableIndexerResult.indexerOpenPosition,
2154-
tableIndexerResult.indexerClosePosition,
2155-
tableIndexerResult.colonPosition,
2156-
tableSeparator(),
2157-
lexer.current().location.begin,
2158-
});
2155+
cstItems.push_back(
2156+
CstTypeTable::Item{
2157+
CstTypeTable::Item::Kind::Indexer,
2158+
tableIndexerResult.indexerOpenPosition,
2159+
tableIndexerResult.indexerClosePosition,
2160+
tableIndexerResult.colonPosition,
2161+
tableSeparator(),
2162+
lexer.current().location.begin,
2163+
}
2164+
);
21592165
}
21602166
}
21612167
}
@@ -2184,14 +2190,16 @@ AstType* Parser::parseTableType(bool inDeclarationContext)
21842190

21852191
props.push_back(AstTableProp{name->name, name->location, type, access, accessLocation});
21862192
if (options.storeCstData)
2187-
cstItems.push_back(CstTypeTable::Item{
2188-
CstTypeTable::Item::Kind::Property,
2189-
Position{0, 0},
2190-
Position{0, 0},
2191-
colonPosition,
2192-
tableSeparator(),
2193-
lexer.current().location.begin
2194-
});
2193+
cstItems.push_back(
2194+
CstTypeTable::Item{
2195+
CstTypeTable::Item::Kind::Property,
2196+
Position{0, 0},
2197+
Position{0, 0},
2198+
colonPosition,
2199+
tableSeparator(),
2200+
lexer.current().location.begin
2201+
}
2202+
);
21952203
}
21962204

21972205
if (lexer.current().type == ',' || lexer.current().type == ';')
@@ -3859,9 +3867,8 @@ AstExpr* Parser::parseString()
38593867
style = AstExprConstantString::QuotedRaw;
38603868
break;
38613869
case Lexeme::QuotedString:
3862-
style = lexer.current().getQuoteStyle() == Lexeme::QuoteStyle::Single
3863-
? AstExprConstantString::QuotedSingle
3864-
: AstExprConstantString::QuotedSimple;
3870+
style = lexer.current().getQuoteStyle() == Lexeme::QuoteStyle::Single ? AstExprConstantString::QuotedSingle
3871+
: AstExprConstantString::QuotedSimple;
38653872
break;
38663873
default:
38673874
LUAU_ASSERT(false && "Invalid string type");
@@ -4092,28 +4099,29 @@ bool Parser::expectAndConsume(char value, const char* context)
40924099
bool Parser::expectAndConsume(Lexeme::Type type, const char* context)
40934100
{
40944101
if (lexer.current().type != type)
4095-
{
4096-
expectAndConsumeFail(type, context);
4102+
return expectAndConsumeFailWithLookahead(type, context);
40974103

4098-
// check if this is an extra token and the expected token is next
4099-
if (lexer.lookahead().type == type)
4100-
{
4101-
// skip invalid and consume expected
4102-
nextLexeme();
4103-
nextLexeme();
4104-
}
4104+
nextLexeme();
4105+
return true;
4106+
}
41054107

4106-
return false;
4107-
}
4108-
else
4108+
// LUAU_NOINLINE is used to limit the stack cost due to std::string objects, and to increase caller performance since this code is cold
4109+
LUAU_NOINLINE bool Parser::expectAndConsumeFailWithLookahead(Lexeme::Type type, const char* context)
4110+
{
4111+
expectAndConsumeFail(type, context);
4112+
4113+
// check if this is an extra token and the expected token is next
4114+
if (lexer.lookahead().type == type)
41094115
{
4116+
// skip invalid and consume expected
4117+
nextLexeme();
41104118
nextLexeme();
4111-
return true;
41124119
}
4120+
4121+
return false;
41134122
}
41144123

4115-
// LUAU_NOINLINE is used to limit the stack cost of this function due to std::string objects, and to increase caller performance since this code is
4116-
// cold
4124+
// LUAU_NOINLINE is used to limit the stack cost due to std::string objects, and to increase caller performance since this code is cold
41174125
LUAU_NOINLINE void Parser::expectAndConsumeFail(Lexeme::Type type, const char* context)
41184126
{
41194127
std::string typeString = Lexeme(Location(Position(0, 0), 0), type).toString();
@@ -4143,6 +4151,7 @@ bool Parser::expectMatchAndConsume(char value, const MatchLexeme& begin, bool se
41434151
}
41444152
}
41454153

4154+
// LUAU_NOINLINE is used to limit the stack cost due to std::string objects, and to increase caller performance since this code is cold
41464155
LUAU_NOINLINE bool Parser::expectMatchAndConsumeRecover(char value, const MatchLexeme& begin, bool searchForMissing)
41474156
{
41484157
Lexeme::Type type = static_cast<Lexeme::Type>(static_cast<unsigned char>(value));
@@ -4185,8 +4194,7 @@ LUAU_NOINLINE bool Parser::expectMatchAndConsumeRecover(char value, const MatchL
41854194
return false;
41864195
}
41874196

4188-
// LUAU_NOINLINE is used to limit the stack cost of this function due to std::string objects, and to increase caller performance since this code is
4189-
// cold
4197+
// LUAU_NOINLINE is used to limit the stack cost due to std::string objects, and to increase caller performance since this code is cold
41904198
LUAU_NOINLINE void Parser::expectMatchAndConsumeFail(Lexeme::Type type, const MatchLexeme& begin, const char* extra)
41914199
{
41924200
std::string typeString = Lexeme(Location(Position(0, 0), 0), type).toString();
@@ -4217,40 +4225,23 @@ LUAU_NOINLINE void Parser::expectMatchAndConsumeFail(Lexeme::Type type, const Ma
42174225
bool Parser::expectMatchEndAndConsume(Lexeme::Type type, const MatchLexeme& begin)
42184226
{
42194227
if (lexer.current().type != type)
4220-
{
4221-
expectMatchEndAndConsumeFail(type, begin);
4228+
return expectMatchEndAndConsumeFailWithLookahead(type, begin);
42224229

4223-
// check if this is an extra token and the expected token is next
4224-
if (lexer.lookahead().type == type)
4225-
{
4226-
// skip invalid and consume expected
4227-
nextLexeme();
4228-
nextLexeme();
4229-
4230-
return true;
4231-
}
4232-
4233-
return false;
4234-
}
4235-
else
4230+
// If the token matches on a different line and a different column, it suggests misleading indentation
4231+
// This can be used to pinpoint the problem location for a possible future *actual* mismatch
4232+
if (lexer.current().location.begin.line != begin.position.line && lexer.current().location.begin.column != begin.position.column &&
4233+
endMismatchSuspect.position.line < begin.position.line) // Only replace the previous suspect with more recent suspects
42364234
{
4237-
// If the token matches on a different line and a different column, it suggests misleading indentation
4238-
// This can be used to pinpoint the problem location for a possible future *actual* mismatch
4239-
if (lexer.current().location.begin.line != begin.position.line && lexer.current().location.begin.column != begin.position.column &&
4240-
endMismatchSuspect.position.line < begin.position.line) // Only replace the previous suspect with more recent suspects
4241-
{
4242-
endMismatchSuspect = begin;
4243-
}
4235+
endMismatchSuspect = begin;
4236+
}
42444237

4245-
nextLexeme();
4238+
nextLexeme();
42464239

4247-
return true;
4248-
}
4240+
return true;
42494241
}
42504242

4251-
// LUAU_NOINLINE is used to limit the stack cost of this function due to std::string objects, and to increase caller performance since this code is
4252-
// cold
4253-
LUAU_NOINLINE void Parser::expectMatchEndAndConsumeFail(Lexeme::Type type, const MatchLexeme& begin)
4243+
// LUAU_NOINLINE is used to limit the stack cost due to std::string objects, and to increase caller performance since this code is cold
4244+
LUAU_NOINLINE bool Parser::expectMatchEndAndConsumeFailWithLookahead(Lexeme::Type type, const MatchLexeme& begin)
42544245
{
42554246
if (endMismatchSuspect.type != Lexeme::Eof && endMismatchSuspect.position.line > begin.position.line)
42564247
{
@@ -4263,6 +4254,18 @@ LUAU_NOINLINE void Parser::expectMatchEndAndConsumeFail(Lexeme::Type type, const
42634254
{
42644255
expectMatchAndConsumeFail(type, begin);
42654256
}
4257+
4258+
// check if this is an extra token and the expected token is next
4259+
if (lexer.lookahead().type == type)
4260+
{
4261+
// skip invalid and consume expected
4262+
nextLexeme();
4263+
nextLexeme();
4264+
4265+
return true;
4266+
}
4267+
4268+
return false;
42664269
}
42674270

42684271
template<typename T>

luau/CodeGen/include/Luau/AssemblyBuilderA64.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,9 @@ class AssemblyBuilderA64
145145
void ins_4s(RegisterA64 dst, uint8_t dstIndex, RegisterA64 src, uint8_t srcIndex);
146146
void dup_4s(RegisterA64 dst, RegisterA64 src, uint8_t index);
147147

148+
void fcmeq_4s(RegisterA64 dst, RegisterA64 src1, RegisterA64 src2);
149+
void bit(RegisterA64 dst, RegisterA64 src, RegisterA64 mask);
150+
148151
// Floating-point rounding and conversions
149152
void frinta(RegisterA64 dst, RegisterA64 src);
150153
void frintm(RegisterA64 dst, RegisterA64 src);

luau/CodeGen/include/Luau/AssemblyBuilderX64.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,11 @@ class AssemblyBuilderX64
162162

163163
void vcmpeqsd(OperandX64 dst, OperandX64 src1, OperandX64 src2);
164164
void vcmpltsd(OperandX64 dst, OperandX64 src1, OperandX64 src2);
165+
void vcmpeqps(OperandX64 dst, OperandX64 src1, OperandX64 src2);
165166

166-
void vblendvpd(RegisterX64 dst, RegisterX64 src1, OperandX64 mask, RegisterX64 src3);
167+
void vblendvps(RegisterX64 dst, RegisterX64 src1, RegisterX64 src2, OperandX64 mask);
168+
void vblendvpd(RegisterX64 dst, RegisterX64 src1, RegisterX64 src2, OperandX64 mask);
169+
void vblendvpd_DEPRECATED(RegisterX64 dst, RegisterX64 src1, OperandX64 mask, RegisterX64 src3);
167170

168171
void vpshufps(RegisterX64 dst, RegisterX64 src1, OperandX64 src2, uint8_t shuffle);
169172
void vpinsrd(RegisterX64 dst, RegisterX64 src1, OperandX64 src2, uint8_t offset);

luau/CodeGen/include/Luau/IrData.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,11 @@ enum class IrCmd : uint8_t
192192
// C, D: double (condition arguments)
193193
SELECT_NUM,
194194

195+
// For each lane in the vector, select B if C == D, otherwise select A
196+
// A, B: TValue (endpoints)
197+
// C, D: TValue (condition arguments)
198+
SELECT_VEC,
199+
195200
// Add/Sub/Mul/Div/Idiv two vectors
196201
// A, B: TValue
197202
ADD_VEC,
@@ -1053,6 +1058,7 @@ struct IrFunction
10531058
std::vector<BytecodeMapping> bcMapping;
10541059
uint32_t entryBlock = 0;
10551060
uint32_t entryLocation = 0;
1061+
uint32_t endLocation = 0;
10561062

10571063
// For each instruction, an operand that can be used to recompute the value
10581064
std::vector<IrOp> valueRestoreOps;

luau/CodeGen/src/AssemblyBuilderA64.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -770,6 +770,32 @@ void AssemblyBuilderA64::dup_4s(RegisterA64 dst, RegisterA64 src, uint8_t index)
770770
commit();
771771
}
772772

773+
void AssemblyBuilderA64::fcmeq_4s(RegisterA64 dst, RegisterA64 src1, RegisterA64 src2)
774+
{
775+
if (logText)
776+
logAppend(" %-12sv%d.4s,v%d.4s,v%d.4s\n", "fcmeq", dst.index, src1.index, src2.index);
777+
778+
// Q U ESz Rm Opcode Rn Rd
779+
uint32_t op = 0b0'1'0'01110001'00000'111001'00000'00000;
780+
781+
place(dst.index | (src1.index << 5) | (src2.index << 16) | op);
782+
783+
commit();
784+
}
785+
786+
void AssemblyBuilderA64::bit(RegisterA64 dst, RegisterA64 src, RegisterA64 mask)
787+
{
788+
if (logText)
789+
logAppend(" %-12sv%d.16b,v%d.16b,v%d.16b\n", "bit", dst.index, src.index, mask.index);
790+
791+
// Q U Rm Opcode Rn Rd
792+
uint32_t op = 0b0'1'1'01110101'00000'000111'00000'00000;
793+
794+
place(dst.index | (src.index << 5) | (mask.index << 16) | op);
795+
796+
commit();
797+
}
798+
773799
void AssemblyBuilderA64::frinta(RegisterA64 dst, RegisterA64 src)
774800
{
775801
CODEGEN_ASSERT(dst.kind == KindA64::d && src.kind == KindA64::d);

0 commit comments

Comments
 (0)