Skip to content
This repository has been archived by the owner on Dec 12, 2022. It is now read-only.

Add a ByteBuffer based implementation of Buffer #37

Merged
merged 7 commits into from Mar 19, 2021
Merged

Conversation

chrisvest
Copy link
Collaborator

Motivation:
We need a new implementation of our new API that supports Java 11, since that is what Netty 5 will most likely baseline on.
We also need an implementation that does not rely on Unsafe.
This leaves us with ByteBuffer as the underlying currency of memory.

Modification:

  • Add a NioBuffer implementation and associated supporting classes.
  • The entry-point for this is a new MemoryManagers API, which is used to pick the implementation and provide the on-/off-heap MemoryManager implementations.
  • Add a mechanism to configure/override which MemoryManagers implementation to use.
  • The MemoryManagers implementations are service-loadable, so new ones can be discovered at runtime.
  • The existing MemorySegment based implementation also get a MemoryManagers implementation.
  • Expand the BufferTest to include all combinations of all implementations. We now run 360.000 tests in BufferTest.
  • Some common infrastructure, like ArcDrop, is moved to its own package.
  • Add a module-info.java to control the service loading, and the visibility in the various packages.
  • Some pom.xml file updates to support our now module based project.

Result:
We have an implementation that should work on Java 11, but we currently don't build or test on 11.
More work needs to happen before that is a reality.

Motivation:
We need a new implementation of our new API that supports Java 11, since that is what Netty 5 will most likely baseline on.
We also need an implementation that does not rely on Unsafe.
This leaves us with ByteBuffer as the underlying currency of memory.

Modification:
- Add a NioBuffer implementation and associated supporting classes.
- The entry-point for this is a new MemoryManagers API, which is used to pick the implementation and provide the on-/off-heap MemoryManager implementations.
- Add a mechanism to configure/override which MemoryManagers implementation to use.
- The MemoryManagers implementations are service-loadable, so new ones can be discovered at runtime.
- The existing MemorySegment based implementation also get a MemoryManagers implementation.
- Expand the BufferTest to include all combinations of all implementations. We now run 360.000 tests in BufferTest.
- Some common infrastructure, like ArcDrop, is moved to its own package.
- Add a module-info.java to control the service loading, and the visibility in the various packages.
- Some pom.xml file updates to support our now module based project.

Result:
We have an implementation that should work on Java 11, but we currently don't build or test on 11.
More work needs to happen before that is a reality.
@chrisvest
Copy link
Collaborator Author

Draft for the time being because I think we need some Netty changes before we can access the AbstractByteBufTest at test-compile time.

pom.xml Outdated Show resolved Hide resolved
The netty-buffer test-jar dependency was causing some problems, but this works around that.
@chrisvest chrisvest marked this pull request as ready for review March 19, 2021 09:29
These two are really only needed for test-compile, but the maven-compiler-plugin cannot express that
-->
<arg>--patch-module</arg>
<arg>io.netty.buffer=${io.netty:netty-buffer:test-jar:tests}</arg>
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be placed in compilerArgs instead of the various testCompiler* configurations, because the latter cannot correctly handle space-separated argument-value pairs.

This is a maven-compiler-plugin limitation, that apache/maven-compiler-plugin#27 will hopefully solve.

@chrisvest chrisvest merged commit 824d3e0 into main Mar 19, 2021
@chrisvest chrisvest deleted the bytebuffer-impl branch March 19, 2021 16:31
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants