mirror of
https://github.com/luau-lang/luau.git
synced 2024-12-14 06:00:39 +00:00
d98256bb80
* 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
91 lines
2 KiB
C++
91 lines
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;
|
|
|
|
namespace A64
|
|
{
|
|
|
|
struct IrLoweringA64
|
|
{
|
|
IrLoweringA64(AssemblyBuilderA64& build, ModuleHelpers& helpers, IrFunction& function);
|
|
|
|
void lowerInst(IrInst& inst, uint32_t index, const IrBlock& next);
|
|
void finishBlock();
|
|
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);
|
|
|
|
// 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;
|
|
|
|
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
|