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

commits at source.squeak.org commits at source.squeak.org
Tue Mar 21 22:10:05 UTC 2017


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

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

Name: VMMaker.oscog-eem.2175
Author: eem
Time: 21 March 2017, 3:08:53.878597 pm
UUID: eb79e804-a80b-4ad3-bd19-9c60a24a14f1
Ancestors: VMMaker.oscog-eem.2174

CoInterpreter:
If a context's method is assigned to, any machine code pcs must be mapped to bytecode ones *before* the method is changed because otherwise subsequent reads of the context's pc will attempt to map using the wrong method, causing a crash.

In-image compilation:
Insulate the CurrentImageCoInterpreterFacade from the recent changes to specialSelectors which filters out the argument counts.

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

Item was added:
+ ----- Method: CoInterpreter>>is:methodAssignmentToContextWithMachineCodePC: (in category 'internal interpreter access') -----
+ is: fieldIndex methodAssignmentToContextWithMachineCodePC: anOop
+ 	"If the method is assigned, any machine code pc must be mapped to a bytecode one
+ 	 before the method is changed."
+ 	<inline: true>
+ 	| thePC |
+ 	^fieldIndex = MethodIndex
+ 	  and: [(thePC := objectMemory fetchPointer: InstructionPointerIndex ofObject: anOop) signedIntFromLong < 0
+ 	  and: [objectMemory isIntegerObject: thePC]]!

Item was changed:
  ----- Method: CurrentImageCoInterpreterFacade>>specialSelector: (in category 'accessing') -----
  specialSelector: index 
+ 	^self oopForObject: (self specialSelectors at: index * 2 + 1)!
- 	^self oopForObject: (Smalltalk specialSelectors at: index * 2 + 1)!

Item was changed:
  ----- Method: CurrentImageCoInterpreterFacade>>specialSelectorNumArgs: (in category 'accessing') -----
  specialSelectorNumArgs: index 
+ 	^self specialSelectors at: index * 2 + 2!
- 	^Smalltalk specialSelectors at: index * 2 + 2!

Item was added:
+ ----- Method: CurrentImageCoInterpreterFacade>>specialSelectors (in category 'private') -----
+ specialSelectors
+ 	^Smalltalk specialObjectsArray at: 24!

Item was changed:
  ----- Method: StackInterpreter>>externalInstVar:ofContext:put: (in category 'frame access') -----
  externalInstVar: index ofContext: maybeMarriedContext put: anOop
  	| theFP thePage onCurrentPage |
  	<var: #theFP type: #'char *'>
  	<var: #thePage type: #'StackPage *'>
  	self assert: (objectMemory isContext: maybeMarriedContext).
  	self externalWriteBackHeadFramePointers.
  	"Assign the field of a married context."
  	self deny: (objectMemory isObjImmutable: maybeMarriedContext).
  	(self isStillMarriedContext: maybeMarriedContext) ifFalse:
  		[objectMemory storePointer: index ofObject: maybeMarriedContext withValue: anOop.
  		 index = StackPointerIndex ifTrue:
  			[self ensureContextIsExecutionSafeAfterAssignToStackPointer: maybeMarriedContext].
  		 ^nil].
  	theFP := self frameOfMarriedContext: maybeMarriedContext.
  	thePage := stackPages stackPageFor: theFP.
  	self assert: stackPage = stackPages mostRecentlyUsedPage.
  	onCurrentPage := thePage = stackPage.
+ 	index = SenderIndex
- 	index == SenderIndex
  		ifTrue:
  			[self storeSenderOfFrame: theFP withValue: anOop]
  		ifFalse:
  			[self externalDivorceFrame: theFP andContext: maybeMarriedContext.
+ 			 (self is: index methodAssignmentToContextWithMachineCodePC: maybeMarriedContext) ifTrue:
+ 				[self ensureContextHasBytecodePC: maybeMarriedContext].
  			 objectMemory storePointer: index ofObject: maybeMarriedContext withValue: anOop.
  			 index = StackPointerIndex ifTrue:
  				[self ensureContextIsExecutionSafeAfterAssignToStackPointer: maybeMarriedContext]].
  	onCurrentPage
  		ifTrue:
  			[self setStackPointersFromPage: stackPage]
  		ifFalse:
  			[stackPages markStackPageMostRecentlyUsed: stackPage].
  	stackPages assert: stackPage = stackPages mostRecentlyUsedPage.
  	stackPages assert: stackPages pageListIsWellFormed.
  	stackPages assert: self validStackPageBaseFrames!

Item was changed:
  ----- Method: StackInterpreter>>instVar:ofContext:put: (in category 'frame access') -----
  instVar: index ofContext: aMarriedContext put: anOop
  	| theFP |
  	"Assign the field of a married context.  The important case to optimize is
  	 assigning the sender.  We could also consider optimizing assigning the IP but
  	 typically that is followed by an assignment to the stack pointer and we can't
  	 efficiently assign the stack pointer because it involves moving frames around."
  	<inline: true>
  	self assert: (self isMarriedOrWidowedContext: aMarriedContext).
  	self deny: (objectMemory isObjImmutable: aMarriedContext).
  	self writeBackHeadFramePointers.
  	(self isStillMarriedContext: aMarriedContext) ifFalse:
  		[objectMemory storePointer: index ofObject: aMarriedContext withValue: anOop.
  		 index = StackPointerIndex ifTrue:
  			[self ensureContextIsExecutionSafeAfterAssignToStackPointer: aMarriedContext].
  		 ^nil].
  	theFP := self frameOfMarriedContext: aMarriedContext.
+ 	index = SenderIndex ifTrue:
- 	index == SenderIndex ifTrue:
  		[| thePage onCurrentPage |
  		 thePage := stackPages stackPageFor: theFP.
  		 self assert: stackPage = stackPages mostRecentlyUsedPage.
  		 onCurrentPage := thePage = stackPage.
  		 self storeSenderOfFrame: theFP withValue: anOop.
  		 onCurrentPage
  			ifTrue:
  				[localFP := stackPage headFP.
  				 localSP := stackPage headSP]
  			ifFalse:
  				[stackPages markStackPageMostRecentlyUsed: stackPage].
  		 ^nil].
  	self externalizeIPandSP.
  	self externalDivorceFrame: theFP andContext: aMarriedContext.
+ 	(self is: index methodAssignmentToContextWithMachineCodePC: aMarriedContext) ifTrue:
+ 		[self ensureContextHasBytecodePC: aMarriedContext].
  	objectMemory storePointer: index ofObject: aMarriedContext withValue: anOop.
  	index = StackPointerIndex ifTrue:
  		[self ensureContextIsExecutionSafeAfterAssignToStackPointer: aMarriedContext].
  	self internalizeIPandSP.
  	"Assigning various fields can force a divorce which can change the stackPage."
  	stackPages markStackPageMostRecentlyUsed: stackPage.
  	self assertValidExecutionPointe: localIP asUnsignedInteger r: localFP s: localSP imbar: true line: #'__LINE__'!

Item was added:
+ ----- Method: StackInterpreter>>is:methodAssignmentToContextWithMachineCodePC: (in category 'internal interpreter access') -----
+ is: fieldIndex methodAssignmentToContextWithMachineCodePC: anOop
+ 	"This is a hook for the CoInterpreter.  It is a noop in the StackInterpreter."
+ 	<inline: true>
+ 	^false!

Item was changed:
  ----- Method: StackInterpreter>>storeMaybeContext:receiverVariable:withValue: (in category 'stack bytecodes') -----
  storeMaybeContext: obj receiverVariable: fieldIndex withValue: anOop
  	"Must trap accesses to married and widowed contexts.
  	 But don't want to check on all inst var accesses.  This
  	 method is only used by the long-form bytecodes, evading the cost."
  	<inline: true>
  	((self isWriteMediatedContextInstVarIndex: fieldIndex)
  	and: [(objectMemory isContextNonImm: obj)
+ 	and: [(self isMarriedOrWidowedContext: obj)
+ 		or: [self is: fieldIndex methodAssignmentToContextWithMachineCodePC: anOop]]])
- 	and: [self isMarriedOrWidowedContext: obj]])
  		ifTrue:
  			[self instVar: fieldIndex ofContext: obj put: anOop]
  		ifFalse:
  			[objectMemory storePointerImmutabilityCheck: fieldIndex ofObject: obj withValue: anOop]!



More information about the Vm-dev mailing list