-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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: Fix lambda hot reloading #81628
Conversation
5b65e51
to
9cf297a
Compare
umm, the failed check seems like an unrelated crash.. |
You're absolutely right |
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.
I'm not qualified enough to review this, I just noticed a couple of minor flaws.
If hot reloading is only available in the editor, does it make sense to wrap some code in TOOLS_ENABLED
or DEBUG_ENABLED
?
e756e07
to
7b6b2ba
Compare
@dalexeev tbh i dont know why you would pass |
should i click the resolve conversation button now that ive pushed the corrections?? i do not remember |
If you've addressed the comment and there are no open matters to discuss, then feel free to click resolve :) |
@AThousandShips id appreciate another review on the thread safety, i changed some things in gdscript.cpp, and i remember your affinity on the subject |
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.
Otherwise I don't see any issues with the threading, but I'm a bit rusty with the specifics so might be missing something, so someone else should take a look at that as well
42bcc5d
to
560d1b3
Compare
Thanks @AThousandShips, I integrated your suggestions into the PR as @rune-scape is unavailable for the moment. |
I created a MRP to make sure that it works. And it works flawlessly. Just run the project, then change the inner value of the lambdas. It just works! |
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.
It's fine for me. It works and the code is clean. I'm no hot-reloading-whiz, but I'm OK with merging this for 4.2.
560d1b3
to
d05aa3b
Compare
while using it yesterday i just found a small bug related to thread safety checks. pushing that now before it gets merged |
d05aa3b
to
f7f3e10
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.
For a glance it looks good. It'll take some time if I dive deep on the logic, so I'll trust rune on this. It's already a big improvement over the current status even if some bug crops up.
f7f3e10
to
9a6ed41
Compare
Co-authored-by: Adam Scott <[email protected]>
9a6ed41
to
9fb8862
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.
Looks good. It's a huge improvement over the current status.
Thanks! Amazing work 🎉 |
fixes #62769
swaps out the function pointers used in LambdaCallables when a script is reloaded
if it cant find a good replacement it invalidates the callable, so no more 'Bad Address Index' and crashes, it tells you its called an invalid lambda
the logic it uses to swap lambdas is very simple right now, swapping only if the argument count vaguely matches, and no lambdas were added or removed, evaluated for each function the lambda was in
also should be safe across threads, because lambdas can be created on any thread. i took care to make sure it wouldnt slow lambda creation down
it may be a good idea to add some more logic to how old lamdas are matched to new ones, the data is there but i dont know what would be intuitive, what would break logic, im all ears for heuristics
MRP:
81628.zip
Production edit: added the MRP