[Vm-dev] VM Maker: VMMaker.oscog-eem.1779.mcz

Eliot Miranda eliot.miranda at gmail.com
Fri Apr 8 14:31:46 UTC 2016


Hi Nicolas,



> On Apr 7, 2016, at 11:50 PM, Nicolas Cellier <nicolas.cellier.aka.nice at gmail.com> wrote:
> 
> 2016-04-08 2:26 GMT+02:00 <commits at source.squeak.org>:
>> 
>> Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
>> http://source.squeak.org/VMMaker/VMMaker.oscog-eem.1779.mcz
>> 
>> ==================== Summary ====================
>> 
>> Name: VMMaker.oscog-eem.1779
>> Author: eem
>> Time: 7 April 2016, 5:26:14.093395 pm
>> UUID: eb3139fc-9d6f-432c-83b9-099675dcb37d
>> Ancestors: VMMaker.oscog-eem.1778
>> 
>> Fix simulation of the LargeIntegersPlugin.  The issue is that interpreterProxy firstIndexableField: answers a CArray whose unitSize reflects the object's unit size, and becuase LargeIntegers are byte objects, the CArray is a byte accssor by default.  So add InterpreterPlugin>>firstIndexableField:as:, which uses cCoerce:to: to provide a CArray typed as requested, and use it everywhere the LargeIntegersPlugin takes the firstIndexableField of a LargeInteger, and cast to #'unsigned int *'.
>> 
>> Go some way to speed up the warppers by
>> a) improving CArray>at:[put:] to assume unitSize is a suitable power of two, and
>> b) add CFloatArray to access float or double
>> 
>> Later on we can add CUnsignedIntegerArray, as required.
>> 
>> 
>> N.B.  While this fixes simulation of the LargeIntegerPlugin there is still something wrong under simulation in whatever produces large fonts.  Start up the Squeak 5.0 release image with the "Squeak 5.0 Release Notes" text in huge letters in a workspace towards the front and you'll notice that in the simulator none of the large fonts are displayed, although the text from "Fast Become" works fine.
>> 
>> =============== Diff against VMMaker.oscog-eem.1778 ===============
>> 
...
>> Item was changed:
>>   ----- Method: Integer>>coerceTo:sim: (in category '*VMMaker-interpreter simulator') -----
>>   coerceTo: cTypeString sim: interpreter
>> 
>>         | unitSize |
>>         cTypeString last = $* ifTrue:  "C pointer"
>>                 [unitSize := cTypeString caseOf: {
>>                 ['char *'] -> [1].
>>                 ['short *'] -> [2].
>>                 ['int *'] -> [4].
>> +               ['float *'] -> [^CFloatArray basicNew interpreter: interpreter address: self unitSize: 4; yourself].
>> +               ['double *'] -> [^CFloatArray basicNew interpreter: interpreter address: self unitSize: 8; yourself].
>> -               ['long *'] -> [interpreter wordSize].
> 
> Hi Eliot,
> I presume you suppressed long * and do not need unsigned long * because they are handled in otherwise.
> But there's also no (unsigned) long long * / (u)sqLong *
> We never coerce to these types (or only inside cCode: []), or this is handled elsewhere?

It's just that the existing method didn't handle it.  Right now I have other priorities with Clément (better block model for Sista plus a proper register allocator) but...  
- it seems wrong that there are two cCoerce:to: implementations that differ; they should be the same
- they should be complete
- CArray can be a hierarchy so we can minimize the use of CPluggableAccessor
- we should bite the bullet and have byteAt: shortAt: long32At: long64At:  & longAt: agree on signedness both in the simulator and in C and provide signedByteAt: & unsignedByteAt: et al
- there should be tests other than just running the simulator
- the default implementation of firstIndexableField: in the object memory simulators that answers a CArray whose unit type depends on the underlying element size of the object is highly questionable given that the type of firstIndexableField: is void *
- we should choose either 'float *' et al or 'float*' et al, not both (I'm used to 'float *' et al) and slang should issue warnings for the alternative we reject.
- we have to choose whether char * is signed or not even if C compilers disagree; let's choose gcc's or clang's (hopefully they do agree)


>> -               ['float *'] -> [4].
>> -               ['double *'] -> [8].
>>                 ['unsigned *'] -> [4].
>>                 ['unsigned int *'] -> [4].
>> +               ['unsigned char *'] -> [1].
>> +               ['signed char *'] -> [1].
>> +               ['unsigned short *'] -> [2].
>> -               ['unsigned char *'] -> [4].
>> -               ['unsigned short *'] -> [4].
>>                 ['oop *'] -> [interpreter bytesPerOop].
>>                 }
>> +               otherwise: [interpreter wordSize].
>> -               otherwise: [ (cTypeString beginsWith: 'char') ifTrue: [1] ifFalse: [interpreter wordSize] ].
>>                 ^CArray basicNew
>>                         interpreter: interpreter address: self unitSize: unitSize;
>>                         yourself].
>> +       ^self  "C number (int, char, float, etc)"!
>> -       ^ self  "C number (int, char, float, etc)"!
>> 
>> Item was added:
>> + ----- Method: InterpreterPlugin>>firstIndexableField:as: (in category 'casting support') -----
>> + firstIndexableField: obj as: cType
>> +       <inline: true>
>> +       ^interpreterProxy cCoerce: (interpreterProxy firstIndexableField: obj) to: cType!
...
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160408/b3bf4021/attachment.htm


More information about the Vm-dev mailing list