summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_byte_codegen.cpp
Commit message (Collapse)AuthorAgeFilesLines
* 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
| * GDScript: Adjust type of temporaries when neededGeorge Marques2021-04-161-1/+127
| |
| * GDScript: Pool temporary values by type on the stackGeorge Marques2021-04-141-20/+82
| | | | | | | | | | So the stack slots perform less type changes, which is useful for future optimizations.
* | Fix type argument in is_builtin which was treated as an addressJulien Nguyen2021-04-111-1/+1
|/
* Reduce number of addressing modes in GDScript VMGeorge Marques2021-04-081-23/+21
| | | | | | | | | | | | | | 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.
* Merge pull request #47569 from vnen/gdscript-typed-returnRémi Verschelde2021-04-051-2/+79
|\ | | | | GDScript: Properly validate return type
| * GDScript: Properly validate return typeGeorge Marques2021-04-051-2/+79
| | | | | | | | | | | | | | 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.
* | Merge pull request #46991 from madmiraal/rename-invert-reverseRémi Verschelde2021-04-011-1/+1
|\ \ | |/ |/| Rename Array.invert() to Array.reverse()
| * Rename Array.invert() to Array.reverse()Marcel Admiraal2021-03-211-1/+1
| | | | | | | | | | Does the same internally for List and Vector<>, which includes all PackedArray types.
* | Add typed arrays to GDScriptGeorge Marques2021-03-291-5/+34
|/ | | | | | | | - 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.
* Merge pull request #44104 from nekomatata/coroutine-await-fixRémi Verschelde2021-01-111-0/+11
|\ | | | | Fix error when calling coroutine with await in _ready
| * Fix error when calling coroutine with await in _readyPouleyKetchoupp2020-12-171-0/+11
| | | | | | | | | | The code paths for calling async functions seemed to be missing in some cases, causing a debug break and false positive error.
* | Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
|/ | | | | | | | | | | | | | 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 🎆
* Fix gdscript and operatorBrian Semrau2020-12-161-2/+2
|
* Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde2020-12-151-2/+61
|\ | | | | GDScript: Refactor builtin functions
| * GDScript: Refactor builtin functionsGeorge Marques2020-11-261-2/+61
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge pull request #41773 from ThakeeNathees/default-argument-override-buf-fixGeorge Marques2020-12-021-6/+12
|\ \ | | | | | | GDScript default argument override bug fix
| * | GDScript default argument override bug fixThakee Nathees2020-11-281-6/+12
| | | | | | | | | | | | Fix: #41766
* | | GDScript: Improve handling of operatorsGeorge Marques2020-11-261-1/+22
| |/ |/| | | | | | | | | | | | | - 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.
* | GDScript: Fix mishandling of stack pointersGeorge Marques2020-11-251-18/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* | GDScript: Add faster instruction for validated constructorGeorge Marques2020-11-211-1/+53
| | | | | | | | Only for built-in types.
* | GDScript: Add typed iterate instructionsGeorge Marques2020-11-211-2/+89
| |
* | GDScript: Add faster call instructions for builtin methodsGeorge Marques2020-11-211-0/+47
| | | | | | | | | | Methods from builtin types can be called by using the function pointer when the argument and base types are known at compile time.
* | GDScript: Add faster call instructions for native methodsGeorge Marques2020-11-211-7/+78
| |
* | GDScript: Add speficic set/get instructionsGeorge Marques2020-11-211-2/+134
| | | | | | | | | | When the base type is known at compile-time, we can get a direct function pointer that is faster than the regular set/get paths.
* | GDScript: Add faster operator for known typesGeorge Marques2020-11-211-0/+28
| | | | | | | | | | It now uses the direct operator function pointer, which increases performance in evaluation.
* | GDScript: Gather instructions arguments beforehandGeorge Marques2020-11-211-115/+111
|/ | | | | | | | | Almost all instructions need variant arguments. With this change they are loaded in an array before each instruction call. This makes the addressing code be localized to less places, improving compilation overhead and binary size by a small margin. This should not affect performance.
* Merge pull request #42067 from ThakeeNathees/for-loop-stack-overriden-fixGeorge Marques2020-10-191-3/+5
|\ | | | | GDScript: for loop override stack variable bug fix