fix: split MeosLibrary into 4 public static sub-interfaces (ARM64/Windows/macOS fix)#12
Open
estebanzimanyi wants to merge 120 commits intoMobilityDB:mainfrom
Open
Conversation
…o run them & added .idea personal config files in the .gitignore
…n of temporal_to_tsequence (temporal.c) which was still given a string as the interpolation type instead of an integer & added TestLogger in order to trace the lifecycle of each test and the parameters used
…le & testShiftScale
…tInst has no interpolation but it used to be tested as a LINEAR one
… functions t(int,float)box_expand
…y geom_in, pgis_geography_in by geog_in, adapted ConversionUtils & TPoint files accordingly
…point_as_text now tspatial_as_text, tpoint_to_stbox now tspatial_to_stbox, tpoint_srid now tspatial_srid: tpoint_round, tpoint_start_value, tpoint_end_value left
… with a single instance or a discret sequence set of TGeogPoint/TGeomPoint, fixed assertion using a STEP print verification (Interp=Step
- Replace meos.h with v1.3 and add meos_geo.h - Update FunctionsExtractor and Generator to support new headers and types - Fix existing tests to match MEOS
…t values and output them in MF-JSON format
… such as csv and sql files
…into java + the resulting generated csv files
…tyDB, orchestrated with docker and jdbc
…nd how to run/troubleshoot them
… all MEOS C functions in functions.java
…inversed condition when sanitizing functions name
…d were causing a JVM crash with SIGSEGV: created a strategy adapted to each type of pointer to dereference or not accordingly
…ks multiple times and outputs the average of the performances
…osIoErrorBranchTest
…jmeos-core for the core code, deleted example programs/notebooks to move them in a new repository
A single flat JNR-FFI interface with 1685 methods exceeds the JVM
64 KB bytecode limit per method in its generated <clinit>()V proxy,
causing MethodTooLargeException on ARM64 / Windows / macOS.
Split into MeosLibraryPartA/B/C/D (≈ 421 methods each), each loaded
by a separate JNR-FFI proxy. The public static wrappers are updated
to call the correct proxy directly. The original MeosLibrary interface
is kept as a backward-compat shim (extends all four parts); its
INSTANCE field now points to a lightweight reflection delegate instead
of a direct JNR-FFI proxy.
Also removes junk files that should never have been committed:
- jar/JMEOS.jar (generated artifact)
- jmeos-core/src/libmeos.so (stray copy at wrong path; the
intentional bundled resource is under src/main/resources/lib/)
- *.class files (BuilderUtils.class, Pair.class)
- debug artifacts (intspanset_output.txt, time/test.java)
.gitignore extended to prevent recurrence.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
The single flat
MeosLibraryJNR-FFI interface (1685 methods) causes aMethodTooLargeExceptionon ARM64 / Windows / macOS: JNR-FFI generates aproxy whose
<clinit>()Vinitialises native dispatch for every method, and1685 methods exceeds the JVM 64 KB bytecode limit.
This PR fixes the issue by splitting the interface into four
public staticsub-interfaces (~421 methods each), each loaded by a separate JNR-FFI proxy.
Changes
jmeos-core/src/main/java/functions/functions.javaMeosLibraryPartA/B/C/D— fourpublic staticsub-interfaces (~421 methodseach); each backed by its own JNR-FFI proxy (
_meos_a/b/c/d), keeping everyproxy
<clinit>()Vwell under 64 KBpublic staticwrapper methods updated to call the correct proxydirectly (no reflection overhead on the hot path)
MeosLibraryretained as a backward-compat shim that extends all four parts;MeosLibrary.meosnow points to a lightweightjava.lang.reflect.Proxydelegate that routes calls via a pre-built dispatch map — existing callers
continue to work unchanged
public static(notprivate) so JNR-FFI'sAsmClassLoadercan load them without anIllegalAccessErrorCleanup (files that should not have been committed in PR #9):
jar/JMEOS.jar(generated artifact)jmeos-core/src/libmeos.so(stray copy; the intentional bundledresource remains at
jmeos-core/src/main/resources/lib/libmeos.so)*.classfiles (BuilderUtils.class,Pair.class)intspanset_output.txt,time/test.java).gitignoreto prevent recurrenceStacking
This PR is stacked on top of PR #9 (
JashanReel:fix-tests-using-docker) andshould be merged after that PR is cleaned up and landed.
Test plan
mvn test -pl jmeos-corepasses on Linux x86_64 (current CI)MethodTooLargeExceptionon ARM64 / macOS / Windows once PR JMEOS 1.3 #9 base is mergedMeosLibrary.meos.methodName()still works via the reflection delegateNotes for reviewer
The critical invariant is that sub-interfaces must be declared
public static(not
privateor package-private). JNR-FFI'sAsmClassLoader.defineClass()loads them as separate classes; a non-public inner interface causes
IllegalAccessErrorat proxy generation time.