-
Notifications
You must be signed in to change notification settings - Fork 391
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed incorrect lexeme generated for string parts in the middle of an interpolated string (Fixes #744) * DeprecatedApi lint can report some issues without type inference information * Fixed performance of autocomplete requests when suggestions have large intersection types (Solves #847) * Marked `table.getn`/`foreach`/`foreachi` as deprecated ([RFC: Deprecate table.getn/foreach/foreachi](https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md)) * With -O2 optimization level, we now optimize builtin calls based on known argument/return count. Note that this change can be observable if `getfenv/setfenv` is used to substitute a builtin, especially if arity is different. Fastcall heavy tests show a 1-2% improvement. * Luau can now be built with clang-cl (Fixes #736) We also made many improvements to our experimental components. For our new type solver: * Overhauled data flow analysis system, fixed issues with 'repeat' loops, global variables and type annotations * Type refinements now work on generic table indexing with a string literal * Type refinements will properly track potentially 'nil' values (like t[x] for a missing key) and their further refinements * Internal top table type is now isomorphic to `{}` which fixes issues when `typeof(v) == 'table'` type refinement is handled * References to non-existent types in type annotations no longer resolve to 'error' type like in old solver * Improved handling of class unions in property access expressions * Fixed default type packs * Unsealed tables can now have metatables * Restored expected types for function arguments And for native code generation: * Added min and max IR instructions mapping to vminsd/vmaxsd on x64 * We now speculatively extract direct execution fast-paths based on expected types of expressions which provides better optimization opportunities inside a single basic block * Translated existing math fastcalls to IR form to improve tag guard removal and constant propagation
- Loading branch information
1 parent
48172dd
commit 140e5a1
Showing
99 changed files
with
3,356 additions
and
1,554 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details | ||
#pragma once | ||
|
||
#include "Luau/Def.h" | ||
#include "Luau/NotNull.h" | ||
#include "Luau/Variant.h" | ||
|
||
#include <string> | ||
#include <optional> | ||
|
||
namespace Luau | ||
{ | ||
|
||
using NullableBreadcrumbId = const struct Breadcrumb*; | ||
using BreadcrumbId = NotNull<const struct Breadcrumb>; | ||
|
||
struct FieldMetadata | ||
{ | ||
std::string prop; | ||
}; | ||
|
||
struct SubscriptMetadata | ||
{ | ||
BreadcrumbId key; | ||
}; | ||
|
||
using Metadata = Variant<FieldMetadata, SubscriptMetadata>; | ||
|
||
struct Breadcrumb | ||
{ | ||
NullableBreadcrumbId previous; | ||
DefId def; | ||
std::optional<Metadata> metadata; | ||
std::vector<BreadcrumbId> children; | ||
}; | ||
|
||
inline Breadcrumb* asMutable(NullableBreadcrumbId breadcrumb) | ||
{ | ||
LUAU_ASSERT(breadcrumb); | ||
return const_cast<Breadcrumb*>(breadcrumb); | ||
} | ||
|
||
template<typename T> | ||
const T* getMetadata(NullableBreadcrumbId breadcrumb) | ||
{ | ||
if (!breadcrumb || !breadcrumb->metadata) | ||
return nullptr; | ||
|
||
return get_if<T>(&*breadcrumb->metadata); | ||
} | ||
|
||
struct BreadcrumbArena | ||
{ | ||
TypedAllocator<Breadcrumb> allocator; | ||
|
||
template<typename... Args> | ||
BreadcrumbId add(NullableBreadcrumbId previous, DefId def, Args&&... args) | ||
{ | ||
Breadcrumb* bc = allocator.allocate(Breadcrumb{previous, def, std::forward<Args>(args)...}); | ||
if (previous) | ||
asMutable(previous)->children.push_back(NotNull{bc}); | ||
return NotNull{bc}; | ||
} | ||
|
||
template<typename T, typename... Args> | ||
BreadcrumbId emplace(NullableBreadcrumbId previous, DefId def, Args&&... args) | ||
{ | ||
Breadcrumb* bc = allocator.allocate(Breadcrumb{previous, def, Metadata{T{std::forward<Args>(args)...}}}); | ||
if (previous) | ||
asMutable(previous)->children.push_back(NotNull{bc}); | ||
return NotNull{bc}; | ||
} | ||
}; | ||
|
||
} // namespace Luau |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.