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

Increase ASYNCIFY_STACK_SIZE #114

Merged
merged 2 commits into from
Apr 22, 2023

Conversation

yar2001
Copy link
Contributor

@yar2001 yar2001 commented Apr 20, 2023

According to #112, I increase the ASYNCIFY_STACK_SIZE and add a test that will check if the option works

Based on my experiments, the relationship between ASYNCIFY_STACK_SIZE and max nesting levels is as follows:

ASYNCIFY_STACK_SIZE Max Nesting Levels
4096 (default) 12
81920 297

But if not calling the asyncified function, the max nesting levels can reach up to around 962, maybe the ASYNCIFY_STACK_SIZE can continue to be increased?


I add a new commit that is using dynamic asyncify stack(emscripten-core/emscripten#9556) like this:

#ifdef QTS_ASYNCIFY
EM_JS(void, set_asyncify_stack_size, (size_t size), {
  Asyncify.StackSize = size || 81920;
});
#endif

/**
 * Set the stack size limit, in bytes. Set to 0 to disable.
 */
void QTS_RuntimeSetMaxStackSize(JSRuntime *rt, size_t stack_size) {
#ifdef QTS_ASYNCIFY
  set_asyncify_stack_size(stack_size);
#endif
  JS_SetMaxStackSize(rt, stack_size);
}

@yar2001 yar2001 force-pushed the asyncify-stack-size-increase branch from 8efbb6c to 3e03a0f Compare April 20, 2023 10:53
Copy link
Owner

@justjake justjake left a comment

Choose a reason for hiding this comment

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

Looks great

@justjake justjake merged commit fb984a5 into justjake:main Apr 22, 2023
@yar2001 yar2001 deleted the asyncify-stack-size-increase branch April 24, 2023 03:35
@yar2001 yar2001 restored the asyncify-stack-size-increase branch April 24, 2023 03:35
@yar2001 yar2001 deleted the asyncify-stack-size-increase branch April 24, 2023 03:36
menduz pushed a commit to decentraland/quickjs-emscripten that referenced this pull request May 3, 2023
* Increase ASYNCIFY_STACK_SIZE

* Add dynamic asyncify stack size
menduz added a commit to decentraland/quickjs-emscripten that referenced this pull request May 4, 2023
* 0.23.0

* update changelog for 0.21.1

* Bump qs from 6.5.2 to 6.5.3 (justjake#89)

Bumps [qs](https://github.com/ljharb/qs) from 6.5.2 to 6.5.3.
- [Release notes](https://github.com/ljharb/qs/releases)
- [Changelog](https://github.com/ljharb/qs/blob/main/CHANGELOG.md)
- [Commits](ljharb/qs@v6.5.2...v6.5.3)

---
updated-dependencies:
- dependency-name: qs
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Bump decode-uri-component from 0.2.0 to 0.2.2 (justjake#83)

Bumps [decode-uri-component](https://github.com/SamVerschueren/decode-uri-component) from 0.2.0 to 0.2.2.
- [Release notes](https://github.com/SamVerschueren/decode-uri-component/releases)
- [Commits](SamVerschueren/decode-uri-component@v0.2.0...v0.2.2)

---
updated-dependencies:
- dependency-name: decode-uri-component
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Fix for func_id rollover (justjake#94)

* 32767 functions good, 32768 functions BAD

* change `magic` to uin16_t (avoids signed intereger overflow)

* type magic as uint32_t, add simple test

* re-enable all tests

* remove missed test code

* address PR issues

* switch to a map of maps for fnMap

* update fnId to start at min value

* skip max funcID tests for debug mode

* missed a flag

* run prettier

* Bump http-cache-semantics from 4.1.0 to 4.1.1 (justjake#97)

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* 0.21.2

* scripts/emcc.sh: cache lto .a files in build/emsdk-cache

* unknown change to .map file

* Emit async imports for variants (justjake#100)

* upgrade typescript

* attempt to use nodenext tsc

* revert enabling noUnused{Locals,Parameters}

* fix imports to use real extensions

* update mocha for ESM

* awkward async import issue

* npm run build

* examples/website: update for newer NPM, typescript

* fix behavior for webpack build

* bump emsdk to 3.1.31

* fix function signature

* cache another item

* use EMSDK 3.1.32 native, 3.1.31 in Docker

* add some extra default timeout

* Fix breakage caused by upgrade

* rebuild

* More precise/strict compilation (drop support for node<16)

* rebuild

* add note about MINIMAL_RUNTIME

* tested website

* ?

* pretty

* BigInt (-DCONFIG_BIGNUM) support (justjake#104)

* enable CONFIG_BIGNUM

* recompile for bignum

* bigint basics

* vm.dump for bigint

* fix bigint call

* update changelog

* dump

* Extended Symbol support (justjake#105)

* Symbol utilities

* rebuild

* update CHANGLOG.md

* rebuild docs

* update changelog

* 0.22.0

* Increase ASYNCIFY_STACK_SIZE (justjake#114)

* Increase ASYNCIFY_STACK_SIZE

* Add dynamic asyncify stack size

* update docs & changelog

* rebuild docs

* 0.23.0

* Makefile: use emscripten/emsdk:3.1.35 from docker

* rebuild

* update smoketest

* feat: BigNum (#3)

* Add vim swapfiles to gitignore

* Use local emcc binary

* Build for emscripten web target

* Enable QuickJS bignum extensions

* Update generated files

* Update README.md

* test

* build

* build

* new package name

Co-authored-by: Ben Sidhom <bsidhom@gmail.com>
Co-authored-by: menduz <github@menduz.com>

* feat: add opcode instructions counter (#1)

* add opcode counter

* remove static

* update generated

* fix

* fix prettier

* remove prepack

* feat: move opcode counters to uint64 (#4)

* feat: move the counter to 64bit

* fix test

* increase mocha timeout

* fix prettier

* rebuild

* fix lock

* fix package.json

* prettier

* ignore emsdk-cache in prettier

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Jake Teton-Landis <just.1.jake@gmail.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adam Yost <swimmadude66@users.noreply.github.com>
Co-authored-by: yar2001 <yar2001@163.com>
Co-authored-by: Lean Mendoza <leandro@decentraland.org>
Co-authored-by: Ben Sidhom <bsidhom@gmail.com>
menduz pushed a commit to decentraland/quickjs-emscripten that referenced this pull request May 4, 2023
* Increase ASYNCIFY_STACK_SIZE

* Add dynamic asyncify stack size
menduz pushed a commit to decentraland/quickjs-emscripten that referenced this pull request May 4, 2023
* Increase ASYNCIFY_STACK_SIZE

* Add dynamic asyncify stack size
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