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

commits at source.squeak.org commits at source.squeak.org
Sat Dec 10 00:17:07 UTC 2011

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

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

Name: VMMaker.oscog-eem.140
Author: eem
Time: 9 December 2011, 4:15:07.432 pm
UUID: 2487009c-2c13-4609-b89e-77f0e195f433
Ancestors: VMMaker.oscog-eem.139

Stop the backward jump compilation variables being localised to
interpret.  If this happens the unoptimized debug VM can behave
very differently to the optimized VMs.
Use definedAsMacro in tryToInlineMethodsIn: instead of accessing
properties directly (i.e. as other senders of definedAsMacro).

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

Item was changed:
  ----- Method: CoInterpreter>>longUnconditionalJump (in category 'jump bytecodes') -----
  	| offset switched |
  	offset := (((currentBytecode bitAnd: 7) - 4) * 256) + self fetchByte.
  	localIP := localIP + offset.
  	"backward jump means we're in a loop.
  		- check for possible interrupts.
  		- check for long-running loops and JIT if appropriate."
  	offset < 0 ifTrue:
  		[localSP < stackLimit ifTrue:
  			[self externalizeIPandSP.
  			 switched := self checkForEventsMayContextSwitch: true.
  			 self returnToExecutive: true postContextSwitch: switched.
  			 self browserPluginReturnIfNeeded.
  			 self internalizeIPandSP].
  		method = lastBackwardJumpMethod
  				[(backwardJumpCount := backwardJumpCount - 1) <= 0 ifTrue:
  					[(self methodWithHeaderShouldBeCogged: (self headerOf: method))
  							[self externalizeFPandSP.
+ 							 self resetBackwardJumpVariables. "only to force variables to be global"
  							 self attemptToSwitchToMachineCode: (self oopForPointer: localIP) - offset - method - BaseHeaderSize - 1]
  						ifFalse: "don't ask if one should compile a second time..."
  							[backwardJumpCount := 1 bitShift: BytesPerWord * 8 - 2]]]
  				[lastBackwardJumpMethod := method.
  				backwardJumpCount := minBackwardJumpCountForCompile]].
  	self fetchNextBytecode!

Item was added:
+ ----- Method: CoInterpreter>>resetBackwardJumpVariables (in category 'jump bytecodes') -----
+ resetBackwardJumpVariables
+ 	"Reference these variables from outside interpret to avoid them being localised to interpret.
+ 	 Oh the hacks we commit for Slang..."
+ 	<cmacro: '() /* nada */'>
+ 	<inline: #false>
+ 	lastBackwardJumpMethod := lastBackwardJumpMethod.
+ 	backwardJumpCount := backwardJumpCount!

Item was changed:
  ----- Method: TMethod>>tryToInlineMethodsIn: (in category 'inlining') -----
  tryToInlineMethodsIn: aCodeGen
  	"Expand any (complete) inline methods called by this method. Set the complete bit when all inlining has been done. Return true if something was inlined."
  	| stmtLists didSomething newStatements sendsToInline |
+ 	self definedAsMacro ifTrue:
- 	(properties includesKey: #cmacro:) ifTrue:
  		[complete := true.
  	didSomething := false.
  	sendsToInline := Dictionary new: 100.
  			[ :n |
  			(self inlineableFunctionCall: n in: aCodeGen) ifTrue:
  				[sendsToInline at: n put: (self inlineFunctionCall: n in: aCodeGen)]]
  		unless: "Don't inline the arguments to asserts to keep the asserts readable"
  			[:n| n isSend and: [#(cCode:inSmalltalk: assert:) includes: n selector]].
  	sendsToInline isEmpty ifFalse:
  		[didSomething := true.
  		parseTree := parseTree replaceNodesIn: sendsToInline].
  	didSomething ifTrue:
  		[writtenToGlobalVarsCache := nil.
  	stmtLists := self statementsListsForInlining.
  	stmtLists do:
  		[ :stmtList | 
  		newStatements := OrderedCollection new: 100.
  		stmtList statements do:
  			[ :stmt |
  			(self inlineCodeOrNilForStatement: stmt in: aCodeGen)
  				ifNil: [newStatements addLast: stmt]
  				ifNotNil: [:inlinedStmts|
  					didSomething := true.
  					newStatements addAllLast: inlinedStmts]].
  		stmtList setStatements: newStatements asArray].
  	didSomething ifTrue:
  		[writtenToGlobalVarsCache := nil.
  	complete ifFalse:
  		[self checkForCompleteness: stmtLists in: aCodeGen.
  		 complete ifTrue: [ didSomething := true ]].  "marking a method complete is progress"

More information about the Vm-dev mailing list