Track PostgreSQL's changes to stack base access. #67
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
set_stack_base() and restore_stack_base() were added in preference to
direct access to stack_base_ptr (for 9.2, backpatched into 9.1.4,
9.0.8, 8.4.12, and 8.3.19). This adapts PL/Java to that new API so PostgreSQL
doesn't have to keep the old one around forever.
The new style requires miscadmin.h to be included
in those source files that use the STACK_BASE_PUSH / STACK_BASE_POP
macros (there is so much in miscadmin.h, I did not want to add it in
pljava.h and have it processed everywhere).
Also added example ThreadTest.java just to exercise the new logic.
However, if enabled to run from the deployment descriptor, it does
deadlock; apparently PG -> J -> (otherthread PG) works, but the deeper
PG -> J -> PG -> J -> (otherthread PG) does not, and I suspect it's
because of the JNI warning against mispairing bytecode monitorenters with
JNI monitorexits. But that is what the code has done for years now, so
if nothing has been reported, there must not be high demand for that use
pattern.