aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile2
-rw-r--r--src/javascript/jsc/bindings/header-gen.zig22
-rw-r--r--src/javascript/jsc/bindings/headers-cpp.h8
-rw-r--r--src/javascript/jsc/bindings/headers.h2
-rw-r--r--src/javascript/jsc/bindings/sizes.zig2
5 files changed, 21 insertions, 15 deletions
diff --git a/Makefile b/Makefile
index a1d5b42b8..1107e9836 100644
--- a/Makefile
+++ b/Makefile
@@ -128,7 +128,7 @@ $(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
-O1
sizegen:
- clang++ src/javascript/jsc/headergen/sizegen.cpp -o /tmp/sizegen $(CLANG_FLAGS)
+ clang++ src/javascript/jsc/headergen/sizegen.cpp -o /tmp/sizegen $(CLANG_FLAGS) -O1
/tmp/sizegen > src/javascript/jsc/bindings/sizes.zig
picohttp:
diff --git a/src/javascript/jsc/bindings/header-gen.zig b/src/javascript/jsc/bindings/header-gen.zig
index 8b9bb504e..449c73dfa 100644
--- a/src/javascript/jsc/bindings/header-gen.zig
+++ b/src/javascript/jsc/bindings/header-gen.zig
@@ -650,6 +650,8 @@ pub fn HeaderGen(comptime import: type, comptime fname: []const u8) type {
// }
var to_get_sizes: usize = 0;
+
+ const exclude_from_cpp = comptime [_][]const u8{ "ZigString", "ZigException" };
inline for (all_decls) |_decls| {
if (comptime _decls.is_pub) {
switch (_decls.data) {
@@ -676,10 +678,12 @@ pub fn HeaderGen(comptime import: type, comptime fname: []const u8) type {
defer gen.deinit();
if (@hasDecl(Type, "Extern")) {
- if (to_get_sizes > 0) {
- impl_second_writer.writeAll(", ") catch unreachable;
- impl_third_writer.writeAll(", ") catch unreachable;
- impl_fourth_writer.writeAll(", ") catch unreachable;
+ if (comptime !(std.mem.eql(u8, Type.name, exclude_from_cpp[0]) or std.mem.eql(u8, Type.name, exclude_from_cpp[1]))) {
+ if (to_get_sizes > 0) {
+ impl_second_writer.writeAll(", ") catch unreachable;
+ impl_third_writer.writeAll(", ") catch unreachable;
+ impl_fourth_writer.writeAll(", ") catch unreachable;
+ }
}
const formatted_name = comptime brk: {
@@ -688,10 +692,12 @@ pub fn HeaderGen(comptime import: type, comptime fname: []const u8) type {
break :brk original;
};
- impl_third_writer.print("sizeof({s})", .{comptime Type.name}) catch unreachable;
- impl_fourth_writer.print("alignof({s})", .{comptime Type.name}) catch unreachable;
- impl_second_writer.print("\"{s}\"", .{formatted_name}) catch unreachable;
- to_get_sizes += 1;
+ if (comptime !(std.mem.eql(u8, Type.name, exclude_from_cpp[0]) or std.mem.eql(u8, Type.name, exclude_from_cpp[1]))) {
+ impl_third_writer.print("sizeof({s})", .{comptime Type.name}) catch unreachable;
+ impl_fourth_writer.print("alignof({s})", .{comptime Type.name}) catch unreachable;
+ impl_second_writer.print("\"{s}\"", .{formatted_name}) catch unreachable;
+ to_get_sizes += 1;
+ }
const ExternList = comptime brk: {
const Sorder = struct {
pub fn lessThan(context: @This(), lhs: []const u8, rhs: []const u8) bool {
diff --git a/src/javascript/jsc/bindings/headers-cpp.h b/src/javascript/jsc/bindings/headers-cpp.h
index 0013a2306..de511243a 100644
--- a/src/javascript/jsc/bindings/headers-cpp.h
+++ b/src/javascript/jsc/bindings/headers-cpp.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1630806668
+//-- AUTOGENERATED FILE -- 1630884061
// clang-format off
#pragma once
@@ -224,8 +224,8 @@ extern "C" const size_t Zig__GlobalObject_object_align_ = alignof(Zig::GlobalObj
extern "C" const size_t Zig__ConsoleClient_object_size_ = sizeof(Zig::ConsoleClient);
extern "C" const size_t Zig__ConsoleClient_object_align_ = alignof(Zig::ConsoleClient);
-const size_t sizes[28] = {sizeof(JSC::JSObject), sizeof(ZigString), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(Inspector::ScriptArguments), sizeof(JSC::JSModuleLoader), sizeof(JSC::JSModuleRecord), sizeof(JSC::JSPromise), sizeof(JSC::JSInternalPromise), sizeof(JSC::SourceOrigin), sizeof(JSC::SourceCode), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(WTF::URL), sizeof(WTF::String), sizeof(JSC::JSValue), sizeof(JSC::PropertyName), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::CatchScope), sizeof(JSC::CallFrame), sizeof(JSC::Identifier), sizeof(WTF::StringImpl), sizeof(WTF::ExternalStringImpl), sizeof(WTF::StringView), sizeof(Zig::GlobalObject), sizeof(ZigException)};
+const size_t sizes[26] = {sizeof(JSC::JSObject), sizeof(JSC::JSCell), sizeof(JSC::JSString), sizeof(Inspector::ScriptArguments), sizeof(JSC::JSModuleLoader), sizeof(JSC::JSModuleRecord), sizeof(JSC::JSPromise), sizeof(JSC::JSInternalPromise), sizeof(JSC::SourceOrigin), sizeof(JSC::SourceCode), sizeof(JSC::JSFunction), sizeof(JSC::JSGlobalObject), sizeof(WTF::URL), sizeof(WTF::String), sizeof(JSC::JSValue), sizeof(JSC::PropertyName), sizeof(JSC::Exception), sizeof(JSC::VM), sizeof(JSC::ThrowScope), sizeof(JSC::CatchScope), sizeof(JSC::CallFrame), sizeof(JSC::Identifier), sizeof(WTF::StringImpl), sizeof(WTF::ExternalStringImpl), sizeof(WTF::StringView), sizeof(Zig::GlobalObject)};
-const char* names[28] = {"JSC__JSObject", "ZigString", "JSC__JSCell", "JSC__JSString", "Inspector__ScriptArguments", "JSC__JSModuleLoader", "JSC__JSModuleRecord", "JSC__JSPromise", "JSC__JSInternalPromise", "JSC__SourceOrigin", "JSC__SourceCode", "JSC__JSFunction", "JSC__JSGlobalObject", "WTF__URL", "WTF__String", "JSC__JSValue", "JSC__PropertyName", "JSC__Exception", "JSC__VM", "JSC__ThrowScope", "JSC__CatchScope", "JSC__CallFrame", "JSC__Identifier", "WTF__StringImpl", "WTF__ExternalStringImpl", "WTF__StringView", "Zig__GlobalObject", "ZigException"};
+const char* names[26] = {"JSC__JSObject", "JSC__JSCell", "JSC__JSString", "Inspector__ScriptArguments", "JSC__JSModuleLoader", "JSC__JSModuleRecord", "JSC__JSPromise", "JSC__JSInternalPromise", "JSC__SourceOrigin", "JSC__SourceCode", "JSC__JSFunction", "JSC__JSGlobalObject", "WTF__URL", "WTF__String", "JSC__JSValue", "JSC__PropertyName", "JSC__Exception", "JSC__VM", "JSC__ThrowScope", "JSC__CatchScope", "JSC__CallFrame", "JSC__Identifier", "WTF__StringImpl", "WTF__ExternalStringImpl", "WTF__StringView", "Zig__GlobalObject"};
-const size_t aligns[28] = {alignof(JSC::JSObject), alignof(ZigString), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(Inspector::ScriptArguments), alignof(JSC::JSModuleLoader), alignof(JSC::JSModuleRecord), alignof(JSC::JSPromise), alignof(JSC::JSInternalPromise), alignof(JSC::SourceOrigin), alignof(JSC::SourceCode), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(WTF::URL), alignof(WTF::String), alignof(JSC::JSValue), alignof(JSC::PropertyName), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::CatchScope), alignof(JSC::CallFrame), alignof(JSC::Identifier), alignof(WTF::StringImpl), alignof(WTF::ExternalStringImpl), alignof(WTF::StringView), alignof(Zig::GlobalObject), alignof(ZigException)};
+const size_t aligns[26] = {alignof(JSC::JSObject), alignof(JSC::JSCell), alignof(JSC::JSString), alignof(Inspector::ScriptArguments), alignof(JSC::JSModuleLoader), alignof(JSC::JSModuleRecord), alignof(JSC::JSPromise), alignof(JSC::JSInternalPromise), alignof(JSC::SourceOrigin), alignof(JSC::SourceCode), alignof(JSC::JSFunction), alignof(JSC::JSGlobalObject), alignof(WTF::URL), alignof(WTF::String), alignof(JSC::JSValue), alignof(JSC::PropertyName), alignof(JSC::Exception), alignof(JSC::VM), alignof(JSC::ThrowScope), alignof(JSC::CatchScope), alignof(JSC::CallFrame), alignof(JSC::Identifier), alignof(WTF::StringImpl), alignof(WTF::ExternalStringImpl), alignof(WTF::StringView), alignof(Zig::GlobalObject)};
diff --git a/src/javascript/jsc/bindings/headers.h b/src/javascript/jsc/bindings/headers.h
index c135d7ed4..1f38360d7 100644
--- a/src/javascript/jsc/bindings/headers.h
+++ b/src/javascript/jsc/bindings/headers.h
@@ -1,4 +1,4 @@
-//-- AUTOGENERATED FILE -- 1630806668
+//-- AUTOGENERATED FILE -- 1630884061
// clang-format: off
#pragma once
diff --git a/src/javascript/jsc/bindings/sizes.zig b/src/javascript/jsc/bindings/sizes.zig
index ef4cddb6f..3eb86f2fb 100644
--- a/src/javascript/jsc/bindings/sizes.zig
+++ b/src/javascript/jsc/bindings/sizes.zig
@@ -1,4 +1,4 @@
-// Auto-generated by src/javascript/jsc/headergen/sizegen.cpp at 2021-08-03 17:20:1628036419.
+// Auto-generated by src/javascript/jsc/headergen/sizegen.cpp at 2021-09-05 16:21:1630884091.
// These are the byte sizes for the different object types with bindings in JavaScriptCore.
// This allows us to safely return stack allocated C++ types to Zig.
// It is only safe to do this when these sizes are correct.