Remove the JS-side SQLITE_WASM_DEALLOC sanity check which triggers the problem mentioned in [688c5c13d156] and [ae0196d86ee8], for reasons covered in the code comments, per discussion in [forum:e5b20e1feb|forum post e5b20e1feb].
FossilOrigin-Name: 65ff3200c6009a1649fc108d7ce36f5c014185ba46bbf98471ec86eaeb572656
This commit is contained in:
parent
a9e1e4edaf
commit
5d2a25b254
@ -26,17 +26,21 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
|
||||
if(0){
|
||||
/**
|
||||
This block inexplicably fails on Safari, per report at
|
||||
https://sqlite.org/forum/forumpost/e5b20e1feb. In its place,
|
||||
we instead add an unsightly snippet to
|
||||
sqlite3_wasm_enum_json() which emits the SQLITE_WASM_DEALLOC
|
||||
pointer as an integer.
|
||||
Please keep this block around as a maintenance reminder
|
||||
that we cannot rely on this type of check.
|
||||
|
||||
"The problem" with that approach is that in order to honor
|
||||
sqlite3.config.deallocExportName, we have to have the
|
||||
following loop (or something equivalent). Because we cannot
|
||||
(for Safari) do so, we are currently implicitly hard-coded to
|
||||
using sqlite3.config.deallocExportName==='sqlite3_free'.
|
||||
This block fails on Safari, per a report at
|
||||
https://sqlite.org/forum/forumpost/e5b20e1feb.
|
||||
|
||||
It turns out that what Safari serves from the indirect function
|
||||
table (e.g. wasm.functionEntry(X)) is anonymous functions which
|
||||
wrap the WASM functions, rather than returning the WASM
|
||||
functions themselves. That means comparison of such functions
|
||||
is useless for determining whether or not we have a specific
|
||||
function from wasm.exports. i.e. if function X is indirection
|
||||
function table entry N then wasm.exports.X is not equal to
|
||||
wasm.functionEntry(N) in Safari, despite being so in the other
|
||||
browsers.
|
||||
*/
|
||||
/**
|
||||
Find a mapping for SQLITE_WASM_DEALLOC, which the API
|
||||
@ -809,16 +813,9 @@ self.sqlite3ApiBootstrap.initializers.push(function(sqlite3){
|
||||
capi[e[0]] = e[1];
|
||||
}
|
||||
}
|
||||
/* Exporting SQLITE_WASM_DEALLOC via the wasm.ctype entries fails
|
||||
in Safari. One final thing to try: */
|
||||
capi.SQLITE_WASM_DEALLOC = wasm.exports.sqlite3_wasm_ptr_to_sqlite3_free();
|
||||
if(wasm.exports[sqlite3.config.deallocExportName]
|
||||
!== wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)){
|
||||
toss("Internal error: sqlite3.wasm.exports["+
|
||||
sqlite3.config.deallocExportName+"]",
|
||||
"is not the same pointer as SQLITE_WASM_DEALLOC.",
|
||||
"These must match in order to accommodate allocator-related",
|
||||
"API guarantees.");
|
||||
if(!wasm.functionEntry(capi.SQLITE_WASM_DEALLOC)){
|
||||
toss("Internal error: cannot resolve exported function",
|
||||
"entry SQLITE_WASM_DEALLOC (=="+capi.SQLITE_WASM_DEALLOC+").");
|
||||
}
|
||||
const __rcMap = Object.create(null);
|
||||
for(const t of ['resultCodes']){
|
||||
|
@ -464,12 +464,8 @@ const char * sqlite3_wasm_enum_json(void){
|
||||
/* SQLITE_STATIC/TRANSIENT need to be handled explicitly as
|
||||
** integers to avoid casting-related warnings. */
|
||||
out("\"SQLITE_STATIC\":0, \"SQLITE_TRANSIENT\":-1");
|
||||
#if 0
|
||||
/* This approach to exporting SQLITE_WASM_DEALLOC as a pointer to
|
||||
sqlite3_free fails in Safari. */
|
||||
outf(",\"SQLITE_WASM_DEALLOC\": %lld",
|
||||
(sqlite3_int64)(sqlite3_free));
|
||||
#endif
|
||||
} _DefGroup;
|
||||
|
||||
DefGroup(changeset){
|
||||
@ -1597,6 +1593,9 @@ int sqlite3_wasm_config_j(int op, sqlite3_int64 arg){
|
||||
return sqlite3_config(op, arg);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// Pending removal after verification of a workaround discussed in the
|
||||
// forum post linked to below.
|
||||
/*
|
||||
** This function is NOT part of the sqlite3 public API. It is strictly
|
||||
** for use by the sqlite project's own JS/WASM bindings.
|
||||
@ -1622,6 +1621,7 @@ SQLITE_WASM_KEEP
|
||||
void * sqlite3_wasm_ptr_to_sqlite3_free(void){
|
||||
return (void*)sqlite3_free;
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(__EMSCRIPTEN__) && defined(SQLITE_ENABLE_WASMFS)
|
||||
#include <emscripten/wasmfs.h>
|
||||
|
16
manifest
16
manifest
@ -1,5 +1,5 @@
|
||||
C Small\sperformance\sincrease\sin\sthe\ssymbol\shash\stable.
|
||||
D 2023-01-03T19:27:00.120
|
||||
C Remove\sthe\sJS-side\sSQLITE_WASM_DEALLOC\ssanity\scheck\swhich\striggers\sthe\sproblem\smentioned\sin\s[688c5c13d156]\sand\s[ae0196d86ee8],\sfor\sreasons\scovered\sin\sthe\scode\scomments,\sper\sdiscussion\sin\s[forum:e5b20e1feb|forum\spost\se5b20e1feb].
|
||||
D 2023-01-04T03:14:06.615
|
||||
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
|
||||
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
|
||||
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
|
||||
@ -503,7 +503,7 @@ F ext/wasm/api/post-js-footer.js cd0a8ec768501d9bd45d325ab0442037fb0e33d1f3b4f08
|
||||
F ext/wasm/api/post-js-header.js 47b6b281f39ad59fa6e8b658308cd98ea292c286a68407b35ff3ed9cfd281a62
|
||||
F ext/wasm/api/pre-js.c-pp.js b88499dc303c21fc3f55f2c364a0f814f587b60a95784303881169f9e91c1d5f
|
||||
F ext/wasm/api/sqlite3-api-cleanup.js 680d5ccfff54459db136a49b2199d9f879c8405d9c99af1dda0cc5e7c29056f4
|
||||
F ext/wasm/api/sqlite3-api-glue.js b7f8c82d18f4af3538ff062d52620859cbafdb315923445a6b57bd5a53964d8b
|
||||
F ext/wasm/api/sqlite3-api-glue.js 0a93e58aabf52b32ddccbb107a1fd4552f2505e103ab63396c4d0a0743704785
|
||||
F ext/wasm/api/sqlite3-api-oo1.js e9fba119e9b1716b3f731838ed1ab18741401bcf4c51d2a4a6e9d1d23cf9d771
|
||||
F ext/wasm/api/sqlite3-api-prologue.js 0b9b463db92881990ab6995c863c5968969da3d2a5029112037cbf425c9cb6b1
|
||||
F ext/wasm/api/sqlite3-api-worker1.js c9ef8865f072e61251260b218aa4ed614a21a25e9e3cc6f22acf81794d32fc0b
|
||||
@ -512,7 +512,7 @@ F ext/wasm/api/sqlite3-opfs-async-proxy.js 7795b84b66a7a8dedc791340709b310bb497c
|
||||
F ext/wasm/api/sqlite3-v-helper.js 6f6c3e390a72e08b0a5b16a0d567d7af3c04d172831853a29d72a6f1dd40ff24
|
||||
F ext/wasm/api/sqlite3-vfs-opfs.c-pp.js 66daf6fb6843bea615fe193109e1542efbeca24f560ee9da63375a910bb48115
|
||||
F ext/wasm/api/sqlite3-wasi.h 25356084cfe0d40458a902afb465df8c21fc4152c1d0a59b563a3fba59a068f9
|
||||
F ext/wasm/api/sqlite3-wasm.c ec402680e315b773b085458aba388c9c882b726f99bc56562d512de764c40daa
|
||||
F ext/wasm/api/sqlite3-wasm.c 76625a70937a8522d014ef686c32db5b53a3ee61850323f5c601d2ac39fe52fe
|
||||
F ext/wasm/api/sqlite3-worker1-promiser.js 0c7a9826dbf82a5ed4e4f7bf7816e825a52aff253afbf3350431f5773faf0e4b
|
||||
F ext/wasm/api/sqlite3-worker1.js 9d3d3dfc70bff8998c1d8ff6d881cf1c3d52468d635417f02796151fe6b31cd7
|
||||
F ext/wasm/batch-runner.html 4deeed44fe41496dc6898d9fb17938ea3291f40f4bfb977e29d0cef96fbbe4c8
|
||||
@ -2067,8 +2067,8 @@ F vsixtest/vsixtest.tcl 6a9a6ab600c25a91a7acc6293828957a386a8a93
|
||||
F vsixtest/vsixtest.vcxproj.data 2ed517e100c66dc455b492e1a33350c1b20fbcdc
|
||||
F vsixtest/vsixtest.vcxproj.filters 37e51ffedcdb064aad6ff33b6148725226cd608e
|
||||
F vsixtest/vsixtest_TemporaryKey.pfx e5b1b036facdb453873e7084e1cae9102ccc67a0
|
||||
P 284382d37850f469dc4bf3ab8efd2f20971554e897f1ba3e94d3f2f0c35d97d0
|
||||
R ab5178d0509e1eb88fa7af9a2e9e5d44
|
||||
U drh
|
||||
Z 4f8363fa871c6cb453dc54216172abff
|
||||
P a19597b4fd2530a89363992b9179f9f3f0621a6e3861a91324f29311aafe09b9
|
||||
R cf7736aed38ba8edc7ed369b784dbcd1
|
||||
U stephan
|
||||
Z 0d48cca09eb0bd8b01ad4e4900dbb440
|
||||
# Remove this line to create a well-formed Fossil manifest.
|
||||
|
@ -1 +1 @@
|
||||
a19597b4fd2530a89363992b9179f9f3f0621a6e3861a91324f29311aafe09b9
|
||||
65ff3200c6009a1649fc108d7ce36f5c014185ba46bbf98471ec86eaeb572656
|
Loading…
Reference in New Issue
Block a user