Skip to content

Commit

Permalink
Update Luau to 0.624
Browse files Browse the repository at this point in the history
  • Loading branch information
khvzak committed May 4, 2024
1 parent 984568f commit 59b4675
Show file tree
Hide file tree
Showing 35 changed files with 1,795 additions and 355 deletions.
1 change: 1 addition & 0 deletions luau/CodeGen/include/Luau/BytecodeAnalysis.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace CodeGen

struct IrFunction;

void loadBytecodeTypeInfo(IrFunction& function);
void buildBytecodeBlocks(IrFunction& function, const std::vector<uint8_t>& jumpTargets);
void analyzeBytecodeTypes(IrFunction& function);

Expand Down
6 changes: 5 additions & 1 deletion luau/CodeGen/include/Luau/CodeGen.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ enum class CodeGenCompilationResult
CodeGenAssemblerFinalizationFailure = 7, // Failure during assembler finalization
CodeGenLoweringFailure = 8, // Lowering failed
AllocationFailed = 9, // Native codegen failed due to an allocation error

Count = 10,
};

std::string toString(const CodeGenCompilationResult& result);

struct ProtoCompilationFailure
{
CodeGenCompilationResult result = CodeGenCompilationResult::Success;
Expand Down Expand Up @@ -114,7 +118,6 @@ void setNativeExecutionEnabled(lua_State* L, bool enabled);
using ModuleId = std::array<uint8_t, 16>;

// Builds target function and all inner functions
CodeGenCompilationResult compile_DEPRECATED(lua_State* L, int idx, unsigned int flags = 0, CompilationStats* stats = nullptr);
CompilationResult compile(lua_State* L, int idx, unsigned int flags = 0, CompilationStats* stats = nullptr);
CompilationResult compile(const ModuleId& moduleId, lua_State* L, int idx, unsigned int flags = 0, CompilationStats* stats = nullptr);

Expand Down Expand Up @@ -168,6 +171,7 @@ struct AssemblyOptions
bool includeAssembly = false;
bool includeIr = false;
bool includeOutlinedCode = false;
bool includeIrTypes = false;

IncludeIrPrefix includeIrPrefix = IncludeIrPrefix::Yes;
IncludeUseInfo includeUseInfo = IncludeUseInfo::Yes;
Expand Down
21 changes: 21 additions & 0 deletions luau/CodeGen/include/Luau/IrData.h
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,25 @@ struct BytecodeTypes
uint8_t c = LBC_TYPE_ANY;
};

struct BytecodeRegTypeInfo
{
uint8_t type = LBC_TYPE_ANY;
uint8_t reg = 0; // Register slot where variable is stored
int startpc = 0; // First point where variable is alive (could be before variable has been assigned a value)
int endpc = 0; // First point where variable is dead
};

struct BytecodeTypeInfo
{
std::vector<uint8_t> argumentTypes;
std::vector<BytecodeRegTypeInfo> regTypes;
std::vector<uint8_t> upvalueTypes;

// Offsets into regTypes for each individual register
// One extra element at the end contains the vector size for easier arr[Rn], arr[Rn + 1] range access
std::vector<uint32_t> regTypeOffsets;
};

struct IrFunction
{
std::vector<IrBlock> blocks;
Expand All @@ -994,6 +1013,8 @@ struct IrFunction
std::vector<IrOp> valueRestoreOps;
std::vector<uint32_t> validRestoreOpBlocks;

BytecodeTypeInfo bcTypeInfo;

Proto* proto = nullptr;
bool variadic = false;

Expand Down
3 changes: 3 additions & 0 deletions luau/CodeGen/include/Luau/IrDump.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ void toString(IrToStringContext& ctx, const IrBlock& block, uint32_t index); //
void toString(IrToStringContext& ctx, IrOp op);

void toString(std::string& result, IrConst constant);

const char* getBytecodeTypeName(uint8_t type);

void toString(std::string& result, const BytecodeTypes& bcTypes);

void toStringDetailed(
Expand Down
2 changes: 1 addition & 1 deletion luau/CodeGen/src/AssemblyBuilderX64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,7 +826,7 @@ void AssemblyBuilderX64::vcvtss2sd(OperandX64 dst, OperandX64 src1, OperandX64 s
else
CODEGEN_ASSERT(src2.memSize == SizeX64::dword);

placeAvx("vcvtsd2ss", dst, src1, src2, 0x5a, false, AVX_0F, AVX_F3);
placeAvx("vcvtss2sd", dst, src1, src2, 0x5a, false, AVX_0F, AVX_F3);
}

void AssemblyBuilderX64::vroundsd(OperandX64 dst, OperandX64 src1, OperandX64 src2, RoundingModeX64 roundingMode)
Expand Down
Loading

0 comments on commit 59b4675

Please sign in to comment.