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

commits at source.squeak.org commits at source.squeak.org
Mon Nov 21 00:23:54 UTC 2016


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

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

Name: VMMaker.oscog-eem.1998
Author: eem
Time: 20 November 2016, 4:23:06.154699 pm
UUID: 018f25bb-f837-4268-8b96-ce86d1e3f237
Ancestors: VMMaker.oscog-eem.1997

Oops; there are two places the zero divide can bite.

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

Item was changed:
  ----- Method: FilePlugin>>primitiveFileReadWithPinning (in category 'file primitives') -----
  primitiveFileReadWithPinning
  	"This version of primitiveFileRead is for garbage collectors that support pinning."
  	| count startIndex array file slotSize elementSize bytesRead |
  	<inline: true>
  	<var: 'file' type: #'SQFile *'>
  	<var: 'count' type: #'size_t'>
  	<var: 'startIndex' type: #'size_t'>
  	<var: 'slotSize' type: #'size_t'>
  	<var: 'elementSize' type: #'size_t'>
  	count		:= interpreterProxy positiveMachineIntegerValueOf: (interpreterProxy stackValue: 0).
  	startIndex	:= interpreterProxy positiveMachineIntegerValueOf: (interpreterProxy stackValue: 1).
   	array		:= interpreterProxy stackValue: 2.
  	file			:= self fileValueOf: (interpreterProxy stackValue: 3).
  
  	(interpreterProxy failed
  	"buffer can be any indexable words or bytes object except CompiledMethod"
  	 or: [(interpreterProxy isWordsOrBytes: array) not]) ifTrue:
  		[^interpreterProxy primitiveFailFor: PrimErrBadArgument].
  
  	slotSize := interpreterProxy slotSizeOf: array.
  	(startIndex >= 1 and: [startIndex + count - 1 <= slotSize]) ifFalse:
  		[^interpreterProxy primitiveFailFor: PrimErrBadIndex].
  
  	"Note: adjust startIndex for zero-origin byte indexing"
  	elementSize := slotSize = 0
+ 						ifTrue: [1]
- 						ifTrue: [0]
  						ifFalse: [(interpreterProxy byteSizeOf: array) // slotSize].
  	bytesRead := self
  					sqFile: file
  					Read: count * elementSize
  					Into: (interpreterProxy cCoerce: (interpreterProxy firstIndexableField: array) to: #'char *')
  					At: startIndex - 1 * elementSize.
  	interpreterProxy failed ifFalse:
  		[interpreterProxy
  			pop: 5 "pop rcvr, file, array, startIndex, count"
  			thenPush:(interpreterProxy integerObjectOf: bytesRead // elementSize)  "push # of elements read"]!

Item was changed:
  ----- Method: FilePlugin>>primitiveFileWrite (in category 'file primitives') -----
  primitiveFileWrite
  	| count startIndex array file slotSize elementSize bytesWritten |
  	<var: 'file' type: 'SQFile *'>
  	<var: 'count' type: 'size_t'>
  	<var: 'startIndex' type: 'size_t'>
  	<var: 'slotSize' type: #'size_t'>
  	<var: 'elementSize' type: #'size_t'>
  	<export: true>
  	count		:= interpreterProxy positiveMachineIntegerValueOf: (interpreterProxy stackValue: 0).
  	startIndex	:= interpreterProxy positiveMachineIntegerValueOf: (interpreterProxy stackValue: 1).
  	array		:= interpreterProxy stackValue: 2.
  	file			:= self fileValueOf: (interpreterProxy stackValue: 3).
  
  	 (interpreterProxy failed
  	 "buffer can be any indexable words or bytes object except CompiledMethod"
  	 or: [(interpreterProxy isWordsOrBytes: array) not]) ifTrue:
  		[^interpreterProxy primitiveFailFor: PrimErrBadArgument].
  
  	slotSize := interpreterProxy slotSizeOf: array.
  	(startIndex >= 1 and: [startIndex + count - 1 <= slotSize]) ifFalse:
  		[^interpreterProxy primitiveFailFor: PrimErrBadIndex].
  
  	"Note: adjust startIndex for zero-origin byte indexing"
  	elementSize := slotSize = 0
+ 						ifTrue: [1]
- 						ifTrue: [0]
  						ifFalse: [(interpreterProxy byteSizeOf: array) // slotSize].
  	bytesWritten := self
  						sqFile: file
  						Write: count * elementSize
  						From: (interpreterProxy cCoerce: (interpreterProxy firstIndexableField: array) to: #'char *')
  						At: startIndex - 1 * elementSize.
  	interpreterProxy failed ifFalse:
  		[interpreterProxy pop: 5 thenPush: (interpreterProxy integerObjectOf: bytesWritten // elementSize)]!



More information about the Vm-dev mailing list