[squeak-dev] FFI: FFI-Callbacks-mt.14.mcz

commits at source.squeak.org commits at source.squeak.org
Fri May 14 14:28:13 UTC 2021

Marcel Taeumel uploaded a new version of FFI-Callbacks to project FFI:

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

Name: FFI-Callbacks-mt.14
Author: mt
Time: 14 May 2021, 4:28:12.386065 pm
UUID: d4e4e533-7d17-f14e-8810-223b646f520d
Ancestors: FFI-Callbacks-mt.13

I forgot the #value for stack arguments. Sorry for the noise.

=============== Diff against FFI-Callbacks-mt.13 ===============

Item was changed:
  ----- Method: FFICallback>>evaluateDynamic: (in category 'callback - evaluators') -----
  evaluateDynamic: callbackContext
  	"Read all arguments and make the call(back). Assume that 'handle' and 'type' are set correctly. Only watch out for the sign. See field definition in FFICallbackContext to explore alternative ways to read the arguments."
  	| byteOffset args intArgs intPos floatArgs floatPos |
  	handle := callbackContext stackPtr getHandle.
  	type := callbackContext stackPtr contentType.
  	byteOffset := 1.	
  	intArgs := callbackContext integerArguments.
  	intPos := 0.
  	floatArgs := callbackContext floatArguments.
  	floatPos := 0.
  	args := Array new: argumentTypes size.
  	1 to: args size do: [:argIndex |
  		| argType data isPointer |
  		argType := argumentTypes at: argIndex.
  		"1) Try to read arguments from registers."
  		data := (intPos < intArgs size and: [(isPointer := argType isPointerType) or: [argType isIntegerType]])
  			ifTrue: [intPos := intPos + 1. intArgs setContentType: argType. (intArgs at: intPos) value]
  			ifFalse: [(floatPos < floatArgs size and: [argType isFloatType])
  				ifTrue: [floatPos := floatPos + 1. floatArgs at: floatPos]].
  			ifNil: [ "2) If nothing was read, read the argument from the stack."
+ 				data := (argType handle: handle at: byteOffset) value.
- 				data := argType handle: handle at: byteOffset.
  				byteOffset := byteOffset
  					+ ((type byteSize max: argType byteSize) roundUpTo: type byteAlignment)].					
  		args at: argIndex put: data].
  	^ self
  		setResult: (evaluableObject valueWithArguments: args)
  		inContext: callbackContext!

More information about the Squeak-dev mailing list