Skip to content

Commit

Permalink
updated to luau 0.653
Browse files Browse the repository at this point in the history
  • Loading branch information
noxabellus authored and natecraddock committed Dec 3, 2024
1 parent 267a627 commit f1fe9c8
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 5 deletions.
4 changes: 2 additions & 2 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -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",
},
},
}
4 changes: 3 additions & 1 deletion build/luau.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down Expand Up @@ -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",
Expand Down
30 changes: 28 additions & 2 deletions src/lib.zig
Original file line number Diff line number Diff line change
Expand Up @@ -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 (<vector_lib>.<vector_ctor>)

/// 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.
Expand All @@ -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;
Expand Down

0 comments on commit f1fe9c8

Please sign in to comment.