Skip to content

Commit 3818843

Browse files
authored
Merge pull request #1 from Frityet/gccjit-rewrite
Rewrite of the GCCJIT backend
2 parents fb62d43 + 56a724e commit 3818843

File tree

12 files changed

+496
-241
lines changed

12 files changed

+496
-241
lines changed

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ compile_commands.json
1414
*.gimple
1515
*.o
1616
*.asm
17+
*.so
1718
ast.lua
19+
20+
21+
*.dot
22+
23+
test

.luarc.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,5 @@
3838
".luarocks",
3939
"build"
4040
],
41-
"workspace.checkThirdParty": false,
41+
"workspace.checkThirdParty": false
4242
}

.vscode/launch.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
// "luaexe": "luajit",
1313
"path": "${workspaceFolder}/?.lua;${workspaceFolder}/?/init.lua;${workspaceFolder}/src/?.lua;${workspaceFolder}/src/?/init.lua;${workspaceFolder}/lua_modules/share/lua/5.1/?.lua;${workspaceFolder}/lua_modules/share/lua/5.1/?/init.lua;",
1414
"cpath": "${workspaceFolder}/?.so;${workspaceFolder}/lua_modules/lib/lua/5.1/?.so;",
15-
"stopOnEntry": true,
15+
"stopOnEntry": false,
1616
"type": "lua",
1717
"console": "internalConsole",
1818
}

fib.dot

Lines changed: 0 additions & 18 deletions
This file was deleted.

main.dot

Lines changed: 0 additions & 11 deletions
This file was deleted.

test renamed to out

48.3 KB
Binary file not shown.

src/backends/gccjit/init.lua

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ end
161161
---@param location gccjit.Location*?
162162
---@return gccjit.RValue*
163163
function Context:new_cast(type, value, location)
164-
return libgccjit.gcc_jit_context_new_cast(self, location, type, value) --[[@as gccjit.RValue*]]
164+
return libgccjit.gcc_jit_context_new_cast(self, location, value, type) --[[@as gccjit.RValue*]]
165165
end
166166

167167
---@param type gccjit.Type*
@@ -334,6 +334,10 @@ function Struct:get_field_count()
334334
end
335335
Struct.__len = Struct.get_field_count
336336

337+
function Struct:as_type()
338+
return libgccjit.gcc_jit_struct_as_type(self)
339+
end
340+
337341
---@param type gccjit.Type*
338342
---@param fields gccjit.Field*[]
339343
---@param values gccjit.RValue*[]
@@ -466,7 +470,7 @@ function Type:unqualified()
466470
return libgccjit.gcc_jit_type_unqualified(self) --[[@as gccjit.Type*]]
467471
end
468472

469-
---@return gccjit.Type*
473+
---@return gccjit.Type*?
470474
function Type:dyncast_array()
471475
return libgccjit.gcc_jit_type_dyncast_array(self) --[[@as gccjit.Type*]]
472476
end
@@ -491,6 +495,10 @@ function Type:is_struct()
491495
return libgccjit.gcc_jit_type_is_struct(self) ~= 0
492496
end
493497

498+
function Type:as_type()
499+
return self
500+
end
501+
494502
function Type:as_object()
495503
return libgccjit.gcc_jit_type_as_object(self)
496504
end
@@ -503,7 +511,7 @@ end
503511
local VectorType = {}
504512
VectorType.__index = VectorType
505513

506-
---@return gccjit.VectorType* : gccjit.Type*
514+
---@return gccjit.VectorType*?
507515
function Type:dyncast_vector()
508516
return libgccjit.gcc_jit_type_dyncast_vector(self) --[[@as gccjit.VectorType*]]
509517
end
@@ -522,7 +530,7 @@ end
522530
local FunctionType = {}
523531
FunctionType.__index = FunctionType
524532

525-
---@return gccjit.FunctionType*
533+
---@return gccjit.FunctionType*?
526534
function Type:dyncast_function_ptr()
527535
return libgccjit.gcc_jit_type_dyncast_function_ptr(self) --[[@as gccjit.FunctionType*]]
528536
end

0 commit comments

Comments
 (0)