Skip to content

Commit d51511a

Browse files
committed
Add extra metadata for primitive types
1 parent e1d3052 commit d51511a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

contrib/juliac/abi_export.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,9 @@ function emit_primitive_type!(ctx::TypeEmitter, @nospecialize(dt::DataType); ind
116116
indented_println(" \"id\": ", type_id, ",")
117117
indented_println(" \"kind\": \"primitive\",")
118118
indented_println(" \"name\": ", type_name_json(dt), ",")
119-
indented_println(" \"size\": ", Core.sizeof(dt), ",")
119+
indented_println(" \"signed\": ", (dt <: Signed), ",")
120+
indented_println(" \"bits\": ", 8 * Base.packedsize(dt), ",") # size for reinterpret / in-register
121+
indented_println(" \"size\": ", Base.aligned_sizeof(dt), ",") # size with padding / in-memory
120122
indented_println(" \"alignment\": ", Base.datatype_alignment(dt))
121123
print(ctx.io, " " ^ indent, "}")
122124
end

0 commit comments

Comments
 (0)