Commit Graph

1024 Commits

Author SHA1 Message Date
Andy Friesen
a0fe195305 Merge branch 'upstream' into merge 2023-03-10 11:21:41 -08:00
Andy Friesen
cfee765dc7 Merge branch 'master' into merge 2023-03-10 11:20:20 -08:00
Andy Friesen
4653484913 Sync to upstream/release/567 2023-03-10 11:20:04 -08:00
niansa/tuxifan
78798d4641
Fixed lerp() duplicate when compiling for C++20 (#851) 2023-03-06 04:42:59 -08:00
vegorov-rbx
140e5a1495
Sync to upstream/release/566 (#853)
* Fixed incorrect lexeme generated for string parts in the middle of an
interpolated string (Fixes https://github.com/Roblox/luau/issues/744)
* DeprecatedApi lint can report some issues without type inference
information
* Fixed performance of autocomplete requests when suggestions have large
intersection types (Solves
https://github.com/Roblox/luau/discussions/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
https://github.com/Roblox/luau/issues/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
2023-03-03 12:21:14 -08:00
Vyacheslav Egorov
ac9718e31a Merge branch 'upstream' into merge 2023-03-03 15:53:22 +02:00
Vyacheslav Egorov
ca34b44be6 Merge branch 'master' into merge 2023-03-03 15:53:16 +02:00
Vyacheslav Egorov
9a281f0492 Sync to upstream/release/566 2023-03-03 15:45:38 +02:00
Arseny Kapoulkine
48172dd5b1
Update SECURITY.md
Note that native code gen is currently exempt from any security guarantees as it's a pre-production R&D component right now. This will change in the future as we deploy it to production.
2023-03-01 14:40:40 -08:00
Arseny Kapoulkine
6601c41bff
Correct table.getn/foreach deprecation RFC (#848)
It looks like all three functions actually have been deprecated in Lua
5.1, and removed in Lua 5.2.

We do not plan to remove them to retain backwards compatibility, but the
RFC should be more precise.
2023-02-27 12:30:33 -08:00
Arseny Kapoulkine
aef99ae0d4
docs: Add deprecation notice to getn/foreach/foreachi (#849)
RFC:
https://github.com/Roblox/luau/blob/master/rfcs/deprecate-table-getn-foreach.md
2023-02-27 12:30:23 -08:00
Andy Friesen
d2ab5df62b
Sync to upstream/release/565 (#845)
We've made a few small changes to reduce the amount of stack we use when
typechecking nested method calls (eg `foo:bar():baz():quux()`).

We've also fixed a small bytecode compiler issue that caused us to emit
redundant jump instructions in code that conditionally uses `break` or
`continue`.

On the new solver, we've switched to a new, better way to handle
augmentations to unsealed tables. We've also made some substantial
improvements to type inference and error reporting on function calls.
These things should both be on par with the old solver now.

The main improvements to the native code generator have been elimination
of some redundant type tag checks. Also, we are starting to inline
particular fastcalls directly to IR.

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-02-24 13:49:38 -08:00
Andy Friesen
e58bb1b27f GCC fix. 2023-02-24 10:29:24 -08:00
Andy Friesen
7a822c9429 Merge branch 'upstream' into merge 2023-02-24 10:25:04 -08:00
Andy Friesen
3974fcc0e9 Merge branch 'master' into merge 2023-02-24 10:24:58 -08:00
Andy Friesen
1e7b23fbfc Sync to upstream/release/565 2023-02-24 10:24:22 -08:00
B. Gibbons
fbd93cbc03
docs: update readme installation guide (#792)
1. Added information about Homebrew installation (based off this
information [here](https://formulae.brew.sh/formula/luau#default))
2. Added details related to installing binary files that are downloaded
3. Rearranged and added titles for easier reading

Fixes #791.

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
2023-02-23 13:08:45 -08:00
vegorov-rbx
b570ff0a37
Sync to upstream/release/564 (#841)
This week we only have updates to new type solver and JIT. Both projects
are still in the process of being built out. Neither are ready for
general use yet.

In the new solver, we fixed issues with recursive type aliases.
Duplicated type parameters are once again reported, exported types are
being recorder and function argument names are placed inside function
types.
We also made improvements to restore parts of bidirectional type
tracking.

On native code generation side, namecall instruction lowering was fixed,
we fixed inconsistencies in IR command definitions and added utility
function to help with constant folding.
2023-02-17 15:41:51 -08:00
Vyacheslav Egorov
be06c31ce5 Merge branch 'upstream' into merge 2023-02-17 16:55:33 +02:00
Vyacheslav Egorov
1f8ec89465 Merge branch 'master' into merge 2023-02-17 16:55:28 +02:00
Vyacheslav Egorov
5c77305609 Sync to upstream/release/564 2023-02-17 16:53:37 +02:00
Arseny Kapoulkine
2e5f95ca58
Update STATUS.md 2023-02-14 12:25:58 -08:00
Arseny Kapoulkine
8f37fc6dfc
RFC: Deprecate table.getn/foreach/foreachi (#715)
[Rendered](https://github.com/Roblox/luau/blob/zeux-rfc-deptable/rfcs/deprecate-table-getn-foreach.md)
2023-02-14 12:25:12 -08:00
Arseny Kapoulkine
742702a17d
Update lower-bounds-calculation.md
This RFC is abandoned; for posterity we will keep this in the tree for now, as it's likely that it represents a subset of the future set of LTI rules
2023-02-14 12:23:54 -08:00
Andy Friesen
c5089def6e
Sync to upstream/release/563 (#833)
* Fix a bug where reading a property from an unsealed table caused
inference to improperly infer the existence of that property.
* Fix #827

We have also made a lot of progress on the new solver and the JIT. Both
projects are still in the process of being built out. Neither are ready
for general use yet.

We are mostly working to tighten up how the new solver handles
refinements and updates to unsealed tables to bring it up to the same
level as the old solver.

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-02-10 11:40:38 -08:00
Andy Friesen
c3b194538f Merge branch 'upstream' into merge 2023-02-10 10:51:49 -08:00
Andy Friesen
41ff9cbe64 Merge branch 'master' into merge 2023-02-10 10:51:45 -08:00
Andy Friesen
b388e27995 Sync to upstream/release/563 2023-02-10 10:50:54 -08:00
Epix
18a1dc3440
Fix comments on jump instructions with AUX (#808)
It seems like for jump instructions that include an AUX 32-bit word,
that index is included as part of the jump offset.
2023-02-09 06:12:58 -08:00
vegorov-rbx
c5555c6573
News about string interpolation feature and a syntax page update (#829)
News can be viewed
[here](https://vegorov-rbx.github.io/luau/2023/02/02/luau-string-interpolation.html)
And syntax can be viewed
[here](https://vegorov-rbx.github.io/luau/syntax#string-interpolation)

Note that link appears to be broken in the news section. It goes to
`https://vegorov-rbx.github.io/syntax#string-interpolation` instead of
`https://vegorov-rbx.github.io/luau/syntax#string-interpolation`
The link I use in the source is `/syntax#string-interpolation` but the
root 'offset' is different on Luau website (doesn't have extra 'luau'
folder) and on my GitHub pages.
Hope this is ok. But if GitHub page masters know how to avoid this,
please let me know.

---------

Co-authored-by: Alan Jeffrey <403333+asajeffrey@users.noreply.github.com>
Co-authored-by: Alexander McCord <11488393+alexmccord@users.noreply.github.com>
2023-02-03 11:41:13 -08:00
vegorov-rbx
62483d40f0
Sync to upstream/release/562 (#828)
* Fixed rare use-after-free in analysis during table unification

A lot of work these past months went into two new Luau components:
* A near full rewrite of the typechecker using a new deferred constraint
resolution system
* Native code generation for AoT/JiT compilation of VM bytecode into x64
(avx)/arm64 instructions

Both of these components are far from finished and we don't provide
documentation on building and using them at this point.
However, curious community members expressed interest in learning about
changes that go into these components each week, so we are now listing
them here in the 'sync' pull request descriptions.

---
New typechecker can be enabled by setting
DebugLuauDeferredConstraintResolution flag to 'true'.
It is considered unstable right now, so try it at your own risk.
Even though it already provides better type inference than the current
one in some cases, our main goal right now is to reach feature parity
with current typechecker.
Features which improve over the capabilities of the current typechecker
are marked as '(NEW)'.

Changes to new typechecker:
* Regular for loop index and parameters are now typechecked
* Invalid type annotations on local variables are ignored to improve
autocomplete
* Fixed missing autocomplete type suggestions for function arguments
* Type reduction is now performed to produce simpler types to be
presented to the user (error messages, custom LSPs)
* Internally, complex types like '((number | string) & ~(false?)) |
string' can be produced, which is just 'string | number' when simplified
* Fixed spots where support for unknown and never types was missing
* (NEW) Length operator '#' is now valid to use on top table type, this
type comes up when doing typeof(x) == "table" guards and isn't available
in current typechecker

---
Changes to native code generation:
* Additional math library fast calls are now lowered to x64: math.ldexp,
math.round, math.frexp, math.modf, math.sign and math.clamp
2023-02-03 11:26:13 -08:00
Vyacheslav Egorov
c76dd1ce9f Merge branch 'upstream' into merge 2023-02-03 14:34:42 +02:00
Vyacheslav Egorov
f49f073621 Merge branch 'master' into merge 2023-02-03 14:34:37 +02:00
Vyacheslav Egorov
dba2936823 Sync to upstream/release/562 2023-02-03 14:34:12 +02:00
Andy Friesen
f763f4c948
Sync to upstream/release/561 (#820)
* Fix a potential debugger crash by adding checks for invalid stack
index values

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-01-27 14:28:31 -08:00
Andy Friesen
523db5eaca Another GCC fix. 2023-01-27 14:15:57 -08:00
Andy Friesen
b7af49c8b5 Fix signed/unsigned comparison warnings on GCC. 2023-01-27 14:04:10 -08:00
Andy Friesen
a17481baca Merge branch 'upstream' into merge 2023-01-27 13:29:29 -08:00
Andy Friesen
7c5dd3c263 Merge branch 'master' into merge 2023-01-27 13:29:24 -08:00
Andy Friesen
53d03f94f7 Sync to upstream/release/561 2023-01-27 13:28:45 -08:00
vegorov-rbx
4a2e8013c7
Sync to upstream/release/560 (#810)
* For autocomplete, additional information is included in Scope for type
alias name locations and names of imported modules
* Improved autocomplete suggestions in 'for' and 'while' loop headers
* String match functions return types are now optional strings and
numbers because match is not guaranteed at runtime
* Fixed build issue on gcc 11 and up (Fixes
https://github.com/Roblox/luau/issues/806)
2023-01-20 12:27:03 -08:00
Vyacheslav Egorov
b0b7dfb714 Fix a few style changes that went out-of-sync 2023-01-20 14:18:59 +02:00
Vyacheslav Egorov
7a43ae3b37 Merge branch 'upstream' into merge 2023-01-20 14:16:10 +02:00
Vyacheslav Egorov
652f31958d Merge branch 'master' into merge 2023-01-20 14:03:22 +02:00
Vyacheslav Egorov
eec289ad1b Sync to upstream/release/560 2023-01-20 14:02:39 +02:00
Harold Cindy
729bc44729
Fix lua_*upvalue() when upvalue names aren't in debug info (#787)
`lua_getupvalue()` and `lua_setupvalue()` don't behave as expected when
working with Lua closure whose `Proto` has no debug info. The code
currently uses `sizeupvalues` to do bounds checking of upvalue indices,
but that's the size of the upvalue _names_ array. It will always be `0`
if the `Proto` doesn't have debug info.

This uses `nups` instead, and just returns `""` as the upvalue name if
we don't have one, same as for C closures.

Co-authored-by: Harold Cindy <HaroldCindy@users.noreply.github.com>
2023-01-18 06:00:13 -08:00
Andy Friesen
a5c6a38b10
Sync to upstream/release/559 (#804)
* Fix autocompletion of if-then-else expressions
* Fix a potential crash surrounding improper use of `%*` in a string
format specifier
* All Python scripts now invoke Python via `python3` rather than
`python`.
* Improved error handling for string interpolation with too many
arguments.

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-01-13 14:10:01 -08:00
Andy Friesen
efaf15ef7c Merge branch 'upstream' into merge 2023-01-13 12:38:14 -08:00
Andy Friesen
b1000a6889 Merge branch 'master' into merge 2023-01-13 12:38:09 -08:00
Andy Friesen
96c1cafff2 Sync to upstream/release/559 2023-01-13 12:36:28 -08:00