mirror of
https://github.com/godotengine/godot.git
synced 2025-10-19 16:03:29 +00:00
GDScript: Gather instructions arguments beforehand
Almost all instructions need variant arguments. With this change they are loaded in an array before each instruction call. This makes the addressing code be localized to less places, improving compilation overhead and binary size by a small margin. This should not affect performance.
This commit is contained in:
parent
b6519d0d03
commit
c707d6fe71
6 changed files with 360 additions and 380 deletions
|
@ -215,6 +215,12 @@ public:
|
|||
ADDR_TYPE_NIL = 9
|
||||
};
|
||||
|
||||
enum Instruction {
|
||||
INSTR_BITS = 20,
|
||||
INSTR_MASK = ((1 << INSTR_BITS) - 1),
|
||||
INSTR_ARGS_MASK = ~INSTR_MASK,
|
||||
};
|
||||
|
||||
struct StackDebug {
|
||||
int line;
|
||||
int pos;
|
||||
|
@ -229,22 +235,22 @@ private:
|
|||
StringName source;
|
||||
|
||||
mutable Variant nil;
|
||||
mutable Variant *_constants_ptr;
|
||||
int _constant_count;
|
||||
const StringName *_global_names_ptr;
|
||||
int _global_names_count;
|
||||
const int *_default_arg_ptr;
|
||||
int _default_arg_count;
|
||||
const int *_code_ptr;
|
||||
int _code_size;
|
||||
int _argument_count;
|
||||
int _stack_size;
|
||||
int _call_size;
|
||||
int _initial_line;
|
||||
bool _static;
|
||||
MultiplayerAPI::RPCMode rpc_mode;
|
||||
mutable Variant *_constants_ptr = nullptr;
|
||||
int _constant_count = 0;
|
||||
const StringName *_global_names_ptr = nullptr;
|
||||
int _global_names_count = 0;
|
||||
const int *_default_arg_ptr = nullptr;
|
||||
int _default_arg_count = 0;
|
||||
const int *_code_ptr = nullptr;
|
||||
int _code_size = 0;
|
||||
int _argument_count = 0;
|
||||
int _stack_size = 0;
|
||||
int _instruction_args_size = 0;
|
||||
int _initial_line = 0;
|
||||
bool _static = false;
|
||||
MultiplayerAPI::RPCMode rpc_mode = MultiplayerAPI::RPC_MODE_DISABLED;
|
||||
|
||||
GDScript *_script;
|
||||
GDScript *_script = nullptr;
|
||||
|
||||
StringName name;
|
||||
Vector<Variant> constants;
|
||||
|
@ -265,22 +271,22 @@ private:
|
|||
|
||||
friend class GDScriptLanguage;
|
||||
|
||||
SelfList<GDScriptFunction> function_list;
|
||||
SelfList<GDScriptFunction> function_list{ this };
|
||||
#ifdef DEBUG_ENABLED
|
||||
CharString func_cname;
|
||||
const char *_func_cname;
|
||||
const char *_func_cname = nullptr;
|
||||
|
||||
struct Profile {
|
||||
StringName signature;
|
||||
uint64_t call_count;
|
||||
uint64_t self_time;
|
||||
uint64_t total_time;
|
||||
uint64_t frame_call_count;
|
||||
uint64_t frame_self_time;
|
||||
uint64_t frame_total_time;
|
||||
uint64_t last_frame_call_count;
|
||||
uint64_t last_frame_self_time;
|
||||
uint64_t last_frame_total_time;
|
||||
uint64_t call_count = 0;
|
||||
uint64_t self_time = 0;
|
||||
uint64_t total_time = 0;
|
||||
uint64_t frame_call_count = 0;
|
||||
uint64_t frame_self_time = 0;
|
||||
uint64_t frame_total_time = 0;
|
||||
uint64_t last_frame_call_count = 0;
|
||||
uint64_t last_frame_self_time = 0;
|
||||
uint64_t last_frame_total_time = 0;
|
||||
} profile;
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue