Skip to content

[work in progress] Arrays of value classes #1228

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

Closed
wants to merge 30 commits into from

Conversation

VladimirNik
Copy link
Contributor

Represent an array of T where T is value class:

class T(val param: X) extends AnyVal

with the instance of VCXArray, where X is underlying type of T if X is primitive type and Object otherwise. In the current version of Dotty arrays of value classes are represented with T[] .

The version in this pull request passes dotty test suite - runtime and compile time tests (checked based on 8af61ab Dotty version).

The work on this version is in progress. Current roadmap:

  1. ArrayWrapper, ArrayOps adaptation for new representation of arrays of value classes;
  2. Changes required for Fix #1167: Reduce the magic in Arrays.newRefArray. Implement multidimensional arrays #1188;
  3. Support for arrays of value classes with underlying type that is value class;
  4. Bug fixes.

Previous pull request: 63243ab (part of the code is reused in this pull request and included in ee203b2)

@VladimirNik
Copy link
Contributor Author

/rebuild

smarter and others added 23 commits June 2, 2016 22:01
For a value class V whose underlying type is U, instead of representing
an array of V as V[] on the JVM, we use our own class VCXArray where X
is "U" if U is a primitive type and is "Object" otherwise.

This avoids boxing when creating arrays but we still need to box and
unbox when using such an array in a generic position, this also breaks
reflection and makes it pretty hard to use an array of a value class
from Java or Scala 2.
VCParents and VCArrays are updated; changes in representation (VCPrototype.scala); updates for classTag processing (arrays of value classes, VCXCompanion); bug fixes
…/scala (their implementation should be updated for new representation of arrays of value classes)
…rray.make to make them compatible with new representation of arrays of value classes.
@felixmulder
Copy link
Contributor

See: #1558

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants