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

commits at source.squeak.org commits at source.squeak.org
Sat Jan 5 02:53:45 UTC 2019

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-eem.2507
Author: eem
Time: 4 January 2019, 6:53:31.95367 pm
UUID: 81744128-e28b-43d2-904e-812b4dc59f20
Ancestors: VMMaker.oscog-nice.2506

Update DetailedInstructionPrinter as per Kernel-eem.1210 full block printing.
Nuke the obsolete pushClosureTempsBytecode.
Fix a slip in isValidClassIndex:

=============== Diff against VMMaker.oscog-nice.2506 ===============

Item was changed:
  ----- Method: DetailedInstructionPrinter>>printInstructionsOn: (in category 'printing') -----
  printInstructionsOn: aStream
  	"Append to the stream, aStream, a description of each bytecode in the
  	 instruction stream."
  	| end |
  	encoderClass ifNil:
  		[^super printInstructionsOn: aStream].
  	stackHeightComputer encoderClass: encoderClass.
  	stream := aStream.
  	scanner := InstructionStream on: method.
  	end := method endPC.
  	oldPC := scanner pc.
  	innerIndents := Array new: end withAll: 0.
+ 	fullBlockRecursionSelector := #printInstructionsOn:.
  	[scanner pc <= end] whileTrue:
  		[encoderClass interpretNextInstructionFor: self in: scanner]!

Item was added:
+ ----- Method: DetailedInstructionPrinter>>printInstructionsOn:do: (in category 'printing') -----
+ printInstructionsOn: aStream do: aBlock
+ 	"Append to the stream, aStream, a description of each bytecode in the
+ 	 instruction stream. Evaluate aBlock with the receiver, the scanner and
+ 	 the stream after each instruction."
+ 	| end |
+ 	encoderClass ifNil:
+ 		[^super printInstructionsOn: aStream do: aBlock].
+ 	stackHeightComputer encoderClass: encoderClass.
+ 	stream := aStream.
+ 	scanner := InstructionStream on: method.
+ 	end := method endPC.
+ 	oldPC := scanner pc.
+ 	innerIndents := Array new: end withAll: 0.
+ 	[scanner pc <= end] whileTrue:
+ 		[encoderClass interpretNextInstructionFor: self in: scanner.
+ 		 aBlock value: self value: scanner value: stream]!

Item was removed:
- ----- Method: SimpleStackBasedCogit>>genPushClosureTempsBytecode (in category 'bytecode generators') -----
- genPushClosureTempsBytecode
- 	"SistaV1: 230		11100110	iiiiiiii		PushNClosureTemps iiiiiiii"
- 	1 to: byte1 do:
- 		[:i| self genPushLiteral: objectMemory nilObject].
- 	^0!

Item was changed:
  ----- Method: SpurMemoryManager>>isValidClassIndex: (in category 'class table') -----
  isValidClassIndex: classIndex
  	| classTablePage |
  	classIndex <= 0 ifTrue:
  	(classIndex <= self tagMask or: [classIndex >= self arrayClassIndexPun]) ifFalse:
  	classIndex >= (1 << self classIndexFieldWidth) ifTrue:
  	classTablePage := self fetchPointer: classIndex >> self classTableMajorIndexShift
  							ofObject: hiddenRootsObj.
  	classTablePage = nilObj ifTrue:
  	(self addressCouldBeObj: classTablePage) ifFalse:
+ 		[^false].
- 		[false].
  	^coInterpreter addressCouldBeClassObj:
  			fetchPointer: (classIndex bitAnd: self classTableMinorIndexMask)
  			ofObject: classTablePage)!

Item was removed:
- ----- Method: StackInterpreter>>pushClosureTempsBytecode (in category 'stack bytecodes') -----
- pushClosureTempsBytecode
- 	"SistaV1:	230		11100110	iiiiiiii		PushNClosureTemps iiiiiiii"
- 	| nTemps |
- 	nTemps := self fetchByte.
- 	self fetchNextBytecode.
- 	1 to: nTemps do:
- 		[:i|
- 		self internalPush: objectMemory nilObject]!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>scanBlock: (in category 'compile abstract instructions') -----
  scanBlock: blockStart
  	"Scan the block to determine if the block needs a frame or not"
  	| descriptor pc end framelessStackDelta nExts pushingNils numPushNils |
  	<var: #blockStart type: #'BlockStart *'>
  	<var: #descriptor type: #'BytecodeDescriptor *'>
  	needsFrame := false.
  	LowcodeVM ifTrue: [ hasNativeFrame := false ].
  	prevBCDescriptor := nil.
  	methodOrBlockNumArgs := blockStart numArgs.
  	inBlock := InVanillaBlock.
  	pc := blockStart startpc.
  	end := blockStart startpc + blockStart span.
  	framelessStackDelta := nExts := extA := numExtB := extB := 0.
  	pushingNils := true.
  	[pc < end] whileTrue:
  		[byte0 := (objectMemory fetchByte: pc ofObject: methodObj) + bytecodeSetOffset.
  		 descriptor := self generatorAt: byte0.
  		 descriptor isExtension ifTrue:
  			[self loadSubsequentBytesForDescriptor: descriptor at: pc.
  			 self perform: descriptor generator].
  		 needsFrame ifFalse:
  			[(descriptor needsFrameFunction isNil
  			  or: [self perform: descriptor needsFrameFunction with: framelessStackDelta])
  				ifTrue: [needsFrame := true]
  				ifFalse: [framelessStackDelta := framelessStackDelta + descriptor stackDelta]].
  		 objectRepresentation maybeNoteDescriptor: descriptor blockStart: blockStart.
  		  and: [descriptor isExtension not]) ifTrue:
  			["Count the initial number of pushed nils acting as temp initializers.  We can't tell
  			  whether an initial pushNil is an operand reference or a temp initializer, except
  			  when the pushNil is a jump target (has a fixup), which never happens:
  					self systemNavigation browseAllSelect:
  						[:m| | ebc |
  						(ebc := m embeddedBlockClosures
  									select: [:ea| ea decompile statements first isMessage]
  									thenCollect: [:ea| ea decompile statements first selector]) notEmpty
  						and: [(#(whileTrue whileFalse whileTrue: whileFalse:) intersection: ebc) notEmpty]]
  			  or if the bytecode set has a push multiple nils bytecode.  We simply count initial nils.
  			  Rarely we may end up over-estimating.  We will correct by checking the stack depth
  			  at the end of the block in compileBlockBodies."
  			 (numPushNils := self numPushNils: descriptor pc: pc nExts: nExts method: methodObj) > 0
+ 					[self assert: descriptor numBytes = 1.
- 					[self assert: (descriptor numBytes = 1
- 									or: [descriptor generator == #genPushClosureTempsBytecode]).
  					 blockStart numInitialNils: blockStart numInitialNils + numPushNils]
  					[pushingNils := false]].
  		 pc := self nextBytecodePCFor: descriptor at: pc exts: nExts in: methodObj.
  		 descriptor isExtension
  			ifTrue: [nExts := nExts + 1]
  			ifFalse: [nExts := extA := numExtB := extB := 0].
  		 prevBCDescriptor := descriptor].
  	"It would be nice of this wasn't necessary but alas we need to do the eager
  	 scan for frameless methods so that we don't end up popping too much off
  	 the simulated stack, e.g. for pushNil; returnTopFromBlock methods."
  	needsFrame ifFalse:
  		[self assert: (framelessStackDelta >= 0 and: [blockStart numInitialNils >= framelessStackDelta]).
  		 blockStart numInitialNils: blockStart numInitialNils - framelessStackDelta].

More information about the Vm-dev mailing list