[gjs: 3/6] function: Use minimal allocation for trampoline data




commit 41a6fa9c8d2c7bc077ae9e43bbb369ea675b2983
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date:   Sat May 15 14:45:44 2021 +0200

    function: Use minimal allocation for trampoline data

 gi/function.cpp | 2 +-
 gi/function.h   | 7 +++----
 2 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/gi/function.cpp b/gi/function.cpp
index 12b614f4..c4591144 100644
--- a/gi/function.cpp
+++ b/gi/function.cpp
@@ -627,8 +627,8 @@ GjsCallbackTrampoline::GjsCallbackTrampoline(
               scope != GI_SCOPE_TYPE_NOTIFIED || !has_scope_object,
               g_base_info_get_name(callable_info)),
       m_info(callable_info, GjsAutoTakeOwnership()),
-      m_scope(scope),
       m_param_types(g_callable_info_get_n_args(callable_info), {}),
+      m_scope(scope),
       m_is_vfunc(is_vfunc) {
     add_finalize_notifier<GjsCallbackTrampoline>();
 }
diff --git a/gi/function.h b/gi/function.h
index 2aae8230..61868238 100644
--- a/gi/function.h
+++ b/gi/function.h
@@ -64,13 +64,12 @@ struct GjsCallbackTrampoline : public Gjs::Closure {
     void warn_about_illegal_js_callback(const char* when, const char* reason);
 
     GjsAutoCallableInfo m_info;
-    GIScopeType m_scope;
-
     ffi_closure* m_closure = nullptr;
     std::vector<GjsParamType> m_param_types;
-
-    bool m_is_vfunc;
     ffi_cif m_cif;
+
+    GIScopeType m_scope : 2;
+    bool m_is_vfunc : 1;
 };
 
 // Stack allocation only!


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]