summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_byte_codegen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GDScript: Optimize operators by assuming the typesGeorge Marques2023-07-281-1/+13
| | | | | | | | | | | 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.
* GDScript: Fix some bugs with static variables and functionsDanil Alexeev2023-06-161-0/+14
|
* Style: Harmonize header includes in modulesRémi Verschelde2023-06-151-1/+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
* Fix edge cases of object lifetime when signals involvedPedro J. Estébanez2023-04-111-1/+20
|
* GDScript: Don't use pool for reference typesGeorge Marques2023-04-111-51/+47
| | | | | Since they need to be properly initialized and finalized to adjust the reference counter.
* GDScript: Don't use validated call for vararg methodsGeorge Marques2023-02-241-2/+2
| | | | | Since they may have runtime type validation, we cannot use the validated call.
* GDScript: Avoid validated division operation to test for zeroGeorge Marques2023-02-211-1/+2
| | | | | | The validated operations for integer division and modulo do not check for division by zero. This avoids validated operation in these cases to make sure the check is performed and avoid crashing the engine.
* Merge pull request #73489 from vonagam/type-check-nodeRémi Verschelde2023-02-201-12/+38
|\ | | | | | | GDScript: Rework type check
| * GDScript: Rework type checkDmitrii Maganov2023-02-171-12/+38
| |
* | Avoid GDScript bookkeeping from referencing objects longer than necessaryPedro J. Estébanez2023-02-171-30/+73
|/
* GDScript: Fix issues with typed arraysDmitrii Maganov2023-01-311-21/+13
|
* Merge pull request #70948 from vnen/gdscript-ptr-method-name-in-debugGeorge Marques2023-01-231-2/+37
|\
| * GDScript: Add names for disassembling function pointersGeorge Marques2023-01-231-2/+37
| | | | | | | | | | | | When instructions use function pointers, it's not possible to retrieve their original names in the disassembly. This stores the names in vectors (in debug builds) so they can be shown.
* | GDScript: Remove function of `continue` for match statementGeorge Marques2023-01-221-28/+0
|/ | | | | | The keyword is confusing and rarely is used in the intended way. It is removed now in favor of a future feature (pattern guards) to avoid breaking compatibility later.
* Merge pull request #70987 from vonagam/fix-parameter-conversion-assignGeorge Marques2023-01-121-2/+6
|\
| * GDScript: Fix missing conversion for default argument valuesDmitrii Maganov2023-01-061-2/+6
| |
* | GDScript: Fix temp values being written without proper clearGeorge Marques2023-01-111-60/+40
| | | | | | | | | | | | Temporary values in the stack were not being properly cleared when the return value of calls were discarded, which can cause memory issues especially for reference types like PackedByteArray.
* | GDScript: Don't use the NIL address to hold return value of functionsGeorge Marques2023-01-091-21/+31
|/ | | | | This prevents that the NIL address is filled with another value, which causes problems for some instructions that read from NIL.
* 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".
* Optimizations for GDScript VMJuan Linietsky2023-01-021-137/+137
| | | | | | | * 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: Fix subclass script path issuesrune-scape2022-12-011-1/+1
|
* Merge pull request #63049 from Faless/mp/4.x_as_moduleRémi Verschelde2022-07-281-1/+1
|\
| * [Net] Modularize multiplayer, expose MultiplayerAPI to extensions.Fabio Alessandrelli2022-07-261-1/+1
| | | | | | | | | | | | | | | | | | - RPC configurations are now dictionaries. - Script.get_rpc_methods renamed to Script.get_rpc_config. - Node.rpc[_id] and Callable.rpc now return an Error. - Refactor MultiplayerAPI to allow extension. - New MultiplayerAPI.rpc method with Array argument (for scripts). - Move the default MultiplayerAPI implementation to a module.
* | Merge pull request #63325 from EIRTeam/typed_array_fixRémi Verschelde2022-07-271-1/+1
|\ \ | |/ |/|
| * Fix typed array returns returning the incorrect contained typeÁlex Román Núñez2022-07-221-1/+1
| | | | | | | | Fixes #59485 and #60218
* | Implement Vector4, Vector4i, Projectionreduz2022-07-231-0/+12
|/ | | | | | | | | | | | | 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.
* GDScript: Fix setter being called in chains for shared typesGeorge Marques2022-06-271-0/+12
| | | | | | | | | | | 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.
* Add a new HashMap implementationreduz2022-05-121-4/+2
| | | | | | | | | | | | | | | | | Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
* GDScript: Allow using self in lambdasGeorge Marques2022-04-241-2/+2
|
* GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffixAaron Franke2022-04-071-1/+1
|
* GDScript: Add support for static method calls in native typesGeorge Marques2022-04-061-0/+18
|
* Merge pull request #55616 from cdemirer/masterRémi Verschelde2022-01-171-0/+1
|\ | | | | Fix nested ternary-if codegen
| * Fix nested ternary-if codegen (#55582)cdemirer2021-12-041-0/+1
| |
* | Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
|/ | | | Happy new year to the wonderful Godot community!
* Only emit typed member setters if safe to do soDavid Sichma2021-10-081-2/+4
| | | | | Instructions are now only emitted if input type matches expected type. Otherwise usual setter fallback.
* Use range iterators for `Map`Lightning_A2021-09-301-28/+28
|
* Merge pull request #52323 from vnen/gdscript-singleton-interdependence-fixRémi Verschelde2021-09-131-0/+6
|\ | | | | Fix loading of interdependent autoloads
| * GDScript: Fix loading of interdependent autoloadsGeorge Marques2021-09-011-0/+6
| | | | | | | | | | | | 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.
* | [Net] Move multiplayer to core subdir, split RPCManager.Fabio Alessandrelli2021-09-071-1/+1
|/ | | | | | | | | | | Move multiplayer classes to "core/multiplayer" subdir. Move the RPCConfig and enums (TransferMode, RPCMode) to a separate file (multiplayer.h), and bind them to the global namespace. Move the RPC handling code to its own class (RPCManager). Renames "get_rpc_sender_id" to "get_remote_sender_id".
* Use C++ iterators for Lists in many situationsAaron Franke2021-07-231-8/+8
|
* [Net] Single `rpc` annotation. "sync" no longer part of mode.Fabio Alessandrelli2021-07-201-2/+2
| | | | | | | | | | | | | | | | - Move the "sync" property for RPCs to RPCConfig. - Unify GDScript annotations into a single one: - `@rpc(master)` # default - `@rpc(puppet)` - `@rpc(any)` # former `@remote` - Implement three additional `@rpc` options: - The second parameter is the "sync" option (which also calls the function locally when RPCing). One of "sync", "nosync". - The third parameter is the transfer mode (reliable, unreliable, ordered). - The third parameter is the channel (unused for now).
* GDScript: Fix setting type of operator return valueGeorge Marques2021-06-181-0/+8
| | | | Also write type adjust when needed for binary operators.
* Rename Quat to QuaternionMarcel Admiraal2021-06-041-4/+4
|
* Rename Variant TRANSFORM to TRANSFORM3DAaron Franke2021-06-031-3/+3
| | | Also _transform to _transform3d
* GDScript: Use analyzer data to decide assignment conversionGeorge Marques2021-05-261-48/+46
| | | | | | | Since there might be tricky cases in the analyzer (in the case of unsafe lines) which would need to be properly checked again. Instead, this splits the code generator in two functions and use information set by the analyzer to tell which function to use, without a need to re-check.
* Merge pull request #48793 from vnen/gdscript-fix-temp-type-adjustRémi Verschelde2021-05-171-7/+5
|\ | | | | GDScript: Fix crash caused by uninitialized temp stack slots
| * GDScript: Fix crash caused by uninitialized temp stack slotsGeorge Marques2021-05-171-7/+5
| | | | | | | | | | | | This adds initialization to every typed temporary stack slot at the beginning of the function call instead of emitting instructions, since those might be in a conditional branch and not be called.
* | GDScript: Add support for builtin static method callsGeorge Marques2021-05-161-0/+50
|/
* GDScript: Implement lambdas compilation and runtimeGeorge Marques2021-04-281-0/+23
|
* Merge pull request #47956 from vnen/gdscript-double-stackRémi Verschelde2021-04-201-20/+208
|\ | | | | GDScript: Use special stack space for temporaries to reduce type changes