Skip to content
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

Add GC callbacks, and a mechanism to fix the threshold #407

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

KaruroChori
Copy link
Contributor

@KaruroChori KaruroChori commented May 16, 2024

For context: saghul/txiki.js#516 & saghul/txiki.js#520

I implemented a draft of some new core features in quickjs to expose more of an interface for the GC to its runtime. This way it is easier for the application embedding quickjs to control when GC events can run and some related side effects.
This additional control is helpful in the context of systems with some real time requirements.

The extended interface basically consists of:

  • A getter for the cg threshold to complete its interface. added in a separate PR
  • A flag to fix the threshold, disabling the autoscaling feature which is currently forced.
  • Callbacks before and after the CG event (not to be run for manually triggered ones).
    The before callback has a boolean return value to further specify if the event should be allowed to run or not.

Tests are not provided yet since they might be a bit tricky to write, but if there is consensus on this or some alternative variant I will add some.

@KaruroChori KaruroChori changed the title GC callbacks, more flexible scaling model, and getter for GC threshold GC callbacks, a more flexible scaling model, and a getter for GC threshold May 16, 2024
@KaruroChori KaruroChori reopened this May 16, 2024
@saghul
Copy link
Contributor

saghul commented May 16, 2024

In general, I'm supportive of the approach.

I didn't comment on the style issues since they are not relevant just yet ;-)

@chqrlie thoughts?

@KaruroChori
Copy link
Contributor Author

KaruroChori commented May 16, 2024

Sadly style is about what you can expect by someone deeply unfamiliar with the codebase and who does not generally work with C :D.
In my defense I was unable to find specific guidelines in the repo, and the naming conventions are not always consistent across the codebase, so every time I had to name a variable it was a bit of a pickle :D
If you have feedback about style (or if there is a clang formatter I missed) it is welcome as well.

@saghul
Copy link
Contributor

saghul commented May 16, 2024

Ignore the style for now. It should just look like the surrounding code.

We have no linter alas.

@chqrlie
Copy link
Collaborator

chqrlie commented May 16, 2024

In general, I'm supportive of the approach.

I didn't comment on the style issues since they are not relevant just yet ;-)

@chqrlie thoughts?

Hello @KaruroChori, sorry for the lag, I am focused on some tricky issues ATM, I won't have much time to investigate your approach until next week.

@KaruroChori
Copy link
Contributor Author

No problem!

@KaruroChori KaruroChori changed the title GC callbacks, a more flexible scaling model, and a getter for GC threshold Add GC callbacks, and a mechanism to fix the threshold Jun 10, 2024
@KaruroChori
Copy link
Contributor Author

I fixed this PR to not duplicate #424 & reworked some of the naming.

@KaruroChori KaruroChori marked this pull request as ready for review June 10, 2024 07:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants