summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_vm.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #79990 from vnen/gdscript-assume-op-typesYuri Sizov2023-08-011-15/+59
|\ | | | | | | GDScript: Optimize operators by assuming the types
| * GDScript: Optimize operators by assuming the typesGeorge Marques2023-07-281-15/+59
| | | | | | | | | | | | | | | | | | | | | | This assumes that operators are called usually with the same type of operands as the first time. So it stores the types of the first run and if matched it uses an optimized path by calling the validated operator function directly. Otherwise it uses the regular untyped evaluator. With this change, if operators do use the same type they run quite faster. OTOH, if the types mismatch it takes longer to run than they would with the previous code.
* | Support threads in the script debuggerJuan Linietsky2023-07-261-9/+11
|/ | | | | | | | | | * This implementation adds threads on the side of the client (script debugger). * Some functions of the debugger are optimized. * The profile is also now thread safe using atomics. * The editor can switch between multiple threads when debugging. This PR adds threaded support for the script language debugger. Every thread has its own thread local data and it will connect to the debugger using multiple thread IDs. This means that, now, the editor can receive multiple threads entering debug mode at the same time.
* GDScript: Fix `_get_script_name()` function collision for SCU buildDanil Alexeev2023-06-201-16/+5
|
* GDScript: Fix some bugs with static variables and functionsDanil Alexeev2023-06-161-5/+43
|
* Style: Harmonize header includes in modulesRémi Verschelde2023-06-151-2/+2
| | | | | | | | | | | | | | | | | | | | This applies our existing style guide, and adds a new rule to that style guide for modular components such as platform ports and modules: Includes from the platform port or module ("local" includes) should be listed first in their own block using relative paths, before Godot's "core" includes which use "absolute" (project folder relative) paths, and finally thirdparty includes. Includes in `#ifdef`s come after their relevant section, i.e. the overall structure is: - Local includes * Conditional local includes - Core includes * Conditional core includes - Thirdparty includes * Conditional thirdparty includes
* Merge pull request #75732 from vonagam/fix-duplicate-conditionRémi Verschelde2023-04-281-3/+3
|\ | | | | | | GDScript: Fix unnecessary duplication of pointed out lines
| * GDScript: Fix unnecessary duplication of pointed out linesDmitrii Maganov2023-04-061-3/+3
| |
* | Add support for static variables in GDScriptGeorge Marques2023-04-271-2/+2
| | | | | | | | | | | | | | | | | | | | Which allows editable data associated with a particular class instead of the instance. Scripts with static variables are kept in memory indefinitely unless the `@static_unload` annotation is used or the `static_unload()` method is called on the GDScript. If the custom function `_static_init()` exists it will be called when the class is loaded, after the static variables are set.
* | GDScript: Don't fail when freed object is returnGeorge Marques2023-04-261-4/+0
| | | | | | | | | | This is check is a bit too eager. The user should be able to handle the return value even if it's a freed object.
* | Fix wrong file on function call errorsodaJar2023-04-241-3/+4
|/
* Added check for null objects in gdscript typed assign.ocean (they/them)2023-02-211-18/+20
|
* Merge pull request #73489 from vonagam/type-check-nodeRémi Verschelde2023-02-201-64/+70
|\ | | | | | | GDScript: Rework type check
| * GDScript: Rework type checkDmitrii Maganov2023-02-171-64/+70
| |
* | Merge pull request #73501 from anvilfolk/oopsiedaisyYuri Sizov2023-02-181-19/+13
|\ \ | |/ |/| Fix inability to assign null regression
| * Fix inability to assign null regressionocean (they/them)2023-02-171-19/+13
| | | | | | | | Co-authored-by: Dmitry Maganov <vonagam@gmail.com>
* | Merge pull request #72867 from vnen/gdscript-limit-call-depthYuri Sizov2023-02-171-0/+32
|\ \ | |/ |/| GDScript: Add limit to call depth
| * GDScript: Add limit to call depthGeorge Marques2023-02-071-0/+32
| | | | | | | | | | | | | | | | | | | | | | The hard limit is set at 2048 depth which seems sensible between legitimate recursive calls while still avoiding a crash because of a stack overflow in most of the cases. Note that it is still possible to reach the stack limit and get an overflow before reaching a call depth. This is intended as a half-way measure to stop crashing in most cases, since there's no reliable nor portable way to check the amount of stack memory left.
* | Fix crash by freed object assign to typed variableocean (they/them)2023-02-161-6/+27
| |
* | Improve GDScript error for method call on null/previously freed instancepkowal2023-02-121-8/+11
| | | | | | | | Fixes #53878.
* | Merge pull request #72654 from RandomShaper/ptrcall_ret_raw_objRémi Verschelde2023-02-111-1/+7
|\ \ | | | | | | | | | Avoid losing references to objects in the native-scripting boundary
| * | Avoid losing references to objects in the native-scripting boundaryPedro J. Estébanez2023-02-031-1/+7
| |/
* / Fix null message in assert()kobewi2023-02-081-1/+4
|/
* GDScript: Improve usability of setter chainsGeorge Marques2023-02-021-6/+23
| | | | | | | | | - Consider PackedArrays non-shared since they are copied on C++/script boundaries. - Add error messages in the analyzer when assigning to read-only properties. - Add specific error message at runtime when assignment fails because the property is read-only.
* GDScript: Fix issues with typed arraysDmitrii Maganov2023-01-311-41/+46
|
* One Copyright Update to rule them allRémi Verschelde2023-01-051-29/+29
| | | | | | | | | | | | | | | | | | | | 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".
* Merge pull request #70838 from reduz/gdscript-vm-optimizationRémi Verschelde2023-01-051-209/+232
|\ | | | | | | Optimizations for GDScript VM
| * Optimizations for GDScript VMJuan Linietsky2023-01-021-209/+232
| | | | | | | | | | | | | | * 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.
* | GDScript: Error when assigning return value of void functionGeorge Marques2022-12-301-0/+20
|/ | | | | 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.
* GDScript: Fix subclass script path issuesrune-scape2022-12-011-1/+1
|
* Fix MSVC warnings, rename shadowed variables, fix uninitialized values, ↵bruvzg2022-10-071-1/+1
| | | | change warnings=all to use /W4.
* Rename CONNECT_ONESHOT TO CONNECT_ONE_SHOTMicky2022-09-061-2/+2
| | | | For consistency. Every other exposed `one_shot` is spaced out like this.
* Remove Signal connect bindsJuan Linietsky2022-07-291-1/+1
| | | | | Remove the optional argument p_binds from `Object::connect` since it was deprecated by Callable.bind(). Changed all uses of it to Callable.bind()
* Merge pull request #63560 from V-Sekai/named_global_crashfixRémi Verschelde2022-07-281-0/+1
|\
| * Prevent hard crash in GDScriptVM when a named global can not be found.SaracenOne2022-07-271-0/+1
| |
* | Implement Vector4, Vector4i, Projectionreduz2022-07-231-0/+18
|/ | | | | | | | | | | | | 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.
* Remove outdated code pathkobewi2022-07-101-5/+1
|
* Merge pull request #53135 from briansemrau/fix-ref-leakRémi Verschelde2022-06-281-1/+1
|\
| * GDScript Don't double-reference Refs returned from native functionBrian Semrau2021-09-281-1/+1
| |
* | Merge pull request #62468 from V-Sekai/core-const-expressionsRémi Verschelde2022-06-281-0/+2
|\ \ | | | | | | Add a const call mode to Object, Variant and Script.
| * | Add a const call mode to Object, Variant and Script.K. S. Ernest (iFire) Lee2022-06-271-0/+2
| | | | | | | | | | | | | | | | | | | | | 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>
* | | GDScript: Fix setter being called in chains for shared typesGeorge Marques2022-06-271-0/+16
|/ / | | | | | | | | | | | | | | | | | | | | 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.
* | Do not reset return value in release buildBlack Cat2022-06-221-1/+1
| |
* | GDScript: Fix stack overflow when using multiple `await`George Marques2022-05-271-9/+12
| |
* | Merge pull request #61003 from vnen/gdscript-await-stack-fixRémi Verschelde2022-05-161-29/+26
|\ \
| * | GDScript: Fix stack manipulation for `await`George Marques2022-05-131-29/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Replace most uses of Map by HashMapreduz2022-05-161-2/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | * 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!
* | GDScript: Allow using self in lambdasGeorge Marques2022-04-241-0/+36
| |
* | GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffixAaron Franke2022-04-071-2/+2
| |
* | GDScript: Add support for static method calls in native typesGeorge Marques2022-04-061-3/+49
| |