[squeak-dev] FFI Inbox: FFI-Kernel-nice.120.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jun 21 23:03:18 UTC 2020


Nicolas Cellier uploaded a new version of FFI-Kernel to project FFI Inbox:
http://source.squeak.org/FFIinbox/FFI-Kernel-nice.120.mcz

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

Name: FFI-Kernel-nice.120
Author: nice
Time: 22 June 2020, 1:03:16.106452 am
UUID: e187957c-7826-9146-bcb0-c35db3202d46
Ancestors: FFI-Kernel-nice.119

Fixup: isEmpty is only for subclass...

=============== Diff against FFI-Kernel-nice.119 ===============

Item was changed:
  ----- Method: ExternalType>>handle:at: (in category 'external data') -----
  handle: handle at: byteOffset
  	"Read the receiver's external type using the given handle and the byteOffset. This is the dynamic version of #readFieldAt:."
  	
  	| address value |
  	self isPointerType
  		ifTrue:
  			[address := handle pointerAt: byteOffset length: self byteSize.
  			^ExternalData
  				fromHandle: address
  				type: self asNonPointerType].
  	self isAtomic
  		ifTrue:
  			["Answer atomic value"
  			value := handle
  				perform: (AtomicSelectors at: self atomicType)
  				with: byteOffset.
  			^referentClass ifNil: [value] ifNotNil: [referentClass fromHandle: value]].
  
  	referentClass isNil
  		ifTrue: [self error: 'unknown type'].
- 	self isEmpty ifTrue: [self error: 'Empty structure'].
  		
  	^referentClass fromHandle: (handle structAt: byteOffset length: self byteSize)!

Item was changed:
  ----- Method: ExternalType>>handle:at:put: (in category 'external data') -----
  handle: handle at: byteOffset put: value
  	"Write a value using the receiver's external type at the given handle and byteOffset. This is the dynamic version of #writeFieldAt:with:."
  
  	self isPointerType
  		ifTrue: [ "set pointer to struct/union/alias"
  			self assert: [value externalType == self asNonPointerType].
  			handle
  				pointerAt: byteOffset
  				put: value getHandle
  				length: self byteSize.
  			^value].
  		
  	self isAtomic
  		ifTrue:
  			[ "set atomic value"
  			self flag: #addTypeCheck. "mt: Note that there is currently no mapping from objects that represent valid atomics to atomic types."
  			handle
  				perform: ((AtomicSelectors at: self atomicType), 'put:') asSymbol
  				with: byteOffset
  				with: value.
  			^value].
  			
  	referentClass isNil
  		ifTrue: [self error: 'unknown type'].
- 	self isEmpty ifTrue: [self error: 'Empty structure'].
  
  	self assert: [value externalType == self].
  	handle structAt: byteOffset put: value getHandle length: self byteSize.
  	^value
  	!



More information about the Squeak-dev mailing list