summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_vm.cpp
AgeCommit message (Collapse)Author
2023-01-05One Copyright Update to rule them allRémi Verschelde
As many open source projects have started doing it, we're removing the current year from the copyright notice, so that we don't need to bump it every year. It seems like only the first year of publication is technically relevant for copyright notices, and even that seems to be something that many companies stopped listing altogether (in a version controlled codebase, the commits are a much better source of date of publication than a hardcoded copyright statement). We also now list Godot Engine contributors first as we're collectively the current maintainers of the project, and we clarify that the "exclusive" copyright of the co-founders covers the timespan before opensourcing (their further contributions are included as part of Godot Engine contributors). Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05Merge pull request #70838 from reduz/gdscript-vm-optimizationRémi Verschelde
Optimizations for GDScript VM
2023-01-02Optimizations for GDScript VMJuan Linietsky
* Removed instruction argument count and instruction prefetching. This is now done on the fly. Reduces jumps. * OPCODE_DISPATCH now goes directly to the next instruction, like in Godot 3.x. I have nothing I can use to test performance, so if anyone wants to lend a hand and compare with master (both on debug and release), it would be very welcome.
2022-12-30GDScript: Error when assigning return value of void functionGeorge Marques
This also makes built-in method calls empty the return value when the method is void, to avoid keeping returning a garbage value in such case.
2022-12-01GDScript: Fix subclass script path issuesrune-scape
2022-10-07Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg
change warnings=all to use /W4.
2022-09-06Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOTMicky
For consistency. Every other exposed `one_shot` is spaced out like this.
2022-07-29Remove Signal connect bindsJuan Linietsky
Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind(). Changed all uses of it to Callable.bind()
2022-07-28Merge pull request #63560 from V-Sekai/named_global_crashfixRémi Verschelde
2022-07-27Prevent hard crash in GDScriptVM when a named global can not be found.SaracenOne
2022-07-23Implement Vector4, Vector4i, Projectionreduz
Implement built-in classes Vector4, Vector4i and Projection. * Two versions of Vector4 (float and integer). * A Projection class, which is a 4x4 matrix specialized in projection types. These types have been requested for a long time, but given they were very corner case they were not added before. Because in Godot 4, reimplementing parts of the rendering engine is now possible, access to these types (heavily used by the rendering code) becomes a necessity. **Q**: Why Projection and not Matrix4? **A**: Godot does not use Matrix2, Matrix3, Matrix4x3, etc. naming convention because, within the engine, these types always have a *purpose*. As such, Godot names them: Transform2D, Transform3D or Basis. In this case, this 4x4 matrix is _always_ used as a _Projection_, hence the naming.
2022-07-10Remove outdated code pathkobewi
2022-06-28Merge pull request #53135 from briansemrau/fix-ref-leakRémi Verschelde
2022-06-28Merge pull request #62468 from V-Sekai/core-const-expressionsRémi Verschelde
Add a const call mode to Object, Variant and Script.
2022-06-27Add a const call mode to Object, Variant and Script.K. S. Ernest (iFire) Lee
For this to work safely (user not call queue_free or something in the expression), a const call mode was added to Object and Variant (and optionally Script). This mode ensures only const functions can be called, making it safe to use from the editor. Co-Authored-By: reduz <reduzio@gmail.com>
2022-06-27GDScript: Fix setter being called in chains for shared typesGeorge Marques
When a type is shared (i.e. passed by reference) it doesn't need to be called in a setter chain (e.g. `a.b.c = 0`) since it will be updated in place. This commit adds an instruction that jumps when the value is shared so it can be used to skip those cases and avoid redundant calls of setters. It also solves issues when assigning to sub-properties of read-only properties.
2022-06-22Do not reset return value in release buildBlack Cat
2022-05-27GDScript: Fix stack overflow when using multiple `await`George Marques
2022-05-16Merge pull request #61003 from vnen/gdscript-await-stack-fixRémi Verschelde
2022-05-16Replace most uses of Map by HashMapreduz
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
2022-05-13GDScript: Fix stack manipulation for `await`George Marques
The stack now contains three special addresses that should no be copied to the state, since it contains references that creates cycles. They can be recreated when the function is resumed. This commit also removes the clearing of stack from the GDScriptFunctionState destructor, since it should be cleared when the function exits. The state stack should only be cleared manually if the instance is freed before the state resumes (which is already being done). Otherwise this would destruct the stack twice, causing crashes.
2022-04-24GDScript: Allow using self in lambdasGeorge Marques
2022-04-07GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffixAaron Franke
2022-04-06GDScript: Add support for static method calls in native typesGeorge Marques
2022-03-09Remove VARIANT_ARG* macrosreduz
* Very old macros from the time Godot was created. * Limited arguments to 5 (then later changed to 8) in many places. * They were replaced by C++11 Variadic Templates. * Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard. * Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-02-17Return a correctly typed variant in case of a function error to prevent hard ↵SaracenOne
crashes
2022-01-20Rename Variant::is_ref() to is_ref_counted()Pedro J. Estébanez
2022-01-10Merge pull request #56409 from ↵Rémi Verschelde
cdemirer/fix-unexpected-copying-when-parameter-is-typed
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2022-01-02Fix unexpected Packed Array copying when parameter is typedcdemirer
2021-12-09Replace String comparisons with "", String() to is_empty()Nathan Franke
Also: - Adds two stress tests to test_string.h - Changes to .empty() on std::strings
2021-11-09Remove hash symbol in front of opcode error messages in GDScriptHugo Locurcio
The hash symbol creates spurious issue references on GitHub if the message is posted outside a code block, which means some issues have a lot more references than originally intended.
2021-10-28clang-format: Disable alignment of operands, too unreliableRémi Verschelde
Sets `AlignOperands` to `DontAlign`. `clang-format` developers seem to mostly care about space-based indentation and every other version of clang-format breaks the bad mismatch of tabs and spaces that it seems to use for operand alignment. So it's better without, so that it respects our two-tabs `ContinuationIndentWidth`.
2021-10-19Merge pull request #52940 from groud/toast_notificationRémi Verschelde
2021-10-14GDScript: Properly return value with await on non-coroutineGeorge Marques
If the keyword `await` is used without a coroutine, it should still return the value synchronally.
2021-10-14Implement toast notifications in the editorGilles Roudière
2021-10-07GDScript: Fix method ptrcall on releaseGeorge Marques
2021-09-30Use range iterators for `Map`Lightning_A
2021-09-28GDScript Don't double-reference Refs returned from native functionBrian Semrau
2021-09-27Fix check for freed object during castPedro J. Estébanez
2021-09-27Fix inverted error messages about null objectPedro J. Estébanez
2021-09-24Remove binds from Signal.connectkobewi
2021-09-14Merge pull request #51094 from RandomShaper/error_cast_freed_objectRémi Verschelde
Complain if casting a freed object in a debug session
2021-09-14Complain if casting a freed object in a debug sessionPedro J. Estébanez
The idea is to give the user a chance to realize a mistake that will cause a crash in a release build (or with no debugger attached).
2021-09-01GDScript: Fix loading of interdependent autoloadsGeorge Marques
Move the autoload resolution to runtime by loading it into the stack with an extra instruction. This allows an autoload to use another autoload singleton independent of load order.
2021-08-19Fix initialization of objects in VariantInternalGeorge Marques
2021-06-13Fix "super" call when having at least one argumentJulien Nguyen
2021-06-04Rename Quat to QuaternionMarcel Admiraal
2021-06-03Rename Variant TRANSFORM to TRANSFORM3DAaron Franke
Also _transform to _transform3d
2021-06-03Rename Transform to Transform3D in coreAaron Franke