[foreign-jextract] RFR: 8253290: Tweak jextract code to use new MemoryAddress::asSegmentRestricted [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Thu Sep 17 14:03:42 UTC 2020


> This fixes references to the now-removed MemorySegment::ofNativeRestricted(...).
> 
> The only tricky issue is in RunimeHelper - which has to create an unchecked segment for a global variable and,
> in doing so, it has to keep a reference of the lookup symbol in there, to prevent the library from being unloaded.
> 
> Since the new API doesn't have an explicit way to add an attachment, I've added a simple Runnable impl which wraps a
> symbol, and pass that as a no-op cleanup action to the segment.
> 
> For the records, I believe that creating segments for global vars is tricky enough that there should be a blessed
> (restricted) way to do that in the LibraryLookup.Symbol API.

Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:

  Renamed RunnableHolder to SymbolHolder

-------------

Changes:
  - all: https://git.openjdk.java.net/panama-foreign/pull/335/files
  - new: https://git.openjdk.java.net/panama-foreign/pull/335/files/e9b47df5..a3f11181

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=335&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=panama-foreign&pr=335&range=00-01

  Stats: 6 lines in 2 files changed: 0 ins; 0 del; 6 mod
  Patch: https://git.openjdk.java.net/panama-foreign/pull/335.diff
  Fetch: git fetch https://git.openjdk.java.net/panama-foreign pull/335/head:pull/335

PR: https://git.openjdk.java.net/panama-foreign/pull/335


More information about the panama-dev mailing list