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

commits at source.squeak.org commits at source.squeak.org
Sat Jul 25 20:44:53 UTC 2020


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

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

Name: VMMaker.oscog-eem.2780
Author: eem
Time: 25 July 2020, 1:44:44.159824 pm
UUID: 5e381464-117c-4633-8fe7-a95973208436
Ancestors: VMMaker.oscog-eem.2779

Slang: Make the necessary changes to TCaseStmtNode for the last commit (already done for TSwitchStmtNode). 
Fix the formatting of generateRemapOopIn:on:indent: given those canges.

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

Item was changed:
  ----- Method: TCaseStmtNode>>emitCCodeOn:addToEndOfCases:level:generator: (in category 'C code generation') -----
  emitCCodeOn: aStream addToEndOfCases: aNodeOrNil level: level generator: aCodeGen
  
  	| indent |
  	indent := String new: level withAll: Character tab.
  	aStream nextPutAll: 'switch ('.
  	expression emitCCodeAsArgumentOn: aStream level: level generator: aCodeGen.
  	aStream nextPutAll: ') {'; cr.
  	cases withIndexDo:
  		[:case :i|
+ 		 (firsts at: i) to: (lasts at: i) do:
- 		(firsts at: i) to: (lasts at: i) do:
  			[ :caseIndex |
  			aStream nextPutAll: indent; nextPutAll: 'case '; print: caseIndex; nextPut: $:; cr].
+ 		 case emitCCodeOn: aStream prependToEnd: aNodeOrNil level: level + 1 generator: aCodeGen.
+ 		 (aNodeOrNil notNil and: [aNodeOrNil isReturn]) ifFalse:
+ 			[aStream crtab: level + 1; nextPutAll: 'break;'].
+ 		 aStream cr].
- 		  case emitCCodeOn: aStream prependToEnd: aNodeOrNil level: level + 1 generator: aCodeGen.
- 		  (aNodeOrNil notNil and: [aNodeOrNil isReturn]) ifFalse:
- 			[aStream crtab: level + 1; nextPutAll: 'break;']].
  	aStream
  		crtab: level;
  		nextPutAll: 'default:';
  		crtab: level + 1;
  		nextPutAll: 'error("Case not found");'.
  	aNodeOrNil ifNotNil:
  		[aStream crtab: level + 1.
  		 (aNodeOrNil copy setExpression: (TConstantNode new setValue: -1))
  			emitCCodeOn: aStream level: level generator: aCodeGen.
  		 aStream nextPut: $;].
  	aStream
  		crtab: level;
  		nextPut: $}!

Item was changed:
  ----- Method: TSendNode>>needsTrailingSemicolon (in category 'testing') -----
  needsTrailingSemicolon
  	"Answer if, when emitted as a statement (in particular in a TStmtList), the
  	 receiver needs a trailing semicolon.  Preprocessor directives and special expansions do not."
  	^(self isPreprocessorDirective
  	   or: [self isValueExpansion
  	   or: [self isConditionalSend
+ 	   or: [selector == #expandDereferenceInterpreterProxyFunctionTable
+ 	   or: [selector == #remapOop:in:]]]]) not!
- 	   or: [selector == #expandDereferenceInterpreterProxyFunctionTable]]]) not!

Item was changed:
  ----- Method: VMPluginCodeGenerator>>generateRemapOopIn:on:indent: (in category 'C translation') -----
  generateRemapOopIn: aNode on: aStream indent: level
  	"Generate the C code for this message onto the given stream."
  	| arm |
  	"Avoid nesting #if SPURVM...#else...#endif within arms of an outer #if SPURVM...#else...#endif."
  	(Notification new tag: #inRemapOopInArm; signal) ifNotNil:
  		[:inRemapOopInArm|
  		 ^inRemapOopInArm
  			ifTrue: [self generateSpurRemapOopIn: aNode on: aStream indent: level]
  			ifFalse: [self generateV3RemapOopIn: aNode on: aStream indent: level]].
  	[aStream cr; nextPutAll: '#if SPURVM'; cr.
  	 arm := true.
  	 self generateSpurRemapOopIn: aNode on: aStream indent: level.
+ 	 aStream ensureCr; nextPutAll: '#else /* SPURVM */'; cr.
- 	 aStream cr; nextPutAll: '#else /* SPURVM */'; cr.
  	 arm := false.
  	 self generateV3RemapOopIn: aNode on: aStream indent: level.
  	 aStream cr; nextPutAll: '#endif /* SPURVM */'; cr]
  		on: Notification
  		do: [:ex|
  			ex tag == #inRemapOopInArm
  				ifTrue: [ex resume: arm]
  				ifFalse: [ex pass]]!

Item was changed:
  ----- Method: VMPluginCodeGenerator>>generateV3RemapOopIn:on:indent: (in category 'C translation') -----
  generateV3RemapOopIn: aNode on: aStream indent: level
  	"Generate call on remapOop: for the variable oopOrList (or all of the
  	 variables in oopOrList) before evaluating aBlock, and restore them after.
  	 This keeps the oops valid if, as V3 will, there is a GC on allocation."
  
  	| idList |
  	pluginFunctionsUsed add: #pushRemappableOop:; add: #popRemappableOop.
  	idList := aNode args first nameOrValue.
  	idList class == Array ifFalse: [idList := Array with: idList].
  	idList do:
  		[:each | 
  		 aStream
  			tab: level;
  			nextPutAll: 'pushRemappableOop(';
  			nextPutAll: each asString;
  			nextPutAll: ');']
  		separatedBy: [aStream cr].
  	aStream cr.
  	aNode args second emitCCodeOn: aStream level: level generator: self.
- 	level timesRepeat: [aStream tab].
  	idList reversed do:
  		[:each |
  		 aStream
  			tab: level;
  			nextPutAll: each asString;
  			nextPutAll: ' = popRemappableOop();']
  		separatedBy: [aStream cr]!



More information about the Vm-dev mailing list