[squeak-dev] The Trunk: Compiler-eem.363.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jan 5 20:23:56 UTC 2018


Eliot Miranda uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-eem.363.mcz

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

Name: Compiler-eem.363
Author: eem
Time: 5 January 2018, 12:23:47.49447 pm
UUID: e6e0f44c-156f-4ba2-a96b-044cc09da7e2
Ancestors: Compiler-eem.362

Use the blockReturnNilToCaller bytecode in full blocks.  Add a postscript to remove empty categories in ParseNode and subclasses (to get rid of the obsolte and empty code generation (closures) protocols).

=============== Diff against Compiler-eem.362 ===============

Item was changed:
+ ----- Method: BlockNode>>createBlockLiteral: (in category 'code generation') -----
- ----- Method: BlockNode>>createBlockLiteral: (in category 'code generation (closures)') -----
  createBlockLiteral: encoder
  	^self
  		reindexingLocalsDo:
  			[encoder reindexingLiteralsDo:
  				[encoder copyWithNewLiterals
  					generateBlockMethodOfClass: CompiledBlock
  					trailer: CompiledMethodTrailer empty
  					from: self]]
  		encoder: encoder!

Item was changed:
  ----- Method: BlockNode>>emitCodeForEvaluatedFullClosureValue:encoder: (in category 'code generation') -----
  emitCodeForEvaluatedFullClosureValue: stack encoder: encoder
  	| position |
  	position := stack position.
  	self emitCodeExceptLast: stack encoder: encoder.
+ 	(statements last == NodeNil
+ 	 and: [self returns not])
+ 		ifTrue:
+ 			[stack push: 1.
+ 			 encoder genReturnNilToCaller.
+ 			 pc := encoder methodStreamPosition]
+ 		ifFalse:
+ 			[statements last emitCodeForBlockValue: stack encoder: encoder.
+ 			 self returns ifFalse:
+ 				[encoder genReturnTopToCaller.
+ 				 pc := encoder methodStreamPosition]].
- 	statements last emitCodeForBlockValue: stack encoder: encoder.
- 	self returns ifFalse:
- 		[encoder genReturnTopToCaller.
- 		 pc := encoder methodStreamPosition].
  	self assert: stack position - 1 = position!

Item was changed:
+ ----- Method: BlockNode>>emitCodeForFullBlockValue:encoder: (in category 'code generation') -----
- ----- Method: BlockNode>>emitCodeForFullBlockValue:encoder: (in category 'code generation (closures)') -----
  emitCodeForFullBlockValue: stack encoder: encoder
  	copiedValues do:
  		[:copiedValue| copiedValue emitCodeForValue: stack encoder: encoder].
  	encoder
  		genPushFullClosure: closureCreationNode index
  		numCopied: copiedValues size.
  	stack
  		pop: copiedValues size;
  		push: 1!

Item was changed:
  ----- Method: BlockNode>>sizeCodeForEvaluatedFullClosureValue: (in category 'code generation') -----
  sizeCodeForEvaluatedFullClosureValue: encoder
  	"The closure value primitives push the arguments and the copied values.
  	 The compiler guarantees that any copied values come before all local temps.
  	 So on full closure activation we need do nothing."
+ 	(statements last == NodeNil
+ 	 and: [self returns not]) ifTrue:
+ 		[^encoder sizeReturnNilToCaller].
  	^(self sizeCodeForEvaluatedValue: encoder)
  	+ (self returns ifTrue: [0] ifFalse: [encoder sizeReturnTopToCaller])!

Item was added:
+ ----- Method: BytecodeEncoder>>sizeReturnNilToCaller (in category 'opcode sizing') -----
+ sizeReturnNilToCaller
+ 	^self sizeOpcodeSelector: #genReturnNilToCaller withArguments: #()!

Item was added:
+ ----- Method: EncoderForSistaV1>>genReturnNilToCaller (in category 'bytecode generation') -----
+ genReturnNilToCaller
+ 	"93			01011101			BlockReturn nil [* return from enclosing block N, ExtA]"
+ 	"If extended, the least significant bit of the extension determines if we return to the caller or not
+ 	 and the most significant bits determine how many levels of the static chain to return from.
+ 		ExtA = iiiiiiij
+ 		iiiiiii=0,j=0	=>	return to caller
+ 		iiiiiii=0,j=1	=>	illegal
+ 		iiiiiii=1,j=0	=>	return to outerContext
+ 		iiiiiii=1,j=1	=>	return to outerContext sender/return from outerContext
+ 		iiiiiii=2,j=0	=>	return to outerContext outerContext
+ 		iiiiiii=2,j=1	=>	return to outerContext outerContext sender/return from outerContext outerContext
+ 		etc"
+ 
+ 	stream nextPut: 93!

Item was changed:
  (PackageInfo named: 'Compiler') postscript: '"below, add code to be run after the loading of this package"
+ "Make sure that all those ``code generation (closures)'''' categoies disappear"
+ ParseNode withAllSubclasses do:
+ 	[:pnc| pnc organization removeEmptyCategories]'!
- "Make sure all methods using to:do: and to:by:do: are recompiled"
- UIManager default
- 	informUser: ''Recompiling methods sending to:do: and to:by:do:''
- 	during: 
- 		[(self systemNavigation allMethodsSelect:
- 			[:m|
- 			#(to:do: to:by:do:) anySatisfy: [:l| m refersToLiteral: l]]) do:
- 			[:mr| mr actualClass recompile: mr selector]]'!



More information about the Squeak-dev mailing list