From f1fe9c85002a793276e2fbb84fc63a4434ff779b Mon Sep 17 00:00:00 2001 From: noxabellus Date: Sat, 23 Nov 2024 16:14:20 -0600 Subject: [PATCH] updated to luau 0.653 --- build.zig.zon | 4 ++-- build/luau.zig | 4 +++- src/lib.zig | 30 ++++++++++++++++++++++++++++-- 3 files changed, 33 insertions(+), 5 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 719fa1f..c2fa235 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -34,8 +34,8 @@ }, .luau = .{ - .url = "https://github.com/luau-lang/luau/archive/refs/tags/0.607.tar.gz", - .hash = "122003818ff2aa912db37d4bbda314ff9ff70d03d9243af4b639490be98e2bfa7cb6", + .url = "https://github.com/luau-lang/luau/archive/refs/tags/0.653.tar.gz", + .hash = "1220c76fb74b983b0ebfdd6b3a4aa8adf0c1ff69c9b6a9e9e05f9bc6a6c57a690e23", }, }, } diff --git a/build/luau.zig b/build/luau.zig index 0091404..15ee5c8 100644 --- a/build/luau.zig +++ b/build/luau.zig @@ -8,7 +8,7 @@ pub fn configure(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin. .name = "luau", .target = target, .optimize = optimize, - .version = std.SemanticVersion{ .major = 0, .minor = 607, .patch = 0 }, + .version = std.SemanticVersion{ .major = 0, .minor = 653, .patch = 0 }, }); lib.addIncludePath(upstream.path("Common/include")); @@ -84,10 +84,12 @@ const luau_source_files = [_][]const u8{ "VM/src/ltm.cpp", "VM/src/ludata.cpp", "VM/src/lutf8lib.cpp", + "VM/src/lveclib.cpp", "VM/src/lvmexecute.cpp", "VM/src/lvmload.cpp", "VM/src/lvmutils.cpp", + "Ast/src/Allocator.cpp", "Ast/src/Ast.cpp", "Ast/src/Confusables.cpp", "Ast/src/Lexer.cpp", diff --git a/src/lib.zig b/src/lib.zig index a16a521..188e245 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -5094,16 +5094,40 @@ pub fn wrap(comptime function: anytype) TypeOfWrap(function) { /// Zig wrapper for Luau lua_CompileOptions that uses the same defaults as Luau if /// no compile options is specified. pub const CompileOptions = struct { + /// 0. no optimization + /// 1. baseline optimization level that doesn't prevent debuggability + /// 2. includes optimizations that harm debuggability such as inlining optimization_level: i32 = 1, + + /// 0. no debugging support + /// 1. line info & function names only; sufficient for backtraces + /// 2. full debug info with local & upvalue names; necessary for debugger debug_level: i32 = 1, + + /// type information is used to guide native code generation decisions + /// information includes testable types for function arguments, locals, upvalues and some temporaries + /// + /// 0. generate for native modules + /// 1. generate for all modules + type_info_level: i32 = 0, + + /// 0. no code coverage support + /// 1. statement coverage + /// 2. statement and expression coverage (verbose) coverage_level: i32 = 0, - /// global builtin to construct vectors; disabled by default (.) + + /// alternative global builtin to construct vectors, in addition to default builtin 'vector.create' vector_lib: ?[*:0]const u8 = null, vector_ctor: ?[*:0]const u8 = null, - /// vector type name for type tables; disabled by default + + /// alternative vector type name for type tables, in addition to default type 'vector' vector_type: ?[*:0]const u8 = null, + /// null-terminated array of globals that are mutable; disables the import optimization for fields accessed through these mutable_globals: ?[*:null]const ?[*:0]const u8 = null, + + /// null-terminated array of userdata types that will be included in the type information + userdata_types: ?[*:null]const ?[*:0]const u8 = null, }; /// Compile luau source into bytecode, return callee owned buffer allocated through the given allocator. @@ -5113,10 +5137,12 @@ pub fn compile(allocator: Allocator, source: []const u8, options: CompileOptions var opts = c.lua_CompileOptions{ .optimizationLevel = options.optimization_level, .debugLevel = options.debug_level, + .typeInfoLevel = options.type_info_level, .coverageLevel = options.coverage_level, .vectorLib = options.vector_lib, .vectorCtor = options.vector_ctor, .mutableGlobals = options.mutable_globals, + .userdataTypes = options.userdata_types, }; const bytecode = c.luau_compile(source.ptr, source.len, &opts, &size); if (bytecode == null) return error.OutOfMemory; -- knotmirror 0.0.1