-
Notifications
You must be signed in to change notification settings - Fork 57
Open
Description
The code below freezes with Ziglua's LuaJIT. The C++ translation of my example works correctly. I reckon this may be a problem with how LuaJIT is compiled by Ziglua? The culprit seems to be a JIT-compiled version of the JLOOP opcode.
main.lua:
-- Interestingly enough, this is the minimal number of X's that causes the hang-up.
local xs = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
for i = 1, #xs do end
main.zig:
pub fn main() !void {
var gpa = @import("std").heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var vm = try @import("ziglua").Lua.init(&gpa.allocator());
defer vm.deinit();
vm.openLibs();
try vm.doFile("main.lua");
}
build.zig:
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "ziglua-bug",
.root_source_file = b.path("main.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("ziglua", b.dependency("ziglua", .{
.lang = .luajit,
.target = target,
.optimize = optimize,
}).module("ziglua"));
b.installArtifact(exe);
}
build.zig.zon:
.{
.name = "ziglua-bug",
.version = "0.0.0",
.dependencies = .{
.ziglua = .{
.url = "https://github.com/natecraddock/ziglua/archive/7479680.tar.gz",
.hash = "122094a86e7171946ec9dc47ea22c4782511c26ae555a7e79e315ae857ccce15cfa5",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"main.zig",
},
}
Metadata
Metadata
Assignees
Labels
No labels