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

commits at source.squeak.org commits at source.squeak.org
Wed Jul 28 03:39:58 UTC 2021


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

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

Name: VMMaker.oscog-eem.3006
Author: eem
Time: 27 July 2021, 8:39:41.638972 pm
UUID: 52ac109b-6c67-49ce-a59a-c0e0dbb20e59
Ancestors: VMMaker.oscog-eem.3005

Fix my misunderstanding with the char type in ThreadedFFIPlugin.  We need a range of character sizes, 8, 16 & 32 bit.  But the current type descriptor scheme supports only 8 byte characters.  This makes all FFI tests green (the last one was ffiTestChars).

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

Item was changed:
  ----- Method: ThreadedFFIPlugin>>ffiCreateIntegralResultOop:ofAtomicType:in: (in category 'callout support') -----
  ffiCreateIntegralResultOop: retVal ofAtomicType: atomicType in: calloutState
  	<inline: #always>
  	<var: #calloutState type: #'CalloutState *'>
  	<var: #retVal type: #usqLong>
  	"Callout support. Return the appropriate oop for the given atomic type"
  	| shift value mask byteSize |
  	<var: 'value' type: #usqLong>
  	<var: 'mask' type: #usqLong>
  	self assert: atomicType < FFITypeSingleFloat.
  
  	atomicType = FFITypeBool ifTrue:
  		["Make sure bool honors the byte size requested"
  		 byteSize := calloutState ffiRetHeader bitAnd: FFIStructSizeMask.
  		 value := byteSize = (self sizeof: retVal)
  					ifTrue:[retVal]
  					ifFalse:[retVal bitAnd: 1 asUnsignedLongLong << (byteSize * 8) - 1].
  		 ^value = 0
  			ifTrue:[interpreterProxy falseObject]
  			ifFalse:[interpreterProxy trueObject]].
  	atomicType <= FFITypeSignedInt ifTrue:
  		["these are all generall integer returns"
  		atomicType <= (BytesPerWord = 8 ifTrue: [FFITypeSignedInt] ifFalse: [FFITypeSignedShort]) ifTrue:
  			["byte/short. first extract partial word, then sign extend"
  			shift := (BytesPerWord = 8 and: [atomicType >= FFITypeUnsignedInt])
  						ifTrue: [32]
  						ifFalse: [(atomicType >> 1) * 8]. "# of significant bits"
  			value := retVal bitAnd: (1 asUnsignedLongLong << shift - 1). 
  			(atomicType anyMask: 1) ifTrue:
  				["make the guy signed"
  				mask := 1 asUnsignedLongLong << (shift-1).
  				value := (value bitAnd: mask-1) - (value bitAnd: mask)].
  			^interpreterProxy integerObjectOf: value].
  		"Word sized integer return"
  		^(atomicType anyMask: 1)
  			ifTrue:[interpreterProxy signedMachineIntegerFor: retVal] "signed return"
  			ifFalse:[interpreterProxy positiveMachineIntegerFor: retVal]]. "unsigned return"
  
  	"longlong, char"
  	(atomicType >> 1) = (FFITypeSignedLongLong >> 1) ifTrue:
  		[^(atomicType anyMask: 1)
  			ifTrue: [interpreterProxy signed64BitIntegerFor: retVal] "signed return"
  			ifFalse: [interpreterProxy positive64BitIntegerFor: retVal]].
+ 	self flag: 'we need a solution for wide characters; spur supports upto 30 bit characters'.
+ 	^interpreterProxy characterObjectOf: (retVal bitAnd: 16rFF)!
- 	self cppIf: #SPURVM
- 		ifTrue: [^interpreterProxy characterObjectOf: (retVal bitAnd: 16r3FFFFFFF)]
- 		ifFalse: [^interpreterProxy characterObjectOf: (retVal bitAnd: 16rFF)]!



More information about the Vm-dev mailing list