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

Cherrypick gc features from stable-gluegunfw #537

Merged
merged 1 commit into from
Jun 8, 2024
Merged

Conversation

KaruroChori
Copy link
Contributor

@KaruroChori KaruroChori commented Jun 6, 2024

Restricted version of #520, waiting for upstream support of the threshold getter.
I will keep it as draft up to when the quickjs submodule is updated to a commit supporting the getter.

@KaruroChori
Copy link
Contributor Author

By the way, without callbacks there is no good way to write tests for this feature. I will add them at some point if/when they are merged as well.

@saghul
Copy link
Owner

saghul commented Jun 7, 2024

Alright, master is ready for this PR now, I also merged the GC threshold getter API. If you rebase and get the build green we are good to go!

@KaruroChori KaruroChori marked this pull request as ready for review June 8, 2024 02:33
@KaruroChori
Copy link
Contributor Author

KaruroChori commented Jun 8, 2024

In theory it is ok.
I have no idea how to make CI/Lint happy;
CI/Codegen is just because my environment is different I guess;
the alpine test failing is just randomly happening from time to time.

run: () => core._gc.run(),

set enabled(value) {
if (value === true) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (value === true) {
if (value) {

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to be that strict.

if (_gc_state.enabled) {
core._gc.setThreshold(value); _gc_state.threshold = value;
} else {
core._gc.setThreshold(-1);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we store the threshold and apply it if the user then flips the enabled switch? Otherwise it will be lost.

@saghul
Copy link
Owner

saghul commented Jun 8, 2024

You can make the linter happy by running the formatter yourself: npm run format

Codegen relies on the node version, make sure you are using 20.

I can take care of those myself if you can't.

@KaruroChori
Copy link
Contributor Author

I fixed the logic since it was all a bit wonky.

You can make the linter happy by running the formatter yourself: npm run format

npm run format does nothing.
On this repo I usually run the lint command which is specified in scripts (forcing the fix flag).

I don't have a node 20 instance on this machine, if you could do that it would be better.

@saghul
Copy link
Owner

saghul commented Jun 8, 2024

Ah I meant make format sorry. I updated the PR, everything should be green now.

@KaruroChori
Copy link
Contributor Author

KaruroChori commented Jun 8, 2024

Not really, but it is the usual culprit test-console.js. It always behaves quite randomly.
Probably it should be investigated on its own.

@saghul saghul merged commit 9092e4d into saghul:master Jun 8, 2024
14 checks passed
@KaruroChori KaruroChori deleted the gc branch June 10, 2024 07:26
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.

2 participants