summaryrefslogtreecommitdiff
path: root/Runtime/Lua/LuaBind/LuaBindVM.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-22 23:59:54 +0800
committerchai <chaifix@163.com>2021-10-22 23:59:54 +0800
commit4dafefe46a72ba47468b13d011f8299055081b0f (patch)
tree2a85835ec4d74fecf3815397b384cefe39d31f56 /Runtime/Lua/LuaBind/LuaBindVM.h
parent1f18d2afec632aa9361079ca3bcb5a7f2d73db3a (diff)
*LuaBind
Diffstat (limited to 'Runtime/Lua/LuaBind/LuaBindVM.h')
-rw-r--r--Runtime/Lua/LuaBind/LuaBindVM.h19
1 files changed, 11 insertions, 8 deletions
diff --git a/Runtime/Lua/LuaBind/LuaBindVM.h b/Runtime/Lua/LuaBind/LuaBindVM.h
index 3bfe899..37810b9 100644
--- a/Runtime/Lua/LuaBind/LuaBindVM.h
+++ b/Runtime/Lua/LuaBind/LuaBindVM.h
@@ -3,6 +3,7 @@
#include <map>
#include <unordered_set>
+#include <unordered_map>
#include "LuaBindRef.h"
#include "LuaBindConfig.h"
@@ -32,20 +33,22 @@ namespace LuaBind
lua_State* CreateThread();
State GetMainState();
- RefTable& GetStrongRefTable();
+ RefTable& GetStrongRefTable();
RefTable& GetWeakRefTable();
- private:
+ int RegisterClassI(State& state, int classID, int index);
+ void PushClassTable(State& state, int classID);
- typedef std::map<global_State*, VM*> VMap;
+ private:
+ static std::map<global_State*, VM*> VMs; // 通过global_State索引虚拟机,为了方便
- static VMap VMs; // 通过global_State索引虚拟机,为了方便
+ global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享,保存注册表、管理GC
+ lua_State* mMainThread; // 主线程
- RefTable mStrongRefTable; // GAMELAB_UNIVERSAL_STRONG_REFERENCE_TABLE
- RefTable mWeakRefTable; // GAMELAB_UNIVERSAL_WEAK_REFERENCE_TABLE
+ RefTable mStrongRefTable; // 全局强引用表
+ RefTable mWeakRefTable; // 全局弱引用表
- global_State* mGlobalState; // 虚拟机的global_State,由当前虚拟机的所有线程共享
- lua_State* mMainThread; // 主线程
+ std::unordered_map<int/*ClassID*/, StrongRef> mClasses; // 类型
#if LUA_BIND_PROFILER
size_t mObjectCount; // 统计所有在此虚拟机中创建的实例