Skip to content

Commit

Permalink
Adaptation of inline function support of Pallene Tracer
Browse files Browse the repository at this point in the history
  • Loading branch information
singul4ri7y committed Aug 5, 2024
1 parent ec66bf2 commit ff1cdb0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 19 deletions.
15 changes: 5 additions & 10 deletions src/pallene/c_compiler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,16 @@ function c_compiler.compile_c_to_o(in_filename, out_filename)
})
end

function c_compiler.compile_o_to_so(in_filename, out_filename, _, _, flags)
function c_compiler.compile_o_to_so(in_filename, out_filename)
-- There is no need to add the '-x' flag when compiling an object file without a '.o' extension.
-- According to GCC, any file name with no recognized suffix is treated as an object file.
local command = {
return run_cc({
CFLAGS_SHARED,
"-o", util.shell_quote(out_filename),
util.shell_quote(in_filename),
}

if flags.pt_dynamic or not flags.use_traceback then
table.insert(command, "-lptracer")
table.insert(command, "-Wl,-rpath="..PTLIBDIR)
end

return run_cc(command)
"-lptracer",
"-Wl,-rpath="..PTLIBDIR,
})
end

return c_compiler
6 changes: 0 additions & 6 deletions src/pallene/coder.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1778,12 +1778,6 @@ function Coder:generate_module_header()
if self.flags.use_traceback then
table.insert(out, "/* Enable Pallene Tracer debugging. */")
table.insert(out, "#define PT_DEBUG")

if not self.flags.pt_dynamic then
table.insert(out, "/* Inlining for maximum performance during debugging. */")
table.insert(out, "#define PT_INLINE")
table.insert(out, "#define PT_IMPLEMENTATION")
end
end
table.insert(out, "")

Expand Down
4 changes: 1 addition & 3 deletions src/pallene/pallenec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ do

-- No Pallene tracebacks
p:flag("--use-traceback", "Use function traceback for debugging using Pallene Tracer")
p:flag("--pt-dynamic", "Use dynamic linking to Pallene Tracer. Reduced code redundancy, compromised performance")

p:option("-O", "Optimization level")
:args(1):convert(tonumber)
Expand Down Expand Up @@ -74,8 +73,7 @@ end

function pallenec.main()
local flags = {
use_traceback = opts.use_traceback and true or false,
pt_dynamic = opts.pt_dynamic and true or false
use_traceback = opts.use_traceback and true or false
}

if opts.emit_c then compile("pln", "c", flags)
Expand Down

0 comments on commit ff1cdb0

Please sign in to comment.