Update some internal docs for the past two checkins. Add a way to dump out some debug info about the current JNI environment.

FossilOrigin-Name: ac9b8bb1e64450d980e2986084996549ae5c59e68c9f0c4c69539c239b64468b
This commit is contained in:
stephan
2023-07-31 10:22:34 +00:00
parent 452108b4fc
commit e2e696d11f
7 changed files with 52 additions and 32 deletions
+2 -1
View File
@@ -147,7 +147,8 @@ all: $(sqlite3-jni.dll)
test: $(SQLite3Jni.class) $(sqlite3-jni.dll)
$(bin.java) -ea -Djava.library.path=$(dir.bld.c) \
$(java.flags) -cp $(classpath) org.sqlite.jni.Tester1
$(java.flags) -cp $(classpath) \
org.sqlite.jni.Tester1 $(if $(test.flags),-- $(test.flags),)
$(package.jar): $(CLASS_FILES) $(MAKEFILE)
rm -f $(dir.src)/c/*~ $(dir.src.jni)/*~
+22 -19
View File
@@ -345,29 +345,22 @@ struct JniHookState{
};
/**
Per-(sqlite3*) state for bindings which do not have their own
finalizer functions, e.g. tracing and commit/rollback hooks. This
state is allocated as needed, cleaned up in sqlite3_close(_v2)(),
and recycled when possible. It is freed during sqlite3_shutdown().
Open questions:
- Do we need to do a (JNIEnv*) for the db and each set of binding
data (since they can(?) hypothetically be set via multiple JNIEnv
objects)?
Per-(sqlite3*) state for various JNI bindings. This state is
allocated as needed, cleaned up in sqlite3_close(_v2)(), and
recycled when possible. It is freed during sqlite3_shutdown().
*/
typedef struct PerDbStateJni PerDbStateJni;
struct PerDbStateJni {
JNIEnv *env /* The associated JNIEnv handle */;
sqlite3 *pDb /* The associated db handle */;
jobject jDb /* a global ref of the object which was passed to
sqlite3_open(_v2)(). We need this in order to have an
object to pass to sqlite3_collation_needed()'s
callback, or else we have to dynamically create one
for that purpose, which would be fine except that it
would be a different instance (and maybe even a
different class) than the one the user expects to
receive. */;
sqlite3 *pDb /* The associated db handle */;
jobject jDb /* A global ref of the object which was passed to
sqlite3_open(_v2)(). We need this in order to have
an object to pass to sqlite3_collation_needed()'s
callback, or else we have to dynamically create one
for that purpose, which would be fine except that
it would be a different instance (and maybe even a
different class) than the one the user may expect
to receive. */;
PerDbStateJni * pNext /* Next entry in the available/free list */;
PerDbStateJni * pPrev /* Previous entry in the available/free list */;
JniHookState busyHandler;
@@ -2369,6 +2362,16 @@ JDECL(jbyteArray,1value_1text16be)(JENV_JSELF, jobject jpSVal){
return value_text16(SQLITE_UTF16BE, env, jpSVal);
}
JDECL(void,1do_1something_1for_1developer)(JENV_JSELF){
MARKER(("\nVarious bits of internal info:\n"));
#define SO(T) printf("sizeof(" #T ") = %u\n", (unsigned)sizeof(T))
SO(void*);
SO(JniHookState);
SO(PerDbStateJni);
SO(S3Global);
SO(JNIEnvCache);
#undef SO
}
////////////////////////////////////////////////////////////////////////
+8
View File
@@ -1603,6 +1603,14 @@ JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1value_1subtype
JNIEXPORT jint JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1shutdown
(JNIEnv *, jclass);
/*
* Class: org_sqlite_jni_SQLite3Jni
* Method: sqlite3_do_something_for_developer
* Signature: ()V
*/
JNIEXPORT void JNICALL Java_org_sqlite_jni_SQLite3Jni_sqlite3_1do_1something_1for_1developer
(JNIEnv *, jclass);
#ifdef __cplusplus
}
#endif
@@ -779,6 +779,13 @@ public final class SQLite3Jni {
public static native int sqlite3_shutdown();
/**
This is NOT part of the public API. It exists solely as a place
to hook in arbitrary C-side code during development and testing
of this library.
*/
public static native void sqlite3_do_something_for_developer();
//////////////////////////////////////////////////////////////////////
// SQLITE_... constants follow...
+2 -1
View File
@@ -929,7 +929,8 @@ public class Tester1 {
testUpdateHook();
//testSleep();
if(liArgs.indexOf("-v")>0){
listBoundMethods();
sqlite3_do_something_for_developer();
//listBoundMethods();
}
final long timeEnd = System.nanoTime();
outln("Tests done. Metrics:");
+10 -10
View File
@@ -1,5 +1,5 @@
C Refactor\sthe\sbusy-handler-specific\sJNI\shook\stype\sto\suse\sthe\sgeneric\shook\stype.
D 2023-07-31T10:08:36.744
C Update\ssome\sinternal\sdocs\sfor\sthe\spast\stwo\scheckins.\sAdd\sa\sway\sto\sdump\sout\ssome\sdebug\sinfo\sabout\sthe\scurrent\sJNI\senvironment.
D 2023-07-31T10:22:34.406
F .fossil-settings/empty-dirs dbb81e8fc0401ac46a1491ab34a7f2c7c0452f2f06b54ebb845d024ca8283ef1
F .fossil-settings/ignore-glob 35175cdfcf539b2318cb04a9901442804be81cd677d8b889fcc9149c21f239ea
F LICENSE.md df5091916dbb40e6e9686186587125e1b2ff51f022cc334e886c19a0e9982724
@@ -230,10 +230,10 @@ F ext/fts5/tool/showfts5.tcl d54da0e067306663e2d5d523965ca487698e722c
F ext/icu/README.txt 7ab7ced8ae78e3a645b57e78570ff589d4c672b71370f5aa9e1cd7024f400fc9
F ext/icu/icu.c c074519b46baa484bb5396c7e01e051034da8884bad1a1cb7f09bbe6be3f0282
F ext/icu/sqliteicu.h fa373836ed5a1ee7478bdf8a1650689294e41d0c89c1daab26e9ae78a32075a8
F ext/jni/GNUmakefile 56a014dbff9516774d895ec1ae9df0ed442765b556f79a0fc0b5bc438217200d
F ext/jni/GNUmakefile 72a1549aa5ef6fd21b7af58baccd512147d0912ec85963da46c3aa011b6f3450
F ext/jni/README.md c0e6e80935e7761acead89b69c87765b23a6bcb2858c321c3d05681fd338292a
F ext/jni/src/c/sqlite3-jni.c 9dc18b6eec43132aa9a5001bc12ddd29c69513a4c4d04717b4131a16b6782906
F ext/jni/src/c/sqlite3-jni.h 28def286ee305c1c89a43ac5918a6862d985d0534f7ccbbd74df4885d3918b73
F ext/jni/src/c/sqlite3-jni.c 2dd0c3c6d194f0283233da76ac4b62d877d5bc2bdbbd428d26ff3d481ef93bd7
F ext/jni/src/c/sqlite3-jni.h 74aaf87e77f99857aa3afc013517c934cbc2c16618c83d8f5d6294351bc8e7b1
F ext/jni/src/org/sqlite/jni/BusyHandler.java 1b1d3e5c86cd796a0580c81b6af6550ad943baa25e47ada0dcca3aff3ebe978c
F ext/jni/src/org/sqlite/jni/Collation.java 8dffbb00938007ad0967b2ab424d3c908413af1bbd3d212b9c9899910f1218d1
F ext/jni/src/org/sqlite/jni/CollationNeeded.java ebc7cd96d46a70daa76016a308e80f70a3f21d3282787c8d139aa840fdcb1bd7
@@ -243,8 +243,8 @@ F ext/jni/src/org/sqlite/jni/OutputPointer.java c7868f1f4ad63435ee44d409377df7dd
F ext/jni/src/org/sqlite/jni/ProgressHandler.java 5979450e996416d28543f1d42634d308439565a99332a8bd84e424af667116cc
F ext/jni/src/org/sqlite/jni/RollbackHook.java b04c8abcc6ade44a8a57129e33765793f69df0ba909e49ba18d73f4268d92564
F ext/jni/src/org/sqlite/jni/SQLFunction.java 663a4e479ec65bfbf893586439e12d30b8237898064a22ab64f5658b57315f37
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java 829a6409d6fa5e82b39d85df5f14643c93dff383978ccbf35dc4af3ba29b6e62
F ext/jni/src/org/sqlite/jni/Tester1.java 1690172fccafbf8d8170b55b950003db182265c26dbb5a510122ec46a44d2611
F ext/jni/src/org/sqlite/jni/SQLite3Jni.java dfc1cf977c3c56e2826a7c0f3050b2a9af12a05c2b6cad0a968c7f8d2efa4ced
F ext/jni/src/org/sqlite/jni/Tester1.java 0ef7c15ff5f9bbed4069c46c4f555023f6b280ac57ba71fb463caeaa473a8611
F ext/jni/src/org/sqlite/jni/Tracer.java c2fe1eba4a76581b93b375a7b95ab1919e5ae60accfb06d6beb067b033e9bae1
F ext/jni/src/org/sqlite/jni/UpdateHook.java e58645a1727f8a9bbe72dc072ec5b40d9f9362cb0aa24acfe93f49ff56a9016d
F ext/jni/src/org/sqlite/jni/ValueHolder.java f022873abaabf64f3dd71ab0d6037c6e71cece3b8819fa10bf26a5461dc973ee
@@ -2071,8 +2071,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 02c1d3b6501fedf3d6e6d1ca60699df268522182c5ba3b49ae8f4691499ef0fc
R 5b96073cb268292054640619b4e4117b
P d9efdc6dd20a34bfdaad5d4bf8e67cce7e35238299eb91e4459d59fda11978a6
R 34310ff83ce4e2977491819bd2bf34a0
U stephan
Z 2c77c8dd9c75c9f80fb562e45a42818f
Z 868da2f09fceab4d77e542bbc096ca63
# Remove this line to create a well-formed Fossil manifest.
+1 -1
View File
@@ -1 +1 @@
d9efdc6dd20a34bfdaad5d4bf8e67cce7e35238299eb91e4459d59fda11978a6
ac9b8bb1e64450d980e2986084996549ae5c59e68c9f0c4c69539c239b64468b