Skip to content

Conversation

@endaytrer
Copy link

I wrote simple Java bindings of CFLOBDD: mostly I want it to be a drop-in replacement for JDD, The API is nearly the same, with difference of some CFLOBDD-only properties, such as "level". This is done by two layers: one front-end layer provides JDD-like API, and one backend layer that adapts to the C-API in loaded shared library (also newly written). Also, I may further work on APIs for other Java BDD library, such as JavaBDD.

Instead of JNI, the Java bindings use java.lang.foreign APIs which is available since Java 22. This choice was done just for convenience, so it is not compatable for projects using older Java. In the future maybe I will consider JNI again.

As a side product, I also made pure C bindings for the used functions, and it is included by building a shared library for CFLOBDD. I also wrote a CMake building script that builds both the CFLOBDD shared library and CFLOBDD Java bindings.

To make this happen, several other changes were made:

  1. The hashing modsize of CFLOBDD substructures are changed from int to long, to meet the standards of Java hashCode;
  2. Add moving constructor and rvalue assignment operator override for ref_ptr and CFLOBDD, enabling the reference counted pointer to be moved safely to FFI without disturbing the RC.
  3. Some bug (typo) fixes related to enabling the compilation with PATH_COUNTING_ENABLED preprocessor variable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant