mirror of
https://github.com/luau-lang/luau.git
synced 2025-01-31 23:03:10 +00:00
c2ba1058c3
# What's changed? - Record the location of properties for table types (closes #802) - Implement stricter UTF-8 validations as per the RFC (https://github.com/luau-lang/rfcs/pull/1) - Implement `buffer` as a new type in both the old and new solvers. - Changed errors produced by some `buffer` builtins to be a bit more generic to avoid platform-dependent error messages. - Fixed a bug where `Unifier` would copy some persistent types, tripping some internal assertions. - Type checking rules on relational operators is now a little bit more lax. - Improve dead code elimination for some `if` statements with complex always-false conditions ## New type solver - Dataflow analysis now generates phi nodes on exit of branches. - Dataflow analysis avoids producing a new definition for locals or properties that are not owned by that loop. - If a function parameter has been constrained to `never`, report errors at all uses of that parameter within that function. - Switch to using the new `Luau::Set` to replace `std::unordered_set` to alleviate some poor allocation characteristics which was negatively affecting overall performance. - Subtyping can now report many failing reasons instead of just the first one that we happened to find during the test. - Subtyping now also report reasons for type pack mismatches. - When visiting `if` statements or expressions, the resulting context are the common terms in both branches. ## Native codegen - Implement support for `buffer` builtins to its IR for x64 and A64. - Optimized `table.insert` by not inserting a table barrier if it is fastcalled with a constant. ## Internal Contributors Co-authored-by: Aaron Weiss <aaronweiss@roblox.com> Co-authored-by: Alexander McCord <amccord@roblox.com> Co-authored-by: Andy Friesen <afriesen@roblox.com> Co-authored-by: Arseny Kapoulkine <arseny@roblox.com> Co-authored-by: Aviral Goel <agoel@roblox.com> Co-authored-by: Lily Brown <lbrown@roblox.com> Co-authored-by: Vyacheslav Egorov <vegorov@roblox.com>
94 lines
2.2 KiB
C++
94 lines
2.2 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 "Luau/AssemblyBuilderA64.h"
|
|
#include "Luau/DenseHash.h"
|
|
#include "Luau/IrData.h"
|
|
|
|
#include "IrRegAllocA64.h"
|
|
#include "IrValueLocationTracking.h"
|
|
|
|
#include <vector>
|
|
|
|
namespace Luau
|
|
{
|
|
namespace CodeGen
|
|
{
|
|
|
|
struct ModuleHelpers;
|
|
struct AssemblyOptions;
|
|
struct LoweringStats;
|
|
|
|
namespace A64
|
|
{
|
|
|
|
struct IrLoweringA64
|
|
{
|
|
IrLoweringA64(AssemblyBuilderA64& build, ModuleHelpers& helpers, IrFunction& function, LoweringStats* stats);
|
|
|
|
void lowerInst(IrInst& inst, uint32_t index, const IrBlock& next);
|
|
void finishBlock(const IrBlock& curr, const IrBlock& next);
|
|
void finishFunction();
|
|
|
|
bool hasError() const;
|
|
|
|
bool isFallthroughBlock(const IrBlock& target, const IrBlock& next);
|
|
void jumpOrFallthrough(IrBlock& target, const IrBlock& next);
|
|
|
|
Label& getTargetLabel(IrOp op, Label& fresh);
|
|
void finalizeTargetLabel(IrOp op, Label& fresh);
|
|
|
|
// Operand data build helpers
|
|
// May emit data/address synthesis instructions
|
|
RegisterA64 tempDouble(IrOp op);
|
|
RegisterA64 tempInt(IrOp op);
|
|
RegisterA64 tempUint(IrOp op);
|
|
AddressA64 tempAddr(IrOp op, int offset);
|
|
AddressA64 tempAddrBuffer(IrOp bufferOp, IrOp indexOp);
|
|
|
|
// May emit restore instructions
|
|
RegisterA64 regOp(IrOp op);
|
|
|
|
// Operand data lookup helpers
|
|
IrConst constOp(IrOp op) const;
|
|
uint8_t tagOp(IrOp op) const;
|
|
int intOp(IrOp op) const;
|
|
unsigned uintOp(IrOp op) const;
|
|
double doubleOp(IrOp op) const;
|
|
|
|
IrBlock& blockOp(IrOp op) const;
|
|
Label& labelOp(IrOp op) const;
|
|
|
|
struct InterruptHandler
|
|
{
|
|
Label self;
|
|
unsigned int pcpos;
|
|
Label next;
|
|
};
|
|
|
|
struct ExitHandler
|
|
{
|
|
Label self;
|
|
unsigned int pcpos;
|
|
};
|
|
|
|
AssemblyBuilderA64& build;
|
|
ModuleHelpers& helpers;
|
|
|
|
IrFunction& function;
|
|
LoweringStats* stats = nullptr;
|
|
|
|
IrRegAllocA64 regs;
|
|
|
|
IrValueLocationTracking valueTracker;
|
|
|
|
std::vector<InterruptHandler> interruptHandlers;
|
|
std::vector<ExitHandler> exitHandlers;
|
|
DenseHashMap<uint32_t, uint32_t> exitHandlerMap;
|
|
|
|
bool error = false;
|
|
};
|
|
|
|
} // namespace A64
|
|
} // namespace CodeGen
|
|
} // namespace Luau
|