summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_byte_codegen.cpp
AgeCommit message (Collapse)Author
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
2021-04-05GDScript: Properly validate return typeGeorge Marques
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.
2021-04-01Merge pull request #46991 from madmiraal/rename-invert-reverseRémi Verschelde
Rename Array.invert() to Array.reverse()
2021-03-29Add typed arrays to GDScriptGeorge Marques
- 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.
2021-03-21Rename Array.invert() to Array.reverse()Marcel Admiraal
Does the same internally for List and Vector<>, which includes all PackedArray types.
2021-01-11Merge pull request #44104 from nekomatata/coroutine-await-fixRémi Verschelde
Fix error when calling coroutine with await in _ready
2021-01-01Update copyright statements to 2021Rémi Verschelde
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 🎆
2020-12-17Fix error when calling coroutine with await in _readyPouleyKetchoupp
The code paths for calling async functions seemed to be missing in some cases, causing a debug break and false positive error.
2020-12-16Fix gdscript and operatorBrian Semrau
2020-12-15Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde
GDScript: Refactor builtin functions
2020-12-02Merge pull request #41773 from ThakeeNathees/default-argument-override-buf-fixGeorge Marques
GDScript default argument override bug fix
2020-11-28GDScript default argument override bug fixThakee Nathees
Fix: #41766
2020-11-26GDScript: Improve handling of operatorsGeorge Marques
- Use the new functions in Variant to determine the validity and resulting type of operators. - Split the operator function in codegen between binary and unary, since the unary ones have now a special requirement of having the second argument to be the NIL type when requesting info.
2020-11-26GDScript: Refactor builtin functionsGeorge Marques
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.
2020-11-25GDScript: Fix mishandling of stack pointersGeorge Marques
- Replace the for loop temporaries by locals. They cause conflicts with the stack when being popped, while locals are properly handled in the scope. - Change the interface for the codegen so the for loop list doesn't live through the whole block if it's a temporary. - Keep track of the actual amount of local variables in the stack. Using the size of the map is misleading in cases where multiple locals have the same name (which is allowed when there's no shadowing). - Added a few debug checks for temporaries, to avoid them being wrongly manipulated in the future. They should not live more than a line of code. - Rearrange some of compiler code to make sure the temporaries don't live across blocks.
2020-11-21GDScript: Add faster instruction for validated constructorGeorge Marques
Only for built-in types.
2020-11-21GDScript: Add typed iterate instructionsGeorge Marques