Commit Graph

997 Commits

Author SHA1 Message Date
vegorov-rbx
d98256bb80
Sync to upstream/release/590 (#1008)
* Better indentation in multi-line type mismatch error messages
* Error message clone can no longer cause a stack overflow (when
typechecking with retainFullTypeGraphs set to false); fixes
https://github.com/Roblox/luau/issues/975
* `string.format` with %s is now ~2x faster on strings smaller than 100
characters

Native code generation:
* All VM side exits will block return to the native execution of the
current function to preserve correctness
* Fixed executable page allocation on Apple platforms when using
hardened runtime
* Added statistics for code generation (no. of functions compiler,
memory used for different areas)
* Fixed issue with function entry type checks performed more that once
in some functions
2023-08-11 07:42:37 -07:00
Vyacheslav Egorov
50571a7a15 Merge branch 'upstream' into merge 2023-08-11 15:57:09 +03:00
Vyacheslav Egorov
d841a32095 Merge branch 'master' into merge 2023-08-11 15:57:03 +03:00
Vyacheslav Egorov
089da9e924 Sync to upstream/release/590 2023-08-11 15:55:30 +03:00
Arseny Kapoulkine
bd229816c0 Remove old benchmark-dev workflows
Nobody is maintaining this and we haven't really used it and are
unlikely to start due to a high degree of noise and lack of dedicated
machines for this setup. Callgrind has worked for us well enough, with
additional profiling performed locally by engineers - this is not
perfect but it doesn't look like we have a path to making this better.
2023-08-08 12:15:10 -07:00
John Hui
3f478bb439
Add luau-compile to .gitignore (#995) 2023-08-07 16:26:16 -07:00
LoganDark
2b03c8f72a
Use const char* const* over const char** (#1005)
The FFI difference becomes significant in languages like Rust where you
can't necessarily just cast a const pointer.
2023-08-07 13:45:04 -07:00
Andy Friesen
0b2755f964
Sync to upstream/release/589 (#1000)
* Progress toward a diffing algorithm for types. We hope that this will
be useful for writing clearer error messages.
* Add a missing recursion limiter in `Unifier::tryUnifyTables`. This was
causing a crash in certain situations.
* Luau heap graph enumeration improvements:
    * Weak references are not reported
    * Added tag as a fallback name of non-string table links
* Included top Luau function information in thread name to understand
where thread might be suspended
* Constant folding for `math.pi` and `math.huge` at -O2
* Optimize `string.format` and `%*`
* This change makes string interpolation 1.5x-2x faster depending on the
number and type of formatted components, assuming a few are using
primitive types, and reduces associated GC pressure.

New type checker:

* Initial work toward tracking the upper and lower bounds of types
accurately.

Native code generation (JIT):

* Add IrCmd::CHECK_TRUTHY for improved assert fast-calls
* Do not compute type map for modules without types
* Capture metatable+readonly state for NEW_TABLE IR instructions
* Replace JUMP_CMP_ANY with CMP_ANY and existing JUMP_EQ_INT
* Add support for exits to VM with reentry lock in VmExit

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-08-04 12:18:54 -07:00
Vyacheslav Egorov
63d9e3e209 Smaller recursion limit for NoOpt in the failing test 2023-08-04 21:07:54 +03:00
Andy Friesen
b26eeacfd2 Merge branch 'upstream' into merge 2023-08-04 10:02:13 -07:00
Andy Friesen
e25b717e54 Merge branch 'master' into merge 2023-08-04 10:02:07 -07:00
Andy Friesen
25cc75b096 * Progress toward a diffing algorithm for types. We hope that this will be useful for writing clearer error messages.
* Add a missing recursion limiter in `Unifier::tryUnifyTables`.  This was causing a crash in certain situations.
* Luau heap graph enumeration improvements:
    * Weak references are not reported
    * Added tag as a fallback name of non-string table links
    * Included top Luau function information in thread name to understand where thread might be suspended
* Constant folding for `math.pi` and `math.huge` at -O2
* Optimize `string.format` and `%*`
    * This change makes string interpolation 1.5x-2x faster depending on the number and type of formatted components, assuming a few are using primitive types, and reduces associated GC pressure.

New solver

* Initial work toward tracking the upper and lower bounds of types more accurately.

JIT

* Add IrCmd::CHECK_TRUTHY for improved assert fast-calls
* Do not compute type map for modules without types
* Capture metatable+readonly state for NEW_TABLE IR instructions
* Replace JUMP_CMP_ANY with CMP_ANY and existing JUMP_EQ_INT
* Add support for exits to VM with reentry lock in VmExit
2023-08-04 10:01:35 -07:00
Federico Cassano
fff897a75f
Fix some EBNF cases in grammar.md (#999) 2023-08-02 13:20:57 -07:00
Someon1e
8b510d3dbb
Add dark theme (#991)
Fixes #333 


![image](https://github.com/Roblox/luau/assets/120410318/539fec9f-3ad1-49cd-ba2f-a47b6c1ee42c)

![image](https://github.com/Roblox/luau/assets/120410318/981981c6-2fbe-46ae-99b1-a1fc2c647a6a)

---------

Co-authored-by: Someone-dQw4w9WgXcQ <dcheunggb@outlook.com>
2023-08-01 09:14:02 -07:00
vegorov-rbx
a08c3409b8
Luau Recap: July 2023 (#993)
If this does make it to the Roblox forum, I think I will cut intro about
new type solver and JIT.


[Rendered](https://github.com/vegorov-rbx/luau/blob/post-recap-july-2023/docs/_posts/2023-07-28-luau-recap-july-2023.md)


[Preview](https://vegorov-rbx.github.io/luau/2023/07/28/luau-recap-july-2023.html)
2023-07-31 13:02:24 -07:00
vegorov-rbx
76f67e0733
Sync to upstream/release/588 (#992)
Type checker/autocomplete:
* `Luau::autocomplete` no longer performs typechecking internally, make
sure to run `Frontend::check` before performing autocomplete requests
* Autocomplete string suggestions without "" are now only suggested
inside the ""
* Autocomplete suggestions now include `function (anonymous autofilled)`
key with a full suggestion for the function expression (with arguments
included) stored in `AutocompleteEntry::insertText`
* `AutocompleteEntry::indexedWithSelf` is provided for function call
suggestions made with `:`
* Cyclic modules now see each other type exports as `any` to prevent
memory use-after-free (similar to module return type)

Runtime:
* Updated inline/loop unroll cost model to better handle assignments
(Fixes https://github.com/Roblox/luau/issues/978)
* `math.noise` speed was improved by ~30%
* `table.concat` speed was improved by ~5-7%
* `tonumber` and `tostring` now have fastcall paths that execute ~1.5x
and ~2.5x faster respectively (fixes #777)
* Fixed crash in `luaL_typename` when index refers to a non-existing
value
* Fixed potential out of memory scenario when using `string.sub` or
`string.char` in a loop
* Fixed behavior of some fastcall builtins when called without arguments
under -O2 to match original functions
* Support for native code execution in VM is now enabled by default
(note: native code still has to be generated explicitly)
* `Codegen::compile` now accepts `CodeGen_OnlyNativeModules` flag. When
set, only modules that have a `--!native` hot-comment at the top will be
compiled to native code

In our new typechecker:
* Generic type packs are no longer considered to be variadic during
unification
* Timeout and cancellation now works in new solver
* Fixed false positive errors around 'table' and 'function' type
refinements
* Table literals now use covariant unification rules. This is sound
since literal has no type specified and has no aliases
* Fixed issues with blocked types escaping the constraint solver
* Fixed more places where error messages that should've been suppressed
were still reported
* Fixed errors when iterating over a top table type

In our native code generation (jit):
* 'DebugLuauAbortingChecks' flag is now supported on A64
* LOP_NEWCLOSURE has been translated to IR
2023-07-28 08:13:53 -07:00
Someon1e
087be529b0
Improve demo site (#990)
Updated builtins tables, made `` highlighted as a string, removed code
that replaced "stdin:" from print messages

Before:

![image](https://github.com/Roblox/luau/assets/120410318/ba399f0b-d612-4f69-a523-56369eafb037)
After:

![image](https://github.com/Roblox/luau/assets/120410318/98ab06c8-9b2a-4d9b-aa86-0a8432296417)

---------

Co-authored-by: Someone-dQw4w9WgXcQ <dcheunggb@outlook.com>
2023-07-28 08:11:16 -07:00
Vyacheslav Egorov
4c6a370872 Merge branch 'upstream' into merge 2023-07-28 15:05:40 +03:00
Vyacheslav Egorov
9fd79ade04 Merge branch 'master' into merge 2023-07-28 15:05:00 +03:00
Vyacheslav Egorov
5e1aca164c Sync to upstream/release/588 2023-07-28 14:37:00 +03:00
Arseny Kapoulkine
f80229c517
docs: Document return value for table.remove (#987)
Fixes #984.
2023-07-26 06:42:23 -07:00
MagelessMayhem
743afe6ec9
README.md: Add Gentoo Linux to listed distributions (#976)
Gentoo recently added Luau to their official overlay (the term they use
to describe their package repository) and it would only be appropriate
to include that detail here.

It may as well also be the first distribution to *officially* package
it, given the maintainer is one of Gentoo's own.

Signed-off-by: Sebastian France <MagelessMayhem@protonmail.com>
2023-07-24 07:21:44 -07:00
Alan Jeffrey
57368fbc58
HATRA 23 paper (#979)
A one-page "progress report" paper.
2023-07-21 15:05:26 -05:00
vegorov-rbx
218159140c
Sync to upstream/release/584 (#977)
* Added support for async typechecking cancellation using a token passed
through frontend options
* Added luaC_enumheap for building debug tools that need a graph of Luau
heap

In our new typechecker:
* Errors or now suppressed when checking property lookup of
error-suppressing unions

In our native code generation (jit):
* Fixed unhandled value type in NOT_ANY lowering
* Fast-call tag checks will exit to VM on failure, instead of relying on
a native fallback
* Added vector type to the type information
* Eliminated redundant direct jumps across dead blocks
* Debugger APIs are now disabled for call frames executing natively
* Implemented support for unwind registration on macOS 14
2023-07-14 11:08:53 -07:00
Vyacheslav Egorov
f16d002db9 GCC fix 2023-07-14 10:38:54 -07:00
Vyacheslav Egorov
4ffa98f4df Merge branch 'upstream' into merge 2023-07-14 08:59:07 -07:00
Vyacheslav Egorov
03063d09e4 Merge branch 'master' into merge 2023-07-14 08:59:01 -07:00
Vyacheslav Egorov
b403075573 Sync to upstream/release/584 2023-07-14 08:57:16 -07:00
Andy Friesen
e25de95445
Sync to upstream/release/583 (#974)
* Fixed indexing table intersections using `x["prop"]` syntax:
https://github.com/Roblox/luau/pull/971
* Add console output codepage for Windows:
https://github.com/Roblox/luau/pull/967
* Added `Frontend::parse` for a fast source graph preparation
* luau_load should check GC
* Work toward a type-diff system for nicer error messages

New Solver
* Correctly suppress errors in more cases
* Further improvements to typechecking of function calls and return
statements
* Crash fixes
* Propagate refinements drawn from the condition of a while loop into
the loop body

JIT
* Fix accidental bailout for math.frexp/modf/sign in A64
* Work toward bringing type annotation info in
* Do not propagate Luau IR constants of wrong type into load
instructions
* CHECK_SAFEENV exits to VM on failure
* Implement error handling in A64 reg allocator
* Inline the string.len builtin
* Do not enter native code of a function if arguments don’t match

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-07-07 13:10:48 -07:00
Andy Friesen
dc2a1cc12c GCC fix. 2023-07-07 12:41:34 -07:00
Andy Friesen
b92d4d7d99 Merge branch 'upstream' into merge 2023-07-07 10:14:50 -07:00
Andy Friesen
01cbf185e8 Merge branch 'master' into merge 2023-07-07 10:14:46 -07:00
Andy Friesen
e00dbbeaf2 Sync to upstream/release/583 2023-07-07 10:14:35 -07:00
Lodinu Kalugalage
c98a9d7051
Add console output codepage for windows (#967)
Previously unicode codepoints would be incorrectly shown in windows
terminals, such as with u2503(┃):
```ps
❯ "print('\u{2503}')" | luau.exe
Γöâ
```

This change fixes the issue by setting the console's codepage on
windows, resulting in fixed behaviour:
```ps
❯ "print('\u{2503}')" | luau.exe
┃
```
2023-07-06 13:00:34 -07:00
JohnnyMorganz
a02eb78c96
Fix indexing table intersections using x["prop"] syntax (#971)
Right now, you can index an intersection of tables fine when using
`x.prop` syntax, but not when using `x["prop"]` syntax.
This fixes it for the latter case

```lua
type Foo = {
	Bar: string,
} & { Baz: number }

local x: Foo = { Bar = "1", Baz = 2 }
local y = x["Bar"] -- TypeError: Expected type table, got '{| Bar: string |} & {| Baz: number |}' instead
```

Part of a fix to
https://github.com/Roblox/luau/issues/533#issuecomment-1291779353
2023-07-05 14:32:51 -07:00
vegorov-rbx
76bea81a7b
Sync to upstream/release/582 (#960)
* Optimized operations like instantiation and module export for very
large types

In our new typechecker:
* Typechecking of function calls was rewritten to handle more cases
correctly
* Fixed a crash that can happen after self-referential type is exported
from a module
* Fixed a false positive error in string comparison
* Added handling of `for...in` variable type annotations and fixed
issues with the iterator call inside
* Self-referential 'hasProp' and 'setProp' constraints are now handled
correctly
 
In our native code generation (jit):
* Added '--target' argument to luau-compile to test multiple
architectures different from host architecture
* GC barrier tag check is skipped if type is already known to be
GC-collectable
* Added GET_TYPE/GET_TYPEOF instructions for type/typeof fast-calls
* Improved code size of interrupt handlers on X64
2023-06-23 23:19:39 -07:00
Vyacheslav Egorov
e1a7c3b0f1 Merge branch 'upstream' into merge 2023-06-24 08:34:11 +03:00
Vyacheslav Egorov
7a2f94a6a0 Merge branch 'master' into merge 2023-06-24 08:34:06 +03:00
Vyacheslav Egorov
8bc2f51d89 Sync to upstream/release/582 2023-06-24 08:33:44 +03:00
Andy Friesen
d458d240cd
Sync to upstream/release/581 (#958)
* Definition files can now ascribe indexers to class types.
(https://github.com/Roblox/luau/pull/949)
* Remove --compile support from the REPL. You can just use luau-compile
instead.
* When an exception is thrown during parallel typechecking (usually an
ICE), we now gracefully stop typechecking and drain active workers
before rethrowing the exception.

New solver

* Include more source location information when we hit an internal
compiler error
* Improve the logic that simplifies intersections of tables

JIT

* Save testable type annotations to bytecode
* Improve block placement for linearized blocks
* Add support for lea reg, [rip+offset] for labels
* Unify X64 and A64 codegen for RETURN
* Outline interrupt handlers for X64
* Remove global rArgN in favor of build.abi
* Change A64 INTERRUPT lowering to match X64

---------

Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
2023-06-16 10:35:18 -07:00
Andy Friesen
00b9898ffc Merge branch 'upstream' into merge 2023-06-16 10:06:38 -07:00
Andy Friesen
f9cfef16c2 Merge branch 'master' into merge 2023-06-16 10:06:33 -07:00
Andy Friesen
6ee4f190ab Sync to upstream/release/581 2023-06-16 10:01:18 -07:00
JohnnyMorganz
bc0722471f
Add support for ClassType indexer in definition files (#949) 2023-06-12 13:02:54 -07:00
RadiatedExodus
7fa69377be
Fix Arch Linux install instructions to use AUR (#953)
The existing instruction is incorrect, the luau package exists on the
Arch Linux User Repository (AUR), not at the official repository.

Feel free to suggest edits if something is wrong/missing, thanks!

(I also have a pkgbuild that builds every executable possible excluding
tests (repl, analyze, ast, reduce), however I did not include this since
releases only include repl and analyze)
2023-06-12 12:06:28 -07:00
Arseny Kapoulkine
ba65b0e9cd
Build and use luau-compile in CI (#952) 2023-06-12 08:46:44 -07:00
vegorov-rbx
3ecd3a82ab
Sync to upstream/release/580 (#951)
* Added luau-compile executable target to build/test compilation without
having full REPL included.

In our new typechecker:
* Fixed the order in which constraints are checked to get more
deterministic errors in different environments
* Fixed `isNumber`/`isString` checks to fix false positive errors in
binary comparisons
* CannotCallNonFunction error is reported when calling an intersection
type of non-functions
 
In our native code generation (jit):
* Outlined X64 return instruction code to improve code size
* Improved performance of return instruction on A64
* Added construction of a dominator tree for future optimizations
2023-06-09 10:08:00 -07:00
Vyacheslav Egorov
212888c361 Fix build warning 2023-06-09 15:46:43 +03:00
Vyacheslav Egorov
a9becc9b70 Merge branch 'upstream' into merge 2023-06-09 15:21:03 +03:00
Vyacheslav Egorov
ef2e46e25e Merge branch 'master' into merge 2023-06-09 15:20:56 +03:00