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

Wasm - Creating a PR in my branch of SQL.js #2

Merged
merged 48 commits into from
Aug 28, 2021
Merged

Wasm - Creating a PR in my branch of SQL.js #2

merged 48 commits into from
Aug 28, 2021

Conversation

Taytay
Copy link
Owner

@Taytay Taytay commented Jan 7, 2019

This will help me see more easily what I've changed in #1

Taytay added 30 commits November 1, 2018 11:58
If we compile without WASM, loading it's synchronous.
If we compile with WASM on, loading is async.

But we need a mechanism we can rely upon to tell us when the loading is complete, regardless of the underlying loading code.
So, we now have a "ready" promise that we can listen for on the exported module.

Also
This allows for `npm run test debug` to work and makes it easier to debug the worker.
Make the worker implementation respect the fact that the loading might be async
Switch to tiny-worker because it is more actively maintained
There was an error in the way the optimized file was being made that caused certain parameters not to be passed to emcc.
This new file isn't as DRY, but it is a bit easier to grok and debug
(All tests pass)
Adding .wasm files
"zero-three" does nothing. "Oh-three" is a valid option.
This meant that our optimized output files were _way_ too big.
* fix/async_loading:
  Add extra test scripts to make it more obvious how to test the various compiled scripts
  Replace invalid "-03" option with "-O3"

As part of the merge, I am removing the new test-memory-growth and am recompiling with the new -O3 setting in the makefile.

# Conflicts:
#	Makefile
#	js/sql-memory-growth.js
#	js/sql.js
#	js/worker.sql.js
No more "*-raw.wasm" files. They were somewhat confusing since sql.js loaded sql-raw.wasm rather than simply sql.wasm.
The optimized build now runs closure on the sql.js loader. (The pre and post wrappers don't have closure applied).
This results in quite a few output files, and could likely be cleaned up
Use allocateUTF8StringOnStack instead
* fix/async_loading:
  Commit the latest compiled assets
  Don't use writeStringToMemory
(It doesn't due to the bug in node/worker detection though)
* fix/async_loading:
  Adding the load_sql_file.js that the tests depend upon
  The worker test would theoretically work if run by itself
  The test files now work correctly if run individually
Also: Add additional package.json scripts
I am purposefully not checking in the compiled assets just yet until this stabilizes
Taytay added 18 commits January 7, 2019 14:34
sql.js -> sql-asm.js
sql-debug.js -> sql-asm-debug.js
test/load_sql_file -> test/load_sql_lib
More renames are to follow.
Commit other test files that use new `load_sql_lib` instead of old `load_sql_file`
More renames to come.
This avoids mixing src and compiled assets
The old folder naming scheme was by language type (c, coffee, js, etc).
This led to some confusion for those working on the project, since output files were not readily distinguishable from src/input files.
The new folders are as follows:
dist/* : Compiled assets used by end users (currently checked into git)
out/* : Intermediate compiled assets generated while creating files in dist/* - Not checked into git
src/* : Source files (coffee, js, etc)
sqlite/* : Source files for sqlite.
Add a test to ensure that the modularization works correctly.
Since we are doing our own modularization rather than relying upon emcc, we have to do a workaround to undo its attempts at exporting the SqlJs Module.
I took many of these examples from the gh-pages branch.
These examples are useful even outside of a Github Pages context, so I wanted to include them here. This makes it easier for the README to reference them.
Since they are now in the main branch, I have taken care to point to CDN libraries where I could so that it doesn't get cluttered with vendor code, like for the codemirror library.
Explain how to upgrade.
Explain how to distribute wasm files.
Update sample code.
Fixes kripken/sql.js/sql-js#173
Fixes kripken/sql.js/sql-js#262
…apper

This is slow and somewhat error prone since it results in recompiling the .wasm files, so I am leaving it out for now.
Also including some unused changes to test-worker.js that I added when trying to get that test running again.
Download sqlite on demand when building.
Remove old unused static sqlite source files.
No longer use keyword "nothing" in examples or tests because it leads to a SQL error. (NOTHING is now a reserved word in Sqlite)
@Taytay Taytay merged commit 5dd2220 into master Aug 28, 2021
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.

1 participant