Hi

On Tue, Jul 5, 2016 at 4:21 PM, Thibault Raffaillac <
thibault.raffail...@inria.fr> wrote:

> Hi all,
>
> For a few months now I have been using IntegerArray and FloatArray with
> UFFI. They are pretty convenient since they reside in Internal memory space
> (unlike FFIExternalArray) yet you can pass them in a C function call with
> the "ByteArray" signature.
> Now I need the equivalent arrays for short, double words and IEEE 64bit
> double. Comment in
> Class>>variableWordSubclass:instanceVariableNames:classVariableNames:package:
> says Spur already supports them. From discussion with Guille it seems we
> just need new subclasses of BitsLayout (ByteLayout and WordLayout
> implemented so far).
>
> Question 1: What is the value of instanceSpecification for shorts and
> double-words?
>

I copy the comment of Behavior>>instSpec

*instSpec*
* "Answer the instance specification part of the format that defines what
kind of object*
* an instance of the receiver is.  The formats are*
* 0 = 0 sized objects (UndefinedObject True False et al)*
* 1 = non-indexable objects with inst vars (Point et al)*
* 2 = indexable objects with no inst vars (Array et al)*
* 3 = indexable objects with inst vars (MethodContext AdditionalMethodState
et al)*
* 4 = weak indexable objects with inst vars (WeakArray et al)*
* 5 = weak non-indexable objects with inst vars (ephemerons) (Ephemeron)*
* 6 = unused*
* 7 = immediates (SmallInteger, Character)*
* 8 = unused*
* 9 = 64-bit indexable*
* 10-11 = 32-bit indexable (Bitmap)*
* 12-15 = 16-bit indexable*
* 16-23 = 8-bit indexable*
* 24-31 = compiled methods (CompiledMethod)"*


>
> Question 2: Both IntegerArray and WordArray exist and refer to 32bit
> arrays, should there be a difference between the two?
>
> Yes.

IntegerArray has two specific accessing primitives to store and read raw
integers.

WordArray uses the normal accessing primitives.

Question 3: How will it fare with 64bit Spur? Does word refer to 32bit or
> 64bit then? Is WordArray/variableWordSubclass growing to 64bit? FloatArray
> too?
>

It depends.

ByteArray is a good name and ShortArray is good name, self-explanatory,
there is no discussion here.

Then it depends, at some place we use WordArray and DoubleWordArray, in
other we use LongArray and SixtyFourBitsIndexableArray... I'd go for
WordArray and DoubleWordArray, but I don't mind if one decides otherwise.

For Float, we changed the representation to be "SmallFloat64" and
"BoxedFloat64". We have no proper support for single precision float in
Pharo. We could consider renaming FloatArray to DoubleArray, Float64Array,
or something similar. I don't know.


> Cheers,
> Thibault
>
>

Reply via email to