Commit Graph

192 Commits

Author SHA1 Message Date
Chris Vest
a2d49fed3e Bring slice and bifurcate methods together
They are conceptually related.
2021-04-27 10:00:27 +02:00
Chris Vest
7ac7655e87
Merge pull request #49 from netty/send-instanceof
Rename Deref.isInstanceOf to referentIsInstanceOf
2021-04-27 09:59:27 +02:00
Chris Vest
2decac081a Rename Deref.isInstanceOf to referentIsInstanceOf
Motivation:
Derefs are not necessarily their referents.
This is the case for Send, for instance.

Modification:
The Deref.isInstanceOf method is renamed to referentIsInstanceOf.
And a Send.isSendOf method has been added, that simplifies the check for sends, since it could be the case that one also needs to check if the object in question is also a Send instance.

Result:
Cleaner code that is easier to read, when working with Sends.

This fixes https://github.com/netty/netty-incubator-buffer-api/issues/46
2021-04-26 18:33:52 +02:00
Chris Vest
b541a20b4c
Merge pull request #50 from netty/panama-update
Update APIs with the latest project-panama changes
2021-04-26 18:33:14 +02:00
Chris Vest
ca864c9af4 Only upload the artifacts in the target directory
This makes failed builds complete a lot faster, but we won't have the OpenJDK or Netty files for failed builds.
2021-04-26 17:27:31 +02:00
Chris Vest
b396252682 Update APIs with the latest project-panama changes 2021-04-26 17:08:40 +02:00
Chris Vest
9c87dc8208
Merge pull request #43 from netty/build-test-reports
Add a build step that uploads surefire test reports
2021-04-14 13:42:45 +02:00
Chris Vest
220bbe816b
Merge pull request #39 from netty/unsafe-impl
UnsafeBuffer implementation, based on sun.misc.Unsafe
2021-04-14 12:39:27 +02:00
Chris Vest
4ddd194b91 Add a build step that uploads surefire test reports
Motivation:
When a build fails, the number one priority is figuring out why.
Having surefire test reports readily available on the Github Actions page will make this easier.

Modification:
Add a build step that uploads surefire test reports and attaches them as a check to the PR.

Result:
Easier to diagnose test failures on PRs.
2021-04-14 12:11:14 +02:00
Chris Vest
fdc59cc43c Break up the monolithic BufferTest into multiple test classes
Then run those tests in independent surefire forks.
This should allow Maven to hold on to less test metadata, and cope better with the large number of tests.
2021-04-14 11:44:58 +02:00
Chris Vest
55348fb660 Give more memory to surefire when running the full test suite
There are so many tests now that their metadata takes up a considerable amount of memory.
2021-04-13 15:18:14 +02:00
Chris Vest
26f8bae997 Capture full container output on build failures 2021-04-09 10:15:00 +02:00
Chris Vest
99efb7dab9 Fix compilation error after rebase 2021-04-08 21:10:17 +02:00
Chris Vest
4ed2c59e39 Revert: Try being less edgy with the Fedora image
It seems to be an upstream compilation error in OpenJDK.
2021-04-08 14:44:58 +02:00
Chris Vest
42e05771dd Try being less edgy with the Fedora image 2021-04-08 14:44:58 +02:00
Chris Vest
fd4c051573 Upload whole working directory on build failure
This should help debug JVM crashes.
2021-04-08 14:44:58 +02:00
Chris Vest
fb7279e82f Fix more test failures for UnsafeBuffer 2021-04-08 14:44:58 +02:00
Chris Vest
1fe8abecfa Fix JVM crashes and a number of test failures
Still more test failures left, but getting close now.
2021-04-08 14:44:58 +02:00
Chris Vest
c73dd07384 UnsafeBuffer implementation, based on sun.misc.Unsafe
Motivation:
When Unsafe is available, we can supposedly do certain things faster than when it is not.

Modification:
Add a Buffer implementation that take advantage of sun.misc.Unsafe.
It has not yet been verified if this is faster in any way than, say the ByteBuffer implementation or the MemorySegment implementation.

Result:
Another Buffer implementation that can be used when Unsafe is available.
2021-04-08 14:44:58 +02:00
Chris Vest
e7f7335804
Merge pull request #42 from netty/fix-after-refactoring
Update code to support bleeding edge MemorySegment APIs after the latest refactoring
2021-04-08 14:18:53 +02:00
Chris Vest
a3dfaf535d Fix test sample filtering and disable really slow tests 2021-04-08 11:08:09 +02:00
Chris Vest
7fda986d2c Make CleanerTests faster by reducing iteration count 2021-04-07 17:43:51 +02:00
Chris Vest
987a398700 Fix native memory leak bug
Motivation:
The untethered memory allocated by ensureWritable in a direct MemorySegment based non-pooled Buffer would be allocated without having a Cleaner attached to its ResourceScope.
This could cause that memory to leak if the Buffer instance was cast aside.

Modification:
ManagedBufferAllocator now makes sure to attach a cleaner to the buffer and its memory segment, when allocating untethered memory.

Result:
The BufferTest$CleanerTests now pass.
2021-04-07 17:17:35 +02:00
Chris Vest
ab45a7b053 Fix (some) failing tests
Also introduce test sampling, so when the BufferTest is running from an IDE, only 3% of the tests will actually run.

The Maven build runs all tests.
2021-04-07 16:19:35 +02:00
Chris Vest
513cef1c1e Update code to support bleeding edge MemorySegment APIs after the latest refactoring 2021-04-07 14:28:05 +02:00
Chris Vest
2e162c9ab0
Merge pull request #40 from netty/fix-jdk-branch
Use the memaccess+abi branch of panama-foreign
2021-04-07 11:51:55 +02:00
Chris Vest
da2acfd946 Use the memaccess+abi branch of panama-foreign
Motivation:
The jextract branch is currently suffering from upstream compilation
errors.
And we don't need jextract - memaccess+abi is enough.

Modification:
Avoid checking out the jextract branch of panama by default, and instead
explicitly check out the foreign-memaccess+abi branch when we clone the
JDK.

Result:
Our build should now be able to proceed again.
2021-04-06 16:54:32 +02:00
Chris Vest
3e6eceb58a Make it possible to run all tests in Intellij as well
The previous set-up was only working out for Maven.
2021-03-24 11:21:00 +01:00
Chris Vest
0ed5575fb4 Simplify recovery code for memory segment based buffers 2021-03-19 17:43:05 +01:00
Chris Vest
824d3e0137
Merge pull request #37 from netty/bytebuffer-impl
Add a ByteBuffer based implementation of Buffer
2021-03-19 17:31:10 +01:00
Chris Vest
66fbc44d27 Update docker layer cache workflow thing 2021-03-19 17:23:48 +01:00
Chris Vest
1bf9429fbf Fix warning printed at test time 2021-03-19 17:23:02 +01:00
Chris Vest
56a131a4ae Fix test-compile 2021-03-19 13:55:53 +01:00
Chris Vest
eebdae8102 Make sure checkstyle dependencies are in the docker layer cache 2021-03-19 11:58:25 +01:00
Chris Vest
6a6ecde5e2 Use release version of Netty build 2021-03-19 10:28:39 +01:00
Chris Vest
ff66723248 Make test-compilation and test-running pass
The netty-buffer test-jar dependency was causing some problems, but this works around that.
2021-03-18 16:53:14 +01:00
Chris Vest
95709828bf Add a ByteBuffer based implementation of Buffer
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.
2021-03-18 15:18:22 +01:00
Chris Vest
0272b1cf84
Merge pull request #36 from netty/rc-thread-safety
Allow slices to obtain ownership when parent is closed
2021-03-16 21:27:46 +01:00
Chris Vest
de305bd6b9 Align slice sendability of composite buffers with that of non-composite buffers
This means we no longer need to have tests that are parameterised over non-sliced buffers.
2021-03-16 17:22:41 +01:00
Chris Vest
d40989da78 Add toString implementations to all Drop implementations
This is helpful when debugging.
2021-03-16 17:20:35 +01:00
Chris Vest
0ccb34ca08 Fix failing ByteBufAdaptorTests and increase adaptor compatibility 2021-03-16 12:11:29 +01:00
Chris Vest
1f4234dfb5 Fix checkstyle line length 2021-03-15 16:59:42 +01:00
Chris Vest
253b6cb919 Allow slices to obtain ownership when parent is closed
Motivation:
It is kind of a weird internal and hidden state, that slices were special.
For instance, slices could not be sent, and they could never obtain ownership.
This means buffers from slices behaved differently from allocated buffers.
In doing so, they violated both the principle that magic should stay hidden, and the principle of consistent behaviour.

Modification:
- The special reference-counting drop implementation that was added to support bifurcation, has been renamed to ArcDrop (for atomic reference counting).
- The ArcDrop is then used throughout the MemSegBuffer implementation to account for every instance where multiple buffers reference the same memory, e.g. slices and the like.
- Borrows of a buffer is then the sum of borrows from the buffer itself, and its ArcDrop.
- Ownership is thus tied to both the buffer itself being owned, and the ArcDrop being in an owned state.
- SizeClassedMemoryPool is changed to pool recoverable memory instead of sends, because the sends could come from slices.
- We also take care to keep around a "base" memory segment, so that we don't return memory segment slices to the memory pool (doing so would leak the memory from the parent segment that is not part of the slice).
- CleanerPooledDrop now keeps a weak reference to itself, rather than the buffer, which is more correct anyway, but now also required because we cannot rely on the buffer reference the cleaner was created with.
- The CleanerPooledDrop now takes care to drop the buffer that is actually passed to it, rather than what it was referencing from some earlier point.
- MemoryManager can now disclose the size of recoverable memory, so that SizeClassedMemoryPool can pick the correct size pool to return memory to. It cannot rely on the passed down buffer instance for this, because that buffer might have been a slice.

Result:
It is now possible for slices to obtain ownership when their parent buffer is closed.
2021-03-15 16:42:56 +01:00
Chris Vest
374b0524d8
Merge pull request #35 from netty/more-examples
Port over more Netty examples
2021-03-10 17:18:49 +01:00
Chris Vest
d98e80b9fe Fix build by adding missing Fedora packages
These are required now that we build a complete distribution of Netty,
instead of just a small selection of Netty modules.
2021-03-10 15:06:23 +01:00
Chris Vest
f775e2cf97 Get the last ByteBufAdaptor tests passing 2021-03-09 16:48:33 +01:00
Chris Vest
2dee6f8516 Fix bounds checking bugs when setting bytes
These should not take the read offset into account.
2021-03-09 16:16:38 +01:00
Chris Vest
da70f29ff4 Fix numerous bugs in the ByteBufAdaptor 2021-03-09 12:04:57 +01:00
Chris Vest
45074e4749 Try to speed up BufferTest with more parameter memoization and parallel execution 2021-03-09 12:03:33 +01:00
Chris Vest
56bfa22d4a Align Buffer.get* bounds checks with their documented behaviour
The get* methods bounds checking accesses between 0 and the write offset, and the tests were confirming this behaviour.

This was wrong because it is not symmetric with the set* methods, which bounds check between 0 and the capacity, and does not modify the write offset.

The tests and methods have been updated so the get* methods now bounds check between 0 and the capacity.
2021-03-09 12:02:46 +01:00