aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/common
Commit message (Collapse)AuthorAge
* Replace use of 'self' in JS code with 'globalThis', as that works in ↵stephan2023-03-07
| | | | | browsers and node environments. Avoid using globalThis.location if it's not set (e.g. in node). Based on feedback in [forum:ac7a94d4f77db235|forum post ac7a94d4f77db235]. Minor JS build tweaks. FossilOrigin-Name: dbbe8f25e58738c10b6192d41f1e3886983871f17631cbc45ce626d3f05a6e26
* Expose the auto-extension API to JS and reorganize some nearby code.stephan2022-12-26
| | | FossilOrigin-Name: 52b229d11d82bfb81c8b63e252c51c57a34dc50498dd685451588c185873c628
* Extend [0e69b2c379e618] to support uninstalling stale JS-to-WASM function ↵stephan2022-12-26
| | | | | pointers added on behalf of UDFs. FossilOrigin-Name: 7a46e629dcbf97ae037c5abb39306af7ad55f1910c1e962373e09d88d8bd5a33
* Reimplement sqlite3.capi.sqlite3_close_v2() and sqlite3session_delete() as a ↵stephan2022-12-26
| | | | | hand-written bindings so that they can attempt to clean up certain (potentially) FuncPtrAdapter-installed functions before closing. Correct the create-function family of JS-to-function-pointer automated conversions to include the UDF's arity as part of the mapping's key so that (un)binding a UDF to different functions for different arities works (and add tests confirming it). Correct a broken doc link in module-symbols.html. FossilOrigin-Name: 60b262ef0f57b162c2566b12e70685a92afb00b441332ea7a6540fcb188cc7af
* Rename the new wasm.irSizeof() to sizeofIR() because that seems clearer.stephan2022-12-25
| | | FossilOrigin-Name: 49a83ca3ba46d3ae8021fbdd72b48ce9181eea6845fa7bb7aa83b16fad1728be
* Merge wasm-session-api branch into trunk, adding the session API to the ↵stephan2022-12-25
|\ | | | | | | | | JS/WASM components. FossilOrigin-Name: dfb8b651fa4faef2d3307a05512cdc479398484c3a59715827179c363861a777
| * Add sqlite3.wasm.irSizeof() and extend certain allocation functions to make ↵stephan2022-12-25
| | | | | | | | | | use of it. FossilOrigin-Name: 1cbc7b1875e8611b9db7a747b4c9499501450deaf90c929d212511837d6f72b6
| * Merge trunk into wasm-session-api branch.stephan2022-12-25
| |\ | | | | | | FossilOrigin-Name: 7f8f1acd82be7dc2eb2147d96299b1b443e86774dfe0b0a8d32669a0500fc9c6
| * \ Merge trunk into wasm-session-api branch.stephan2022-12-23
| |\ \ | | | | | | | | FossilOrigin-Name: 6cdb036d8e8c5ddb0c6578aeefe318e74d7a90228e57b9f9047057dae3252963
| * | | Internal cleanups and minor speed optimizations in the sqlite3.wasm.xWrap() ↵stephan2022-12-23
| | | | | | | | | | | | | | | | | | | | infrastructure. FossilOrigin-Name: c4dab53b8ea3401abd57671b8f3cb39fa4431b864d4c4e14ae24592f8d4cba0a
| * | | Add sqlite3.capi JS bindings for the sqlite3session_...(), ↵stephan2022-12-23
| | | | | | | | | | | | | | | | | | | | sqlite3changeset_...() and sqlite3changegroup_...() APIs, noting that they are completely untested. Aside from missing tests, these bindings reveal a slight string-argument-type shortcoming in the callback function pointer "reverse binding" which should ideally be resolved before publishing them. FossilOrigin-Name: 0a39172ee134816f5ce17a403b960e9c22bb56efd5bcf77ecde465efe0d88b1d
* | | | Replace the "manual" implementation of sqlite3.capi.sqlite3_exec() with a ↵stephan2022-12-25
| |_|/ |/| | | | | | | | | | | briefer "automated" one via the [7f9ace1b11a67] feature addition. Minor code-adjacent internal cleanups. FossilOrigin-Name: 4888957baf18c6763f959fbba998a74156ff656368779107f502b926e9e9d949
* | | Add missing sqlite3_context_db_handle() JS binding. Reimplement ↵stephan2022-12-25
| | | | | | | | | | | | | | | sqlite3_set_authorizer() and sqlite3_set_auxdata() JS bindings to take advantage of [7f9ace1b11a67]. Teach FuncPtrAdapter to emit a console.warn() message if it is invoked after the library is bootstrapped, the goal being to inform users that it's an internal API and should not be invoked from client-side code. FossilOrigin-Name: 8e3d4f6294037396e388ec21abb18bf0201a6bec6ff004730cc5d11b705a6d2b
* | | Enhance sqlite3.wasm.xWrap.FuncPtrAdapter to be able to handle ↵stephan2022-12-25
| | | | | | | | | | | | | | | sqlite3_create_function() and friends and reimplement those bindings to use this feature (this will also simplify certain session API bindings). Interal API changes only with no client-side breakage. FossilOrigin-Name: 7f9ace1b11a6703031790af9cf08ab25df25850a86e6ca2a7aeaefd8aa395e6d
* | | Reimplement JS's sqlite3_bind_text/blob() with hand-written bindings to ↵stephan2022-12-23
| |/ |/| | | | | | | permit more flexible inputs. Add automated JS-to-C function conversion to sqlite3_busy_handler(). sqlite3.wasm.xWrap()'s '*' argument conversion no longer treats JS strings as C-strings: those conversions require explicit opt-in via the 'string' converter (or equivalent). FossilOrigin-Name: 96ba44946b3e88b6aa305c4363cbbfeab0d9120b3d8c4d2587d68b9293ea7cc6
* | Internal JS cleanups. Correct part of [ac136925a645] to account for the ↵stephan2022-12-23
| | | | | | | | | | eTextRep flag being able to hold flags other than the encoding. FossilOrigin-Name: 1dfc03ab1e0269807beef27bf884ab9ead7553d4a5f6ed213f812d7fa052045f
* | Cherry-pick [c4dab53b8ea3401abd] for sqlite3.wasm.xWrap() optimizations.stephan2022-12-23
|/ | | FossilOrigin-Name: 9b97412d3aa791870016ab3c6f565b6a6afa1764f98e969833aec093b9b29919
* Add sqlite3_set_authorizer() support and related tests to JS.stephan2022-12-16
| | | FossilOrigin-Name: 551b848894c249cb3c9d237643d2ed53ffcb3b003d0cf3f797a535df1731ce39
* Internal refactoring of how sqlite3.wasm.xWrap() handles JS-to-C function ↵stephan2022-12-15
| | | | | pointer conversions, to enable similar conversions to be added more easily. FossilOrigin-Name: 10cfe3fae6f680d3ecc3b0afbbf628ce91e34e3757b19dd27c231f0daf44232a
* Rename the new peek/pokeF32() and peek/pokeF64() to peek/poke32f() and ↵stephan2022-12-14
| | | | | peek/poke64f() for consistency with related APIs and because they're easier on both the eyes and the fingers. FossilOrigin-Name: cc86f03ed698a071cd02ef3dfaba69092226bff20c917d662f808061627ad285
* Add convenience variants of sqlite3.wasm.peek/poke() for each numeric type ↵stephan2022-12-14
| | | | | to help reduce errors related to typos in the final argument (type-name strings). If wasm.xWrap.FuncPtrAdapter is called as a function, instead of a constructor, it now behaves as if it were called as a constructor (previously it threw an exception). FossilOrigin-Name: 14e3fc01b929fa3f9a2fdbd93deb4a8aad58c111d46369c772def0437152fa75
* Extend the sqlite3.wasm function pointer argument converter to be able to ↵stephan2022-12-13
| | | | | handle the "two-layered context" of sqlite3_create_collation() and friends and make use of FuncPtrAdapter to perform JS-to-WASM function conversion for them. FossilOrigin-Name: 0a60b7215e433f8c50027c70731b11e58d74c90ec5903e66ae42f9c98e40b044
* Revert part of [9386d6f63468] because the new automatic function pointer ↵stephan2022-12-12
| | | | | binding cannot properly track per-context function mappings when the context is more complex than a single context-type pointer. e.g. it is fine for sqlite3_trace_v2() but it breaks down with sqlite3_create_collation() because that one needs to use the collation name as part of the context key and we cannot sensibly do so with the current code. FossilOrigin-Name: 6cd21b79075367227b57bccf829cc7d4ccc7d7fbcfaed226b4c8e942ddae4eb6
* Move JS-to-C binding signatures from sqlite3-api-prologue.js to ↵stephan2022-12-12
| | | | | sqlite3-api-glue.js to allow for use of the new/experimental sqlite3.wasm.xWrap() feature which automatically binds JS functions to WASM/C as needed, which simplifies creation of bindings which take C function pointers. Reimplement sqlite3_exec(), sqlite3_create_collation(), sqlite3_progress_handler() to use this new feature. FossilOrigin-Name: 9386d6f634680b4e0fa5487c34c63acb29f0b7a6ae738b8f6164ad084a229b62
* Rework the internals of how argument/result types are converted to/from wasm ↵stephan2022-12-12
| | | | | in prep for attempting to support automated conversions of function pointer argument types. FossilOrigin-Name: 58052d8285cbc2aa8c4f8a9f5c2d33ac12014f6a70afbc93bc4ce5b9fd1f9ee5
* Refactor the sqlite3_value-to-JS conversion from an internal detail to ↵stephan2022-12-09
| | | | | sqlite3.capi.sqlite3_value_to_js() for use with routines like sqlite3_module::xFilter(). FossilOrigin-Name: f6dbf280f99809a80c99337e4c22a86dea7a35ae41ae9a69144c4502385a0a1f
* Rename the oft-used, verbose sqlite3.wasm.get/setMemValue() and ↵stephan2022-12-09
| | | | | get/setPtrValue() to peek/poke() and peek/pokePtr(). The old names are retained as aliases just in case any client code actually uses them, but they are now deprecated. FossilOrigin-Name: ad0a8139b0b025f8e9d2eca0c303557ef10fdfab8c8b65afb08c510a804073d5
* Micro-optimization in the oft-activated JS-to-WASM arguments conversion step.stephan2022-12-09
| | | FossilOrigin-Name: ee47e9b83ca668b37dc1d8e519048a635693cf33d9967a2d81ff0824b7eea4ba
* Export sqlite3_status() and sqlite3_stmt_status() to wasm. Expand the ↵stephan2022-12-09
| | | | | arg/return semantics of wasm.get/setPtrValue() and get/setMemValue() to simplify handling of multiple pointers. FossilOrigin-Name: e144fd5c88fa4151429a2fef3daf389588402e158267f0afa0dfd142527d76b9
* Rename wasm.cstringToJs() to wasm.cstrToJs() for consistency with other ↵stephan2022-12-06
| | | | | wasm.cstr... APIs. FossilOrigin-Name: cbf483ea0ba3e6dc08ad7ed654380f818544b4c3cedfdb8aa848a83298268ceb
* Add wasm.cArgvToJs() to support sqlite3_module::xConnect().stephan2022-12-06
| | | FossilOrigin-Name: c3ebdccf94d5e63c229bf91056c08052d78732e663334070ef3b0ef6fb4bfb8f
* Minor internal JS code/docs cleanups.stephan2022-12-06
| | | FossilOrigin-Name: 21331bdd36a91b07a687ffadce392dcf2ccd0fd824b35d9dd027d4289a40fc96
* Expose sqlite3_get/set_auxdata() to wasm. Minor test app CSS tweaks.stephan2022-12-05
| | | FossilOrigin-Name: 44659ad32a9fe6363badfc5dbb0bd51d6fb2ee1c8aa47b71e9cf3dbd631fde9e
* Export sqlite3_bind/value/result_pointer() to wasm. Add 'static-string' ↵stephan2022-12-05
| | | | | argument converter to support the lifetime requirements of bind/result_pointer()'s string argument. Correct an endless loop in wasm.cstrlen() when passed a non-C-string argument. FossilOrigin-Name: a94552434a657376d5ce1831de05c1b15fb153020848cd825fb0df413c3baa70
* Initial infrastructure for adding virtual table/table-valued function ↵stephan2022-12-05
| | | | | support to WASM. FossilOrigin-Name: c202d7a0398b9aabc2babba5c4c91a313f32bbf37549d419775642bb4aa3936a
* Rename wasm.xWrap.resultAdapter() X:free entries to X:dealloc for ↵stephan2022-12-03
| | | | | consistency with wasm.dealloc(). Add an undocumented feature to replace wasm.alloc/dealloc/realloc() with the C-standard allocators (after an allocator misuse led down a several-hour rabbit hole trying to discover a mis-free() violation). Related test updates. FossilOrigin-Name: d9807656f8a7c2a893d3f68ee5592f44826b8e999ae66f7d9000674b5c1b0207
* Expand "sqlite3_vfs*" JS-to-WASM function argument conversions to accept VFS ↵stephan2022-12-01
| | | | | names (JS strings) and capi.sqlite3_vfs instances. Implement sqlite3_js_vfs_create_file() to facilitate creation of file-upload features which store the file in VFS-specific storage (where possible, e.g. "unix" and "opfs" VFSes). Correct an argument type check in the SQLite3Error and WasmAllocError constructors. FossilOrigin-Name: e1009b16d351b23676ad7bffab0c91b373a92132eb855c9af61991b50cd237ed
* Globally replace '' with "" for empty JS strings to please C preprocessor.stephan2022-11-03
| | | FossilOrigin-Name: e92e1f42bef94a1df29f66b4111ebfde93eba3759bc5d5a9c95f714508851346
* Significant cleanups and expansion of the sqlite3.opfs utilities. Add ↵stephan2022-11-01
| | | | | oo1.DB.dbVfsName(). Add VFS name to worker1:open's arguments and result. FossilOrigin-Name: 86a341d7e061f946b39e8647ddd4743013b851b33ae9e6e755d8dbc53fba5286
* Add ext/wasm/module-symbols.html. Adjacent minor JS touchups.stephan2022-10-28
| | | FossilOrigin-Name: 24f12e681e06e3b71a6ac9c82255fe0270953a74c711405841f7e385eeafe874
* Expose sqlite3_randomness() to WASM and add a custom binding for it which ↵stephan2022-10-27
| | | | | can populate a JS byte array. Add WhWasmUtil.isPtr(). FossilOrigin-Name: 333e67076b4bc967bb543ef8e265c63f6e3498c38ac121a7d1eff4a1d7a71c63
* Add kvvfs tests to tester1.js. Fix a scopedAlloc() misuse in oo1.DB ctor ↵stephan2022-10-21
| | | | | caused by refactoring earlier this morning (and caught by these new tests). FossilOrigin-Name: 8e0f001ab76de6dbc17295b9085f7f61ce274c43f8c432ea4d2ec3153d248ff3
* Add timing info and OPFS sanity tests to tester1.jsstephan2022-10-21
| | | FossilOrigin-Name: 99915b0076422487cdd181a54e55694404fba13e4a540329b5ede9e2c9e12532
* Move the rest of testing1.js into tester1.js and eliminate the dependency on ↵stephan2022-10-13
| | | | | jaccwabyt_test.c. Extend the list of default config-related #defines in sqlite3-wasm.c and reorganize them for maintainability. FossilOrigin-Name: 4e2a8aff2dd4b6e148f45184e2523ebe47815257eca97fa3d32bcbf9625f0def
* Port the first 180-odd unit tests from testing1.* into the new tester1.*. ↵stephan2022-10-13
| | | | | Fix a stray-keystroke-induced typo which broke pstack.allocChunks(). FossilOrigin-Name: ef689e33e464829f5cbe4ca24a53d9dba59abe74d3d80a37a91b93a4eccccf2d
* Correct mismatched H1 tags in test code. Minor CSS tweaks.stephan2022-10-12
| | | FossilOrigin-Name: 4d8eb90a370054d4482c20637ab56f5e01f4d10215f2af4e35fb9a1f85ecb700
* OPFS VFS now lazily opens its sync access handle, as a step towards ↵stephan2022-10-03
| | | | | experimenting with relinquishing it during idle times to help avoid cross-tab and page-reload locking issues. FossilOrigin-Name: a984e1ba435731413a541f86c50232bc7d6e33aff6ba4cca90f89188e7b82a2c
* Partial revert of [a82e6faaa642] to remove the 'I' alias for 'j' wasm ↵stephan2022-10-03
| | | | | function signature letter. In hindsight, that change seems premature. FossilOrigin-Name: dcd46af9141f4edf816010923941a76d0edd3f18cfe429c52f599ad2a0d52651
* Minor JS API tweaks prompted by documenting them.stephan2022-10-03
| | | FossilOrigin-Name: a82e6faaa642b09d241232c4daa67134d4dfa24bf3ca3725740346ca5269b381
* js: implement a hand-written wrapper for sqlite3_create_function_v2() which ↵stephan2022-10-02
| | | | | converts, if necessary, JS-function-type args to WASM function wrappers. Replace DB.createFunction() impl with the new one. FossilOrigin-Name: 435ab33384017967e46f52b70bee851a85a28808990a0e58dd5288f606b89c9c