[Vm-dev] VM Maker: VMMaker.oscog-cb.1784.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Apr 8 16:31:06 UTC 2016


ClementBera uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-cb.1784.mcz

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

Name: VMMaker.oscog-cb.1784
Author: cb
Time: 8 April 2016, 9:27:51.773 am
UUID: d5dd5b87-329a-4129-9efe-797e54bbc6be
Ancestors: VMMaker.oscog-cb.1783

Better support for closures with no outer context

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

Item was removed:
- ----- Method: CoInterpreter>>pushFullClosureNumArgs:copiedValues:compiledBlock:receiverIsOnStack: (in category 'stack bytecodes') -----
- pushFullClosureNumArgs: numArgs copiedValues: numCopiedArg compiledBlock: compiledBlock receiverIsOnStack: receiverIsOnStack
- 	"The compiler has pushed the values to be copied, if any. The receiver has been pushed on stack before if specified. 
- 	 Create a Closure with space for the copiedValues and pop numCopied values off the stack into the closure.
- 	 Sets outerContext, compiledBlock, numArgs and receiver as specified.."
- 	<inline: true>
- 	| numCopied newClosure context startIndex |
- 	"No need to record the pushed copied values in the outerContext."
- 	context := self ensureFrameIsMarried: localFP SP: localSP + (numCopiedArg * objectMemory bytesPerOop).
- 	newClosure := self
- 					fullClosureIn: context 
- 					numArgs: numArgs 
- 					numCopiedValues: numCopiedArg 
- 					compiledBlock: compiledBlock.
- 	cogit recordSendTrace ifTrue:
- 		[self recordTrace: TraceBlockCreation thing: newClosure source: TraceIsFromInterpreter].
- 	receiverIsOnStack
- 		ifFalse: 
- 			[ startIndex := FullClosureFirstCopiedValueIndex.
- 			   objectMemory storePointerUnchecked: FullClosureReceiverIndex
- 				ofObject: newClosure
- 				withValue: self receiver.
- 			numCopied := numCopiedArg ]
- 		ifTrue:
- 			[ startIndex := FullClosureReceiverIndex.
- 			numCopied := numCopiedArg + 1 ].
- 	numCopied > 0 ifTrue:
- 		[0 to: numCopied - 1 do:
- 			[ :i |
- 			"Assume: have just allocated a new BlockClosure; it must be young.
- 			 Thus, can use unchecked stores."
- 			 objectMemory storePointerUnchecked: i + startIndex
- 				ofObject: newClosure
- 				withValue: (self internalStackValue: numCopied - i - 1)].
- 		 self internalPop: numCopied].
- 	self fetchNextBytecode.
- 	self internalPush: newClosure!

Item was added:
+ ----- Method: CoInterpreter>>pushFullClosureNumArgs:copiedValues:compiledBlock:receiverIsOnStack:ignoreContext: (in category 'stack bytecodes') -----
+ pushFullClosureNumArgs: numArgs copiedValues: numCopiedArg compiledBlock: compiledBlock receiverIsOnStack: receiverIsOnStack ignoreContext: ignoreContext
+ 	"The compiler has pushed the values to be copied, if any. The receiver has been pushed on stack before if specified. 
+ 	 Create a Closure with space for the copiedValues and pop numCopied values off the stack into the closure.
+ 	 Sets outerContext, compiledBlock, numArgs and receiver as specified.."
+ 	<inline: true>
+ 	| numCopied newClosure context startIndex |
+ 	"No need to record the pushed copied values in the outerContext."
+ 	context := ignoreContext
+ 		ifTrue: [objectMemory nilObject ]
+ 		ifFalse: [self ensureFrameIsMarried: localFP SP: localSP + (numCopiedArg * objectMemory bytesPerOop)].
+ 	newClosure := self
+ 					fullClosureIn: context 
+ 					numArgs: numArgs 
+ 					numCopiedValues: numCopiedArg 
+ 					compiledBlock: compiledBlock.
+ 	cogit recordSendTrace ifTrue:
+ 		[self recordTrace: TraceBlockCreation thing: newClosure source: TraceIsFromInterpreter].
+ 	receiverIsOnStack
+ 		ifFalse: 
+ 			[ startIndex := FullClosureFirstCopiedValueIndex.
+ 			   objectMemory storePointerUnchecked: FullClosureReceiverIndex
+ 				ofObject: newClosure
+ 				withValue: self receiver.
+ 			numCopied := numCopiedArg ]
+ 		ifTrue:
+ 			[ startIndex := FullClosureReceiverIndex.
+ 			numCopied := numCopiedArg + 1 ].
+ 	numCopied > 0 ifTrue:
+ 		[0 to: numCopied - 1 do:
+ 			[ :i |
+ 			"Assume: have just allocated a new BlockClosure; it must be young.
+ 			 Thus, can use unchecked stores."
+ 			 objectMemory storePointerUnchecked: i + startIndex
+ 				ofObject: newClosure
+ 				withValue: (self internalStackValue: numCopied - i - 1)].
+ 		 self internalPop: numCopied].
+ 	self fetchNextBytecode.
+ 	self internalPush: newClosure!

Item was changed:
  ----- Method: StackInterpreter>>extPushFullClosureBytecode (in category 'stack bytecodes') -----
  extPushFullClosureBytecode
  	"255		11111111	xxxxxxxx	siyyyyyy	
  		push Closure Compiled block literal index xxxxxxxx (+ Extend A * 256) 
  		numCopied yyyyyy 
  		receiverOnStack: s = 1 
+ 		ignoreOuterContext: i = 1
- 		(i reserved for needsOuterContext: i = 1)
  	 The compiler has pushed the values to be copied, if any. The receiver has been pushed on stack before if specified. 
  	 Create a Closure with space for the copiedValues and pop numCopied values off the stack into the closure.
  	 Sets outerContext, compiledBlock, numArgs and receiver as specified.."
+ 	| compiledBlockLiteralIndex compiledBlock byte numArgs numCopied receiverIsOnStack ignoreContext |
- 	| compiledBlockLiteralIndex compiledBlock byte numArgs numCopied receiverIsOnStack |
  	compiledBlockLiteralIndex := self fetchByte + (extA << 8).
  	extA := 0.
  	compiledBlock := self literal: compiledBlockLiteralIndex.
  	self assert: (objectMemory isOopCompiledMethod: compiledBlock).
  	numArgs := self argumentCountOf: compiledBlock.
  	byte := self fetchByte.
  	numCopied := byte bitAnd: 1<< 6 - 1.
  	receiverIsOnStack := byte anyMask: 1 << 7.
+ 	ignoreContext := byte anyMask: 1 << 6.
+ 	self pushFullClosureNumArgs: numArgs copiedValues: numCopied compiledBlock: compiledBlock receiverIsOnStack: receiverIsOnStack ignoreContext: ignoreContext!
- 	self pushFullClosureNumArgs: numArgs copiedValues: numCopied compiledBlock: compiledBlock receiverIsOnStack: receiverIsOnStack!

Item was removed:
- ----- Method: StackInterpreter>>pushFullClosureNumArgs:copiedValues:compiledBlock:receiverIsOnStack: (in category 'stack bytecodes') -----
- pushFullClosureNumArgs: numArgs copiedValues: numCopiedArg compiledBlock: compiledBlock receiverIsOnStack: receiverIsOnStack
- 	"The compiler has pushed the values to be copied, if any. The receiver has been pushed on stack before if specified. 
- 	 Create a Closure with space for the copiedValues and pop numCopied values off the stack into the closure.
- 	 Sets outerContext, compiledBlock, numArgs and receiver as specified.."
- 	<inline: true>
- 	| numCopied newClosure context startIndex |
- 	"No need to record the pushed copied values in the outerContext."
- 	context := self ensureFrameIsMarried: localFP SP: localSP + (numCopiedArg * objectMemory bytesPerOop).
- 	newClosure := self
- 					fullClosureIn: context 
- 					numArgs: numArgs 
- 					numCopiedValues: numCopiedArg 
- 					compiledBlock: compiledBlock.
- 	receiverIsOnStack
- 		ifFalse: 
- 			[ startIndex := FullClosureFirstCopiedValueIndex.
- 			   objectMemory storePointerUnchecked: FullClosureReceiverIndex
- 				ofObject: newClosure
- 				withValue: self receiver.
- 			numCopied := numCopiedArg ]
- 		ifTrue:
- 			[ startIndex := FullClosureReceiverIndex.
- 			numCopied := numCopiedArg + 1 ].
- 	numCopied > 0 ifTrue:
- 		[0 to: numCopied - 1 do:
- 			[ :i |
- 			"Assume: have just allocated a new BlockClosure; it must be young.
- 			 Thus, can use unchecked stores."
- 			 objectMemory storePointerUnchecked: i + startIndex
- 				ofObject: newClosure
- 				withValue: (self internalStackValue: numCopied - i - 1)].
- 		 self internalPop: numCopied].
- 	self fetchNextBytecode.
- 	self internalPush: newClosure!

Item was added:
+ ----- Method: StackInterpreter>>pushFullClosureNumArgs:copiedValues:compiledBlock:receiverIsOnStack:ignoreContext: (in category 'stack bytecodes') -----
+ pushFullClosureNumArgs: numArgs copiedValues: numCopiedArg compiledBlock: compiledBlock receiverIsOnStack: receiverIsOnStack ignoreContext: ignoreContext
+ 	"The compiler has pushed the values to be copied, if any. The receiver has been pushed on stack before if specified. 
+ 	 Create a Closure with space for the copiedValues and pop numCopied values off the stack into the closure.
+ 	 Sets outerContext, compiledBlock, numArgs and receiver as specified.."
+ 	<inline: true>
+ 	| numCopied newClosure context startIndex |
+ 	"No need to record the pushed copied values in the outerContext."
+ 	context := ignoreContext
+ 		ifTrue: [objectMemory nilObject ]
+ 		ifFalse: [self ensureFrameIsMarried: localFP SP: localSP + (numCopiedArg * objectMemory bytesPerOop)].
+ 	newClosure := self
+ 					fullClosureIn: context 
+ 					numArgs: numArgs 
+ 					numCopiedValues: numCopiedArg 
+ 					compiledBlock: compiledBlock.
+ 	receiverIsOnStack
+ 		ifFalse: 
+ 			[ startIndex := FullClosureFirstCopiedValueIndex.
+ 			   objectMemory storePointerUnchecked: FullClosureReceiverIndex
+ 				ofObject: newClosure
+ 				withValue: self receiver.
+ 			numCopied := numCopiedArg ]
+ 		ifTrue:
+ 			[ startIndex := FullClosureReceiverIndex.
+ 			numCopied := numCopiedArg + 1 ].
+ 	numCopied > 0 ifTrue:
+ 		[0 to: numCopied - 1 do:
+ 			[ :i |
+ 			"Assume: have just allocated a new BlockClosure; it must be young.
+ 			 Thus, can use unchecked stores."
+ 			 objectMemory storePointerUnchecked: i + startIndex
+ 				ofObject: newClosure
+ 				withValue: (self internalStackValue: numCopied - i - 1)].
+ 		 self internalPop: numCopied].
+ 	self fetchNextBytecode.
+ 	self internalPush: newClosure!



More information about the Vm-dev mailing list