RFR: 8292758: put support for UNSIGNED5 format into its own header file [v2]
John R Rose
jrose at openjdk.org
Fri Sep 2 00:08:09 UTC 2022
On Fri, 2 Sep 2022 00:04:17 GMT, John R Rose <jrose at openjdk.org> wrote:
>> Refactor code from inside of CompressedStream into its own unit.
>>
>> This code is likely to be used in future refactorings, such as JDK-8292818 (replace 96-bit representation for field metadata with variable-sized streams).
>>
>> Add gtests.
>
> John R Rose has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>
> - Merge branch 'master' of https://git.openjdk.org/jdk into compressed-stream
> - 8292758: put support for UNSIGNED5 format into its own header file
The new header file presents the encoding algorithm by means of templates.
The template arguments in general are:
- `ARY` - a logical base address for reads and writes of bytes
- `OFF` - an integral type (of any size or signed-ness) providing an offset to `ARY`
- `GET` and `SET` - function-like arguments (e.g., lambdas) which get or set bytes from an address logically of the form `a[i]` shaped like `ARY[OFF]`
- `GFN` a lambda used when the application requires on-the fly resizing of an output buffer (of type `ARY`)
Defaults are set in such a way that any C++ types that natively support `a[i]` can be fully inferred, including the get/set behaviors.
In addition, there are small "gadgets" for reading a series of ints from a buffer, writing a series to a buffer, and sizing a series (which is faster than writing or reading). These are not yet used. However, prototyping of further use cases for this compression (particularly, `FieldInfo`) makes it clear that these are repeated tasks that "canned" templates will help with.
-------------
PR: https://git.openjdk.org/jdk/pull/10067
More information about the serviceability-dev
mailing list