summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_vm.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GDScript: Implement lambdas compilation and runtimeGeorge Marques2021-04-281-2/+36
|
* GDScript: Adjust type of temporaries when neededGeorge Marques2021-04-161-0/+78
|
* Reduce number of addressing modes in GDScript VMGeorge Marques2021-04-081-114/+59
| | | | | | | | | | | | | | 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.
* GDScript: Properly validate return typeGeorge Marques2021-04-051-4/+188
| | | | | | | 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.
* Add typed arrays to GDScriptGeorge Marques2021-03-291-4/+84
| | | | | | | | - 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.
* Fixes small typos and grammar correctionAnshul7sp12021-03-121-1/+1
|
* Merge pull request #44005 from RandomShaper/gds_needless_checkRémi Verschelde2021-01-111-5/+1
|\ | | | | Remove useless check in GDScript
| * Remove useless check in GDScriptPedro J. Estébanez2020-12-011-5/+1
| | | | | | | | | | | | 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.
* | Merge pull request #44604 from lyuma/gdscript_dictionary_crashRémi Verschelde2021-01-111-1/+1
|\ \ | | | | | | GDScript: Fix crash when iterating through empty dictionary.
| * | Fix crash when iterating through empty dictionary.Lyuma2020-12-211-1/+1
| | |
* | | Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 🎆
* | | Rename empty() to is_empty()Marcel Admiraal2020-12-281-5/+5
|/ /
* | Merge pull request #44275 from vnen/variant-function-arg-pointersRémi Verschelde2020-12-151-6/+6
|\ \ | | | | | | Use pointer parameters in Variant function pointers
| * | Use pointer parameters in Variant function pointersGeorge Marques2020-12-101-6/+6
| |/ | | | | | | | | | | 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.
* | Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde2020-12-151-9/+68
|\ \ | |/ |/| GDScript: Refactor builtin functions
| * GDScript: Refactor builtin functionsGeorge Marques2020-11-261-9/+68
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Fix VariantInternal initialization and setting of objectGeorge Marques2020-11-301-1/+1
|/ | | | | | - 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.
* GDScript: Add faster instruction for validated constructorGeorge Marques2020-11-211-0/+22
| | | | Only for built-in types.
* GDScript: Add typed iterate instructionsGeorge Marques2020-11-211-87/+763
|
* GDScript: Add faster call instructions for builtin methodsGeorge Marques2020-11-211-0/+35
| | | | | Methods from builtin types can be called by using the function pointer when the argument and base types are known at compile time.
* GDScript: Add faster call instructions for native methodsGeorge Marques2020-11-211-49/+406
|
* GDScript: Add speficic set/get instructionsGeorge Marques2020-11-211-5/+171
| | | | | 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.
* GDScript: Add faster operator for known typesGeorge Marques2020-11-211-0/+18
| | | | | It now uses the direct operator function pointer, which increases performance in evaluation.
* GDScript: Gather instructions arguments beforehandGeorge Marques2020-11-211-150/+143
| | | | | | | | | 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.
* GDScript: Split Function code into multiple filesGeorge Marques2020-11-211-0/+1596
To improve organization and reduce the size of compilation units.