summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_byte_codegen.cpp
AgeCommit message (Collapse)Author
2023-02-24GDScript: Don't use validated call for vararg methodsGeorge Marques
Since they may have runtime type validation, we cannot use the validated call.
2023-02-21GDScript: Avoid validated division operation to test for zeroGeorge Marques
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.
2023-02-20Merge pull request #73489 from vonagam/type-check-nodeRémi Verschelde
GDScript: Rework type check
2023-02-17Avoid GDScript bookkeeping from referencing objects longer than necessaryPedro J. Estébanez
2023-02-17GDScript: Rework type checkDmitrii Maganov
2023-01-31GDScript: Fix issues with typed arraysDmitrii Maganov
2023-01-23Merge pull request #70948 from vnen/gdscript-ptr-method-name-in-debugGeorge Marques
2023-01-23GDScript: Add names for disassembling function pointersGeorge Marques
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.
2023-01-22GDScript: Remove function of `continue` for match statementGeorge Marques
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.
2023-01-12Merge pull request #70987 from vonagam/fix-parameter-conversion-assignGeorge Marques
2023-01-11GDScript: Fix temp values being written without proper clearGeorge Marques
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.
2023-01-09GDScript: Don't use the NIL address to hold return value of functionsGeorge Marques
This prevents that the NIL address is filled with another value, which causes problems for some instructions that read from NIL.
2023-01-06GDScript: Fix missing conversion for default argument valuesDmitrii Maganov
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-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-01GDScript: Fix subclass script path issuesrune-scape
2022-07-28Merge pull request #63049 from Faless/mp/4.x_as_moduleRémi Verschelde
2022-07-27Merge pull request #63325 from EIRTeam/typed_array_fixRémi Verschelde
2022-07-26[Net] Modularize multiplayer, expose MultiplayerAPI to extensions.Fabio Alessandrelli
- 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.
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-22Fix typed array returns returning the incorrect contained typeÁlex Román Núñez
Fixes #59485 and #60218
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-05-12Add a new HashMap implementationreduz
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<>
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-01-17Merge pull request #55616 from cdemirer/masterRémi Verschelde
Fix nested ternary-if codegen
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-12-04Fix nested ternary-if codegen (#55582)cdemirer
2021-10-08Only emit typed member setters if safe to do soDavid Sichma
Instructions are now only emitted if input type matches expected type. Otherwise usual setter fallback.
2021-09-30Use range iterators for `Map`Lightning_A
2021-09-13Merge pull request #52323 from vnen/gdscript-singleton-interdependence-fixRémi Verschelde
Fix loading of interdependent autoloads
2021-09-07[Net] Move multiplayer to core subdir, split RPCManager.Fabio Alessandrelli
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".
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-07-23Use C++ iterators for Lists in many situationsAaron Franke
2021-07-20[Net] Single `rpc` annotation. "sync" no longer part of mode.Fabio Alessandrelli
- 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).
2021-06-18GDScript: Fix setting type of operator return valueGeorge Marques
Also write type adjust when needed for binary operators.
2021-06-04Rename Quat to QuaternionMarcel Admiraal
2021-06-03Rename Variant TRANSFORM to TRANSFORM3DAaron Franke
Also _transform to _transform3d
2021-05-26GDScript: Use analyzer data to decide assignment conversionGeorge Marques
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.
2021-05-17Merge pull request #48793 from vnen/gdscript-fix-temp-type-adjustRémi Verschelde
GDScript: Fix crash caused by uninitialized temp stack slots
2021-05-17GDScript: Fix crash caused by uninitialized temp stack slotsGeorge Marques
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.
2021-05-16GDScript: Add support for builtin static method callsGeorge Marques
2021-04-28GDScript: Implement lambdas compilation and runtimeGeorge Marques
2021-04-20Merge pull request #47956 from vnen/gdscript-double-stackRémi Verschelde
GDScript: Use special stack space for temporaries to reduce type changes
2021-04-16GDScript: Adjust type of temporaries when neededGeorge Marques
2021-04-14GDScript: Pool temporary values by type on the stackGeorge Marques
So the stack slots perform less type changes, which is useful for future optimizations.
2021-04-11Fix type argument in is_builtin which was treated as an addressJulien Nguyen
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-05Merge pull request #47569 from vnen/gdscript-typed-returnRémi Verschelde
GDScript: Properly validate return type