summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_vm.cpp
AgeCommit message (Collapse)Author
2021-04-16GDScript: Adjust type of temporaries when neededGeorge Marques
2021-04-08Reduce number of addressing modes in GDScript VMGeorge Marques
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.
2021-04-05GDScript: Properly validate return typeGeorge Marques
When the type cannot be validated at compile time, the runtime must do a check to ensure type safety is kept, as the code might be assuming the return type is correct in another place, leading to crashes if the contract is broken.
2021-03-29Add typed arrays to GDScriptGeorge Marques
- Use `Array[type]` for type-hints. e.g.: `var array: Array[int] = [1, 2, 3]` - Array literals are typed if their storage is typed (variable asssignment of as argument in function all). Otherwise they are untyped.
2021-03-12Fixes small typos and grammar correctionAnshul7sp1
2021-01-11Merge pull request #44005 from RandomShaper/gds_needless_checkRémi Verschelde
Remove useless check in GDScript
2021-01-11Merge pull request #44604 from lyuma/gdscript_dictionary_crashRémi Verschelde
GDScript: Fix crash when iterating through empty dictionary.
2021-01-01Update copyright statements to 2021Rémi Verschelde
Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
2020-12-28Rename empty() to is_empty()Marcel Admiraal
2020-12-21Fix crash when iterating through empty dictionary.Lyuma
2020-12-15Merge pull request #44275 from vnen/variant-function-arg-pointersRémi Verschelde
Use pointer parameters in Variant function pointers
2020-12-15Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde
GDScript: Refactor builtin functions
2020-12-10Use pointer parameters in Variant function pointersGeorge Marques
Instead of references. This is needed because those function pointers are used in GDNative which needs to work with plain C, which doesn't support passing parameters by reference.
2020-12-01Remove useless check in GDScriptPedro J. Estébanez
The removed check was adding a protection for the case where a `Reference` has not yet got its reference count initialized and a script is called on it. That would cause the object to be released after the call. The removed code was constructing the `Variant` via the `Object` constructor so it didn't deal with the reference count and so the release was prevented. However, `Variant` no longer works that way so that check was useless. Now it's just illegal to run GDScript on a Reference whose reference count has not been initialized.
2020-11-30Fix VariantInternal initialization and setting of objectGeorge Marques
- Initialize Object pointer to nullptr so it's not used by mistake. - When setting an Object check if it's a reference so refcounting works as intended.
2020-11-26GDScript: Refactor builtin functionsGeorge Marques
They are now called "utility functions" to avoid confusion with methods of builtin types, and be consistent with the naming in Variant. Core utility functions are now available in GDScript. The ones missing in core are added specifically to GDScript as helpers for convenience. Some functions were remove when there are better ways to do, reducing redundancy and cleaning up the global scope.
2020-11-21GDScript: Add faster instruction for validated constructorGeorge Marques
Only for built-in types.
2020-11-21GDScript: Add typed iterate instructionsGeorge Marques
2020-11-21GDScript: Add faster call instructions for builtin methodsGeorge Marques
Methods from builtin types can be called by using the function pointer when the argument and base types are known at compile time.
2020-11-21GDScript: Add faster call instructions for native methodsGeorge Marques
2020-11-21GDScript: Add speficic set/get instructionsGeorge Marques
When the base type is known at compile-time, we can get a direct function pointer that is faster than the regular set/get paths.
2020-11-21GDScript: Add faster operator for known typesGeorge Marques
It now uses the direct operator function pointer, which increases performance in evaluation.
2020-11-21GDScript: Gather instructions arguments beforehandGeorge Marques
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.
2020-11-21GDScript: Split Function code into multiple filesGeorge Marques
To improve organization and reduce the size of compilation units.