From 206302a736ca99f26713faad460da5acf02370ca Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Sun, 11 Jun 2023 14:12:39 +0800 Subject: [PATCH] Update config.h --- src/config.h | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/src/config.h b/src/config.h index 29f1ca37..4617a93d 100644 --- a/src/config.h +++ b/src/config.h @@ -7,28 +7,35 @@ #else /*************** feature settings ***************/ + +// Whether to compile os-related modules #define PK_ENABLE_OS 1 +// Enable this if you are working with multi-threading (experimental) +// This triggers necessary locks to make the VM thread-safe #define PK_ENABLE_THREAD 0 // Whether to use `std::function` to do bindings -// By default, the function to be binded must be a C function pointer with no capture -// which is fast and simple. However, someone thinks it's not convenient enough. +// By default, functions to be binded must be a C function pointer without capture +// However, someone thinks it's not convenient. // By setting this to 1, capturing lambdas can be binded, // but it's slower and may cause severe "code bloat", also needs more time to compile. #define PK_ENABLE_STD_FUNCTION 0 /*************** internal settings ***************/ -// This is the maximum size of the value stack in void* units, not bytes -// The actual size is `sizeof(void*) * PK_VM_STACK_SIZE` +// This is the maximum size of the value stack in void* units +// The actual size in bytes equals `sizeof(void*) * PK_VM_STACK_SIZE` #define PK_VM_STACK_SIZE 32768 // This is the maximum number of arguments in a function declaration // including positional arguments, keyword-only arguments, and varargs +// (not recommended to change this) #define PK_MAX_CO_VARNAMES 255 // Hash table load factor (smaller ones mean less collision but more memory) +// For class instance inline const float kInstAttrLoadFactor = 0.67f; +// For class itself inline const float kTypeAttrLoadFactor = 0.5f; #ifdef _WIN32 @@ -39,7 +46,7 @@ inline const float kTypeAttrLoadFactor = 0.5f; /*************** debug settings ***************/ -// Enable this may help you to find bugs in the VM +// Enable this may help you find bugs #define DEBUG_EXTRA_CHECK 0 // Do not edit the following settings unless you know what you are doing