[Vm-dev] VM Maker: VMMaker.oscog-djm.705.mcz

commits at source.squeak.org commits at source.squeak.org
Tue May 6 20:04:31 UTC 2014


Douglas McPherson uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-djm.705.mcz

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

Name: VMMaker.oscog-djm.705
Author: djm
Time: 6 May 2014, 1:02:05.123 pm
UUID: 32b4b7b5-41ce-48aa-a789-93efbbd31f5f
Ancestors: VMMaker.oscog-eem.704

ARM FFI: Fix bug in passing structure argument in the case where a struct would normally be split between registers and stack, but because of prior coprocessor register candidiate args having been pushed on the stack, the structure should not be split but pushed entirely on the stack.

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

Item was changed:
  ----- Method: ThreadedARMFFIPlugin>>ffiPushStructure:ofSize:typeSpec:ofLength:in: (in category 'marshalling') -----
  ffiPushStructure: pointer ofSize: structSize typeSpec: argSpec ofLength: argSpecSize in: calloutState
  	<var: #pointer type: #'void *'>
  	<var: #argSpec type: #'sqInt *'>
  	<var: #calloutState type: #'CalloutState *'>
  	<inline: true>
  	| availableRegisterSpace stackPartSize roundedSize |
  
  	availableRegisterSpace := (NumIntRegArgs - calloutState integerRegisterIndex) * 4.
  	stackPartSize := structSize.
  	availableRegisterSpace > 0
  		ifTrue: 
  			[structSize <= availableRegisterSpace
  				ifTrue:
  					["all in registers"
  					 stackPartSize := 0.
  					 self 
  						mem: (self cCoerceSimple: (self addressOf: (calloutState integerRegisters at: calloutState integerRegisterIndex)) to: 'void *') 
  						cp: pointer 
  						y: structSize.
  					 calloutState integerRegisterIndex: calloutState integerRegisterIndex + (structSize + 3 bitShift: -2) ]
  				ifFalse:
+ 					["If no previous co-processor candidate arg has already been pushed on the stack, then split the struct between registers and stack.
+ 					  Otherwise push entire struct on stack."
+ 					 calloutState currentArg = calloutState argVector
+ 						ifTrue: 
+ 					 		[stackPartSize := structSize - availableRegisterSpace.
+ 					 		self 
+ 								mem: (self cCoerceSimple: (self addressOf: (calloutState integerRegisters at: calloutState integerRegisterIndex)) to: 'void *') 
+ 								cp: pointer 
+ 								y: availableRegisterSpace]
+ 						ifFalse:
+ 							[availableRegisterSpace := 0].
+ 					calloutState integerRegisterIndex: NumIntRegArgs]].
- 					["some in registers rest on stack"
- 					 stackPartSize := structSize - availableRegisterSpace.
- 					 self 
- 						mem: (self cCoerceSimple: (self addressOf: (calloutState integerRegisters at: calloutState integerRegisterIndex)) to: 'void *') 
- 						cp: pointer 
- 						y: availableRegisterSpace.
- 					 calloutState integerRegisterIndex: NumIntRegArgs]].
  
  	stackPartSize > 0
  		ifTrue: 
  			[roundedSize := stackPartSize + 3 bitClear: 3.
  			 calloutState currentArg + roundedSize > calloutState limit ifTrue:
  				 [^FFIErrorCallFrameTooBig].
  			 self mem: calloutState currentArg cp: (self addressOf: ((self cCoerceSimple: pointer to: 'char *') at: availableRegisterSpace)) y: stackPartSize.
  			 calloutState currentArg: calloutState currentArg + roundedSize].
  	^0!



More information about the Vm-dev mailing list