apache / datasketches-memory

High performance native memory access for Java.
https://datasketches.apache.org
Apache License 2.0
118 stars 27 forks source link

Master tempfix #170

Closed leerho closed 1 year ago

leerho commented 1 year ago

While working on the Java 17 migration, I discovered a bug in memory in how regions were being handled. It only occurs in rare cases but it was a bug nonetheless. And in digging in to figure it out I decided I did not like the way the transitions were being handled between Native Order and Non-native Order, Memory to Buffer, Buffer to Memory, to duplicates and to regions. It was more complicated than it needed to be and the logic was spread all over the place making it really difficult to understand and debug. So I decided to byte-the-bullet and rewrite that portion of the code. Which, unfortunately affects nearly all the classes :(

The only changes to the API was to the base interface class (currently called BaseState), which held some common methods that applied to all the memory variations (heap, off-heap, m-maps and ByteBuffer resources, plus Regions, Buffers and Duplicates.). The central API classes: Memory, WritableMemory, Buffer and WritableBuffer were not affected at all. Within this BaseState class are the following API changes.

I don't want to do a major release on this, but if there is pushback, I am willing to add back getTypeByteOrder() and getRegionOffset() as redirects to the new names.

leerho commented 1 year ago

This is complaining that Java 11 is an invalid version. Not sure yet how to fix.

leerho commented 1 year ago

And "mvn clean test" runs OK locally.