diff options
author | George Marques <george@gmarqu.es> | 2021-04-08 11:55:24 -0300 |
---|---|---|
committer | George Marques <george@gmarqu.es> | 2021-04-08 14:29:55 -0300 |
commit | cf4079cb5f51a40c8370a84f5131f944c398f4b8 (patch) | |
tree | f24fa383603a01b525d4528698c60dc2606062cb /modules/gdscript/gdscript_codegen.h | |
parent | 084b882c0a1957ca15bbb6ddadce050e81315f58 (diff) | |
download | redot-engine-cf4079cb5f51a40c8370a84f5131f944c398f4b8.tar.gz |
Reduce number of addressing modes in GDScript VM
There's now only 3 addressing modes: stack, constant, and member.
Self, class, and nil are now present respectively in the first 3 stack
slots. Global and class constants are moved to local constants when
compiling. Named globals is only present on editor to use on tool
singletons, so its use now emits a new instruction to copy the global to
the stack.
This allow us to further optimize the VM later by embedding the
addressing modes in the instructions themselves, which is better done
with less permutations.
Diffstat (limited to 'modules/gdscript/gdscript_codegen.h')
-rw-r--r-- | modules/gdscript/gdscript_codegen.h | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/modules/gdscript/gdscript_codegen.h b/modules/gdscript/gdscript_codegen.h index 3c05f14cf7..cce4e856c7 100644 --- a/modules/gdscript/gdscript_codegen.h +++ b/modules/gdscript/gdscript_codegen.h @@ -45,13 +45,9 @@ public: CLASS, MEMBER, CONSTANT, - CLASS_CONSTANT, - LOCAL_CONSTANT, LOCAL_VARIABLE, FUNCTION_PARAMETER, TEMPORARY, - GLOBAL, - NAMED_GLOBAL, NIL, }; AddressMode mode = NIL; @@ -123,6 +119,7 @@ public: virtual void write_assign_true(const Address &p_target) = 0; virtual void write_assign_false(const Address &p_target) = 0; virtual void write_assign_default_parameter(const Address &dst, const Address &src) = 0; + virtual void write_store_named_global(const Address &p_dst, const StringName &p_global) = 0; virtual void write_cast(const Address &p_target, const Address &p_source, const GDScriptDataType &p_type) = 0; virtual void write_call(const Address &p_target, const Address &p_base, const StringName &p_function_name, const Vector<Address> &p_arguments) = 0; virtual void write_super_call(const Address &p_target, const StringName &p_function_name, const Vector<Address> &p_arguments) = 0; |