mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-13 13:30:40 +00:00
97965c7c0a
* `ClassType` can now have an indexer defined on it. This allows custom types to be used in `t[x]` expressions. * Fixed search for closest executable breakpoint line. Previously, breakpoints might have been skipped in `else` blocks at the end of a function * Fixed how unification is performed for two optional types `a? <: b?`, previously it might have unified either 'a' or 'b' with 'nil'. Note that this fix is not enabled by default yet (see the list in `ExperimentalFlags.h`) In the new type solver, a concept of 'Type Families' has been introduced. Type families can be thought of as type aliases with custom type inference/reduction logic included with them. For example, we can have an `Add<T, U>` type family that will resolve the type that is the result of adding two values together. This will help type inference to figure out what 'T' and 'U' might be when explicit type annotations are not provided. In this update we don't define any type families, but they will be added in the near future. It is also possible for Luau embedders to define their own type families in the global/environment scope. Other changes include: * Fixed scope used to find out which generic types should be included in the function generic type list * Fixed a crash after cyclic bound types were created during unification And in native code generation (jit): * Use of arm64 target on M1 now requires macOS 13 * Entry into native code has been optimized. This is especially important for coroutine call/pcall performance as they involve going through a C call frame * LOP_LOADK(X) translation into IR has been improved to enable type tag/constant propagation * arm64 can use integer immediate values to synthesize floating-point values * x64 assembler removes duplicate 64bit numbers from the data section to save space * Linux `perf` can now be used to profile native Luau code (when running with --codegen-perf CLI argument)
45 lines
1.1 KiB
C++
45 lines
1.1 KiB
C++
// This file is part of the Luau programming language and is licensed under MIT License; see LICENSE.txt for details
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <stdint.h>
|
|
|
|
struct lua_State;
|
|
|
|
namespace Luau
|
|
{
|
|
namespace CodeGen
|
|
{
|
|
|
|
bool isSupported();
|
|
|
|
void create(lua_State* L);
|
|
|
|
// Builds target function and all inner functions
|
|
void compile(lua_State* L, int idx);
|
|
|
|
using AnnotatorFn = void (*)(void* context, std::string& result, int fid, int instpos);
|
|
|
|
struct AssemblyOptions
|
|
{
|
|
bool outputBinary = false;
|
|
|
|
bool includeAssembly = false;
|
|
bool includeIr = false;
|
|
bool includeOutlinedCode = false;
|
|
|
|
// Optional annotator function can be provided to describe each instruction, it takes function id and sequential instruction id
|
|
AnnotatorFn annotator = nullptr;
|
|
void* annotatorContext = nullptr;
|
|
};
|
|
|
|
// Generates assembly for target function and all inner functions
|
|
std::string getAssembly(lua_State* L, int idx, AssemblyOptions options = {});
|
|
|
|
using PerfLogFn = void (*)(void* context, uintptr_t addr, unsigned size, const char* symbol);
|
|
|
|
void setPerfLog(void* context, PerfLogFn logFn);
|
|
|
|
} // namespace CodeGen
|
|
} // namespace Luau
|