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

commits at source.squeak.org commits at source.squeak.org
Mon Oct 22 19:38:22 UTC 2018


Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2468.mcz

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

Name: VMMaker.oscog-eem.2468
Author: eem
Time: 22 October 2018, 12:37:58.940543 pm
UUID: cd788ac3-2314-48ce-a656-f4cd6c2935ae
Ancestors: VMMaker.oscog-eem.2467

Plugins:
BalloonEngine & simulation.  Clean up primitiveInitializeBuffer.  Make some initial fixes to BalloonArray (the simulation of the engine's work buffer).  I have other fish to fry right now but this is a stab in the right direction.

=============== Diff against VMMaker.oscog-eem.2467 ===============

Item was changed:
  CArray subclass: #BalloonArray
+ 	instanceVariableNames: 'simArray simOffset'
- 	instanceVariableNames: 'simArray'
  	classVariableNames: ''
  	poolDictionaries: ''
  	category: 'VMMaker-InterpreterSimulation'!
  
  !BalloonArray commentStamp: '<historical>' prior: 0!
  BalloonArray keeps a shadow copy of its raw memory data in a Smalltalk array.  This allows support for C's inhomogeneous access, returning floats where Floats were stored, and negative ints where they were stored.  This ruse only works, of course where we have control over all the access.!

Item was added:
+ ----- Method: BalloonArray>>+= (in category 'pointer arithmetic') -----
+ += increment
+ 
+ 	super += increment.
+ 	simOffset := simOffset + (increment / unitSize)!

Item was added:
+ ----- Method: BalloonArray>>-= (in category 'pointer arithmetic') -----
+ -= increment
+ 
+ 	super -= increment.
+ 	simOffset := simOffset - (increment / unitSize)!

Item was changed:
  ----- Method: BalloonArray>>at: (in category 'memory access') -----
  at: index
  	| value |
+ 	value := simArray at: index + simOffset.
- 	value := simArray at: index+1.
  	"Debug only..."
  	value ifNil:
  		[self error: 'attempt to read an uninitialized field'.
  		^ super at: index  "Maybe it was set in Squeak.  Return the raw value"].
  	(self bitsOf: value) ~= (super at: index) ifTrue:
  		[self error: 'inconsistent values: ', (self bitsOf: value) printString, ' vs ', (super at: index) printString].
  	^value!

Item was changed:
  ----- Method: BalloonArray>>at:put: (in category 'memory access') -----
  at: index put: value
  
  	super at: index put: (self bitsOf: value).
+ 	^ simArray at: index + simOffset put: value.
- 	^ simArray at: index + 1 put: value.
  	!

Item was changed:
  ----- Method: BalloonArray>>setSimArray: (in category 'memory access') -----
  setSimArray: anArray
+ 	simArray := anArray.
+ 	"Now sync the contents of the simArray with the actual work buffer.
+ 	 The issue here is that whether an element is an in teger or a float depends
+ 	 on how the BalloonArrayPlugin accesses the workBuffer; hence we look at
+ 	 the existing values in simArray to find that interpretation."
+ 	simOffset ifNil:
+ 		[simOffset := 1].
+ 	0 to: anArray size - 1 do:
+ 		[:i| 
+ 		 anArray
+ 			at: i + simOffset
+ 			put: ((anArray at: i + simOffset) isFloat
+ 					ifTrue: [(Float fromIEEE32Bit: (super at: i))]
+ 					ifFalse: [super at: i])]!
- 
- 	simArray := anArray!

Item was changed:
  ----- Method: BalloonEngineBase>>primitiveInitializeBuffer (in category 'primitives-other') -----
  primitiveInitializeBuffer
- 	| wbOop size |
  	<export: true>
+ 	| wbOop size |
+ 	(interpreterProxy methodArgumentCount = 1
+ 	 and: [(interpreterProxy isWords: (wbOop := interpreterProxy stackValue: 0)) 
+ 	 and: [(size := interpreterProxy slotSizeOf: wbOop) < GWMinimalSize]]) ifTrue:
+ 		[^interpreterProxy primitiveFail].
- 	<inline: false>
- 	interpreterProxy methodArgumentCount = 1
- 		ifFalse:[^interpreterProxy primitiveFail].
- 	wbOop := interpreterProxy stackObjectValue: 0.
- 	interpreterProxy failed ifTrue:[^nil].
- 	(interpreterProxy isWords: wbOop) 
- 		ifFalse:[^interpreterProxy primitiveFail].
- 	(size := interpreterProxy slotSizeOf: wbOop) < GWMinimalSize
- 		ifTrue:[^interpreterProxy primitiveFail].
  	self workBufferPut: wbOop.
  	objBuffer := workBuffer + GWHeaderSize.
  	self magicNumberPut: GWMagicNumber.
  	self wbSizePut: size.
  	self wbTopPut: size.
  	self statePut: GEStateUnlocked.
  	self objStartPut: GWHeaderSize.
  	self objUsedPut: 4.	"Dummy fill object"
  	self objectTypeOf: 0 put: GEPrimitiveFill.
  	self objectLengthOf: 0 put: 4.
  	self objectIndexOf: 0 put: 0.
  	self getStartPut: 0.
  	self getUsedPut: 0.
  	self aetStartPut: 0.
  	self aetUsedPut: 0.
  	self stopReasonPut: 0.
  	self needsFlushPut: 0.
  	self clipMinXPut: 0.
  	self clipMaxXPut: 0.
  	self clipMinYPut: 0.
  	self clipMaxYPut: 0.
  	self currentZPut: 0.
  	self resetGraphicsEngineStats.
  	self initEdgeTransform.
  	self initColorTransform.
+ 	interpreterProxy pop: 2 thenPush: wbOop!
- 	interpreterProxy pop: 2.
- 	interpreterProxy push: wbOop.!



More information about the Vm-dev mailing list