[Vm-dev] VM Maker: VMMaker-dtl.367.mcz

commits at source.squeak.org commits at source.squeak.org
Wed Jul 22 03:27:24 UTC 2015


David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.367.mcz

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

Name: VMMaker-dtl.367
Author: dtl
Time: 21 July 2015, 10:58:56.805 pm
UUID: fbd694df-9f36-40b7-bc0b-bfb2bd4b3d38
Ancestors: VMMaker-tfel.366

VMMaker 4.14.1

Eliot's fix for sqComplexEvent on 64-bit object memory to support iOS VM.

Requires platforms source version SVN 3412 or greater.

Background:

In sq.h, the sqInputEvent struct was originally defined with all fields of type int. These fields are accessed in primitiveGetNextEvent by treating the sqInputEvent struct as an array of int. The sqComplexEvent struct variation was introduced for the iOS VM, and uses one of the available fields to store an object pointer of type usqInt.

In the case of a 64 bit object memory, sizeof(usqInt) is 8, and the object pointer cannot be stored in a C variable of type int. Therefore, change the declaration of all sqInputEvent data structures to have fields of type long, which are large enough to store objects pointers on all platforms of interest. This allows the event struct to safely store both integers and object pointers regardless of object memory word size.

=============== Diff against VMMaker-tfel.366 ===============

Item was changed:
  ----- Method: InterpreterPrimitives>>primitiveGetNextEvent (in category 'I/O primitives') -----
  primitiveGetNextEvent
  	"Primitive. Return the next input event from the VM event queue."
  	| evtBuf arg value eventTypeIs |
+ 	<var: #evtBuf declareC: 'long evtBuf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }'>
- 	<var: #evtBuf declareC: 'int evtBuf[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }'>
  	self cCode:'' inSmalltalk:[evtBuf := CArrayAccessor on: (IntegerArray new: 8)].
  	arg := self stackTop.
  	((objectMemory isArray: arg) and:[(objectMemory slotSizeOf: arg) = 8])  ifFalse:[^self primitiveFail].
  
  	self ioGetNextEvent: (self cCoerce: evtBuf to: 'sqInputEvent*').
  	self successful ifFalse:[^nil].
  
  	"Event type"
  	eventTypeIs := evtBuf at: 0.
  	self storeInteger: 0 ofObject: arg withValue: (evtBuf at: 0).
  	self successful ifFalse:[^nil].
  
  	"Event is Complex, assume evtBuf is populated correctly and return"
  	eventTypeIs = 6 ifTrue: 
  		[1 to: 7 do: [:i |
  			value := evtBuf at: i.
  			objectMemory storePointer: i ofObject: arg withValue: value]]
  	ifFalse: [
  		"Event time stamp"
  		self storeInteger: 1 ofObject: arg withValue: ((evtBuf at: 1) bitAnd: MillisecondClockMask).
  		self successful ifFalse:[^nil].
  
  		"Event arguments"
  		2 to: 7 do:[:i|
  			value := evtBuf at: i.
  			(objectMemory isIntegerValue: value)
  				ifTrue:[self storeInteger: i ofObject: arg withValue: value]
  				ifFalse:["Need to remap because allocation may cause GC"
  					objectMemory pushRemappableOop: arg.
  					value := self positive32BitIntegerFor: value.
  					arg := objectMemory popRemappableOop.
  					objectMemory storePointer: i ofObject: arg withValue: value]]].
  	self successful ifFalse:[^nil].
  	self pop: 1.!

Item was changed:
  ----- Method: VMMaker class>>versionString (in category 'version testing') -----
  versionString
  
  	"VMMaker versionString"
  
+ 	^'4.14.1'!
- 	^'4.13.12'!



More information about the Vm-dev mailing list