Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

openjdk8/vectors/simple/20230905a #625

Open
wants to merge 36 commits into
base: master
Choose a base branch
from

Conversation

easye
Copy link
Collaborator

@easye easye commented Sep 5, 2023

Overhaul of underlying sequence code starting with simple-vector

Use openjdk8 library to greater effect: java.nio.Buffer, java.util.array build copy, fill, replace functions.

A work in progress…

Supersedes #624.

--

Previous work using generics didn't really pan out. Use strategy of single class with switch on Java enumeration to bring code-paths "closer" together.

Notes on previous approach:

*** Use of generics doesn't seem to help implementation BasicVectorBuffer

  1. One has to "record" the specialization via adding the class to the
    constructor anyways.

  2. The parameterized type can't be used as discriminator type for
    different functions by arguments, as type erasure makes things an
    Object anyways.

@easye easye force-pushed the openjdk8/vectors/simple/20230905a branch from 3dff6fc to afae575 Compare September 9, 2023 07:48
easye added 29 commits November 21, 2023 08:19
(INCOMPLETE) Start of exploration on simplifying and improving support
for sequences, vectors, and arrays by using generics and functions
shipped as part of openjdk8.

Goals:

1)  Simplify class structure with parameterized types

2)  Use openjdk8 methods like Arrays.fill(), sort() et. al.

3)  Reduce memory use for "oversized" buffers

4)  Optimize speed of basic operations

TODO need some benchmarks to test before/after
INCOMPLETE: after finishing implementation, needs to be wired into
MAKE-ARRAY to be useful.
TODO:  wire getDescription() for our type menagerie
Using the BuiltinClass hierarchy causes problems, so getDescription()
is one way to indicate what implementation class is actually handling
a specialization of sequence types.
It should work, as it references the upper-case operators, which
should thunk down to the AREF, etc. methods in BasicVectorBuffer, but
I could be wrong about the inheritance.
This doesn't seem to help anything.
@easye easye force-pushed the openjdk8/vectors/simple/20230905a branch from 4c3adfb to b9164fa Compare November 21, 2023 22:27
easye added a commit to easye/slime that referenced this pull request Nov 30, 2023
Java bytes are signed, which means that accessing such a value from
Lisp should be converted into a negative value between [-127 0) for
bytes with a the high bit set [128 255).  The in-progress changes to
use unsigned-byte currently inadvertantly "fixes" direct use of such
values to set places in UNSIGNED-BYTE arrays.

<armedbear/abcl#625>
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