Skip to content

Commit c836feb

Browse files
andyfriesenhgoldsteinvrn-snayoungbloodrbxmenarulalam
authored
Sync to upstream/release/702 (#2126)
Hello! This week, we've made a bunch of improvements to the performance and stability of the analysis system. We've also made some small improvements to inlining and native codegen. # Autocomplete * Suggest singleton string keys from indexers # General * Reduce stack utilization of the parser # Analysis * User-defined type functions don't need separate irreducible errors when they error. * Fix a performance problem that could occur when selecting an overload for a function call. * Fix a hang that could occur in function generalization. * Delete EqSat. It was a very promising experiment but it didn't work out. * Properly treat negation types as being contravariant in their operands. (ie if `A <: B`, then `~B <: ~A`) * Add a new C++ utility function `Frontend::parseType`. This function allocates a `TypeId` from a string that contains a valid Luau type annotation. * Correctly infer the type of a property lookup on a table which contains an indexer which is a union of string singletons. (eg `{["foo"|"bar"]: number}`) # VM * Reevaluate the inlining cost model using constant function arguments. * Constant-fold `string.char` and `string.sub`. # Native Codegen * Fix a perfermance regression that could happen when running out of registers. * 32-bit integer addition and subtraction using bit32 library can be performed by integer instructions without extra double conversions # Internal Contributors Co-authored-by: Andy Friesen <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Sora Kanosue <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> --------- Co-authored-by: Hunter Goldstein <[email protected]> Co-authored-by: Varun Saini <[email protected]> Co-authored-by: Alexander Youngblood <[email protected]> Co-authored-by: Menarul Alam <[email protected]> Co-authored-by: Aviral Goel <[email protected]> Co-authored-by: Vighnesh <[email protected]> Co-authored-by: Vyacheslav Egorov <[email protected]> Co-authored-by: Ariel Weiss <[email protected]> Co-authored-by: Ilya Rezvov <[email protected]>
1 parent 535f925 commit c836feb

File tree

122 files changed

+4169
-7408
lines changed

Some content is hidden

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

122 files changed

+4169
-7408
lines changed

Analysis/include/Luau/ConstraintGenerator.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "Luau/ConstraintSet.h"
77
#include "Luau/ControlFlow.h"
88
#include "Luau/DataFlowGraph.h"
9-
#include "Luau/EqSatSimplification.h"
109
#include "Luau/HashUtil.h"
1110
#include "Luau/InsertionOrderedMap.h"
1211
#include "Luau/Module.h"
@@ -113,8 +112,6 @@ struct ConstraintGenerator
113112
// Needed to be able to enable error-suppression preservation for immediate refinements.
114113
NotNull<Normalizer> normalizer;
115114

116-
NotNull<Simplifier> simplifier;
117-
118115
// Needed to register all available type functions for execution at later stages.
119116
NotNull<TypeFunctionRuntime> typeFunctionRuntime;
120117
DenseHashMap<const AstStatTypeFunction*, ScopePtr> astTypeFunctionEnvironmentScopes{nullptr};
@@ -141,7 +138,6 @@ struct ConstraintGenerator
141138
ConstraintGenerator(
142139
ModulePtr module,
143140
NotNull<Normalizer> normalizer,
144-
NotNull<Simplifier> simplifier,
145141
NotNull<TypeFunctionRuntime> typeFunctionRuntime,
146142
NotNull<ModuleResolver> moduleResolver,
147143
NotNull<BuiltinTypes> builtinTypes,
@@ -381,6 +377,7 @@ struct ConstraintGenerator
381377
TypeId resolveTableType(const ScopePtr& scope, AstType* ty, AstTypeTable* tab, bool inTypeArguments, bool replaceErrorWithFresh);
382378
TypeId resolveFunctionType(const ScopePtr& scope, AstType* ty, AstTypeFunction* fn, bool inTypeArguments, bool replaceErrorWithFresh);
383379

380+
public:
384381
/**
385382
* Resolves a type from its AST annotation.
386383
* @param scope the scope that the type annotation appears within.
@@ -390,6 +387,7 @@ struct ConstraintGenerator
390387
**/
391388
TypeId resolveType(const ScopePtr& scope, AstType* ty, bool inTypeArguments, bool replaceErrorWithFresh = false);
392389

390+
private:
393391
// resolveType() is recursive, but we only want to invoke
394392
// inferGenericPolarities() once at the very end. We thus isolate the
395393
// recursive part of the algorithm to this internal helper.

Analysis/include/Luau/ConstraintSolver.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
#include "Luau/ConstraintSet.h"
77
#include "Luau/DataFlowGraph.h"
88
#include "Luau/DenseHash.h"
9-
#include "Luau/EqSatSimplification.h"
109
#include "Luau/Error.h"
1110
#include "Luau/Location.h"
1211
#include "Luau/Module.h"
@@ -101,7 +100,6 @@ struct ConstraintSolver
101100
NotNull<BuiltinTypes> builtinTypes;
102101
InternalErrorReporter iceReporter;
103102
NotNull<Normalizer> normalizer;
104-
NotNull<Simplifier> simplifier;
105103
NotNull<TypeFunctionRuntime> typeFunctionRuntime;
106104
// The entire set of constraints that the solver is trying to resolve.
107105
ConstraintSet constraintSet;
@@ -167,7 +165,6 @@ struct ConstraintSolver
167165

168166
explicit ConstraintSolver(
169167
NotNull<Normalizer> normalizer,
170-
NotNull<Simplifier> simplifier,
171168
NotNull<TypeFunctionRuntime> typeFunctionRuntime,
172169
ModulePtr module,
173170
NotNull<ModuleResolver> moduleResolver,
@@ -181,7 +178,6 @@ struct ConstraintSolver
181178
// TODO CLI-169086: Replace all uses of this constructor with the ConstraintSet constructor, above.
182179
explicit ConstraintSolver(
183180
NotNull<Normalizer> normalizer,
184-
NotNull<Simplifier> simplifier,
185181
NotNull<TypeFunctionRuntime> typeFunctionRuntime,
186182
NotNull<Scope> rootScope,
187183
std::vector<NotNull<Constraint>> constraints,

Analysis/include/Luau/DataFlowGraph.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ struct DataFlowGraphBuilder
112112
NotNull<struct InternalErrorReporter> handle
113113
);
114114

115+
static DataFlowGraph empty(NotNull<DefArena> defArena, NotNull<RefinementKeyArena> keyArena);
116+
115117
private:
116118
DataFlowGraphBuilder(NotNull<DefArena> defArena, NotNull<RefinementKeyArena> keyArena);
117119

Analysis/include/Luau/EqSatSimplification.h

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)