-
-
Notifications
You must be signed in to change notification settings - Fork 20.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GDScript: Typed VM Take 2 #43725
GDScript: Typed VM Take 2 #43725
Conversation
Project - https://github.com/qarmin/RegressionTestProject/archive/master.zip - crashes with this backtrace
|
When running project - https://github.com/qarmin/The-worst-Godot-test-project/archive/master.zip - then I got this address sanitizer error
|
02544b0
to
744af11
Compare
@qarmin I believe I fixed both issues (didn't test the address sanitizer but I have an idea of what caused it) There are still some issues with the validated getter instructions but it's because a bug in the core functions. They are setting the value but not the type, so you might get a Nil (default) when there should be something. |
Also in https://github.com/qarmin/RegressionTestProject/archive/master.zip
there are also other errors like This projects works fine in master |
Yes, that's what I mentioned that is a problem in core. I'll fix it in another PR to get independent review. EDIT: To clarify, the issue is that |
744af11
to
3512b70
Compare
The fix for the core issue is in #43728. |
- Allow getting an opaque pointer, no matter the type (for ptrcall). - Allow setting object pointer and id directly. - Allow initializing the data given a type, to allow properly setting return types on ptrcalls.
To improve organization and reduce the size of compilation units.
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.
It now uses the direct operator function pointer, which increases performance in evaluation.
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.
Methods from builtin types can be called by using the function pointer when the argument and base types are known at compile time.
3512b70
to
888b95a
Compare
Only for built-in types.
888b95a
to
5518e2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally after rebasing on latest master
, seems to work OK.
RegressionTestProject
doesn't crash anymore (before PR: 340 errors/warnings, after PR: 317 errors/warnings, though I didn't double check if it's related to this PR).
The-worst-Godot-test-project
fails due to !bool
being broken in master
currently (both before and after this PR). Tried working it around but there are many more errors due to changes to type conversion of Strings (before and after PR).
Let's merge and refine further in master
.
Thanks! |
New take from #43004, since that had issues with resource usage during compilation.
This uses the new core utilities to get function pointers instead of having discrete instructions. This is in the same speed improvement ballpark as the previous PR.
This does not include the builtin GDScript functions since it will require further changes in the parser/compiler, so they are best suited to a different Pull Request (also I might take the chance to remove a couple of those, so reviewing it independently might be better).