[Vm-dev] VM Maker: VMMaker.oscog-nice.1790.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Apr 9 01:50:56 UTC 2016


Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.1790.mcz

==================== Summary ====================

Name: VMMaker.oscog-nice.1790
Author: nice
Time: 9 April 2016, 3:46:14.305 am
UUID: 97ba305c-3bf1-45ee-a4d2-eeea6a8f4b5a
Ancestors: VMMaker.oscog-cb.1789

Fix simulation of coerceTo:sim: - a CArrayAccessor behaves like a CArray (with 0-based index) but translates indices to 1-based for accessing an underlying (fake) Smalltalk object.

In case of CArray, we can directly access the interpreter memory so we don't need a CArrayAccessor anyway.

The only case where we use asCArrayAccessor is that of BallonArray where we simulate both a Smalltalk fake simArray and the interpreter memory.  We absolutely need to invoke BallonArray>>at:[put:] to be sure that both are maintained, and that's what the CArrayAccessor indirection does. #asSingleFLoatAccessor would bypass this mechanism and is thus not appropriate. Please notice the += -1 offset in #asCArrayAccessor in this case.

=============== Diff against VMMaker.oscog-cb.1789 ===============

Item was removed:
- ----- Method: CArray>>asCArrayAccessorUnitSize: (in category 'converting') -----
- asCArrayAccessorUnitSize: requiredUnitSize
- 	self assert: ptrOffset = 0.
- 	^CArrayAccessor on: (requiredUnitSize = unitSize
- 								ifTrue: [self]
- 								ifFalse: [self shallowCopy unitSize: requiredUnitSize])!

Item was added:
+ ----- Method: CArray>>asDoubleFloatAccessor (in category 'converting') -----
+ asDoubleFloatAccessor
+ 	^CFloatArray adoptInstance: (self shallowCopy unitSize: 8)!

Item was added:
+ ----- Method: CArray>>asSingleFloatAccessor (in category 'converting') -----
+ asSingleFloatAccessor
+ 	^CFloatArray adoptInstance: (self shallowCopy unitSize: 4)!

Item was changed:
  ----- Method: CArray>>coerceTo:sim: (in category 'converting') -----
  coerceTo: cTypeString sim: interpreterSimulator
  
  	^cTypeString caseOf: {
  		['int']				-> [self ptrAddress].
+ 		['float *']			-> [self asSingleFloatAccessor].
+ 		['double *']			-> [self asDoubleFloatAccessor].
+ 		['unsigned int *']	-> [self shallowCopy unitSize: 4; yourself].
+ 		['int *']				-> [self shallowCopy unitSize: 4; yourself].
- 		['float *']			-> [(self asCArrayAccessorUnitSize: 4) asFloatAccessor].
- 		['unsigned int *']	-> [(self asCArrayAccessorUnitSize: 4) asUnsignedIntAccessor].
- 		['int *']				-> [(self asCArrayAccessorUnitSize: 4) asIntAccessor].
  		['char *']			-> [self shallowCopy unitSize: 1; yourself].
  		['unsigned char *']	-> [self shallowCopy unitSize: 1; yourself].
  		['unsigned']			-> [self ptrAddress].
  		['sqInt']				-> [self ptrAddress].
  		['usqInt']			-> [self ptrAddress] }!

Item was removed:
- ----- Method: CObjectAccessor>>asUnsignedIntAccessor (in category 'converting') -----
- asUnsignedIntAccessor
- 
- 	^ self asPluggableAccessor
- 		atBlock: [:obj :index | obj unsignedIntAt: index]
- 		atPutBlock: [:obj :index :value | obj unsignedIntAt: index put: value]!



More information about the Vm-dev mailing list