[Vm-dev] VM Maker: VMMaker.oscog-nice.2220.mcz

commits at source.squeak.org commits at source.squeak.org
Wed May 24 17:21:07 UTC 2017


Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-nice.2220.mcz

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

Name: VMMaker.oscog-nice.2220
Author: nice
Time: 24 May 2017, 7:19:44.72644 pm
UUID: 7e5591ac-8f9a-4828-81ba-247f3457ce4f
Ancestors: VMMaker.oscog-cb.2219

Fix display pixel reversal (for debug).

Modern implementation of displayBits is (void *).
We can't calculate an offset (dispalyBits + n) because we don't know the size of void! At least it fails on MSVC compiler.
So it's necessary to convert it to char *, int *, or just sqInt.

While at it, as calculated, the range is a pixel range (assumed on the first display line) not a word range, but this range will be rounded to a whole word boundary.

The formulation now explicitely uses word indices, not word indices disguised in byte offsets.
It should avoid bad alignment cases where word(byte)StartIndex could eventually not be a proper multiple of 4.
It should also now work for any depth.
It might overflow for a pixel range highBit > 26 if sqInt were only 32 bits, that is over 64 million pixel width, but since our screens are not yet that wide, and will never be that wide in a 32 bits addressable space, we're safe.

=============== Diff against VMMaker.oscog-cb.2219 ===============

Item was changed:
  ----- Method: StackInterpreter>>reverseDisplayFrom:to: (in category 'I/O primitive support') -----
  reverseDisplayFrom: startIndex to: endIndex 
+ 	"Reverse the given range of Display pixels, rounded to whole word boundary.
+ 	Used to give feedback during VM activities such as garbage collection when debugging.
- 	"Reverse the given range of Display words (at different bit depths, this will reverse different numbers
- 	 of pixels). Used to give feedback during VM activities such as garbage collection when debugging.
  	 It is assumed that the given word range falls entirely within the first line of the Display."
+ 	
  	| wordStartIndex wordEndIndex primFailCodeValue |
  	(displayBits = 0 or: [(objectMemory isImmediate: displayBits asInteger) or: [displayDepth = 0]]) ifTrue: [^nil].
+ 	wordStartIndex := (startIndex max: 0) * displayDepth // 32.
+ 	wordEndIndex := (endIndex min: displayWidth) * displayDepth // 32.
+ 	wordStartIndex * 4 to: wordEndIndex * 4 do:
+ 		[:byteOffset | | reversed |
+ 		reversed := (objectMemory long32At: displayBits asInteger + byteOffset) bitXor: 16rFFFFFFFF.
+ 		objectMemory long32At: displayBits asInteger + byteOffset put: reversed].
- 	wordStartIndex := startIndex * (displayDepth // 8).
- 	wordEndIndex := endIndex * (displayDepth // 8) min: displayWidth * (displayDepth // 8).
- 	displayBits + wordStartIndex to: displayBits + wordEndIndex by: 4 do:
- 		[:ptr | | reversed |
- 		reversed := (objectMemory long32At: ptr) bitXor: 16rFFFFFFFF.
- 		objectMemory long32At: ptr put: reversed].
  	primFailCodeValue := primFailCode.
  	self initPrimCall.
  	self updateDisplayLeft: 0 Top: 0 Right: displayWidth Bottom: 1.
  	self ioForceDisplayUpdate.
  	primFailCode := primFailCodeValue!



More information about the Vm-dev mailing list