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

commits at source.squeak.org commits at source.squeak.org
Thu Jan 3 21:36:39 UTC 2013


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

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

Name: VMMaker.oscog-eem.247
Author: eem
Time: 3 January 2013, 1:34:32.442 pm
UUID: 16558e1b-de42-458d-a01d-6f2230d165b7
Ancestors: VMMaker.oscog-eem.246

Integrate directed shift changes from cog issue 111 that affect the
CoInterpreter and Cogit.

Refactor Monticello build info so that plugin classes can override.
Make the trnalsated primitive plugins include info from their
primitive supplying classes.

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

Item was added:
+ ----- Method: ADPCMCodecPlugin class>>monticelloDescription (in category 'translation') -----
+ monticelloDescription
+ 	"Override to include the ADPCMCodec class."
+ 	"self monticelloDescription"
+ 	^super monticelloDescription, '\' withCRs, (CCodeGenerator monticelloDescriptionFor: ADPCMCodec)!

Item was added:
+ ----- Method: CCodeGenerator class>>monticelloDescriptionFor: (in category 'C code generator') -----
+ monticelloDescriptionFor: aClass
+ 	"Answer a suitable Monticello package stamp to include in the header."
+ 	| pkgInfo pkg uuid |
+ 	pkgInfo := PackageOrganizer default packageOfClass: aClass.
+ 	pkg := MCWorkingCopy allManagers detect: [:ea| ea packageName = pkgInfo packageName].
+ 	pkg ancestry ancestors isEmpty ifFalse:
+ 		[uuid := pkg ancestry ancestors first id].
+ 	^aClass name, (pkg modified ifTrue: [' * '] ifFalse: [' ']), pkg ancestry ancestorString, ' uuid: ', uuid asString!

Item was changed:
  ----- Method: CCodeGenerator>>fileHeaderVersionStampForSourceClass: (in category 'C code generator') -----
  fileHeaderVersionStampForSourceClass: sourceClass
+ 	"Answer a suitable version stamp to include in the header."
- 	"Answer a suitable versiomn stamp to include in the header."
  	| exportBuildInfo slangDescription sourceDescription |
  	[exportBuildInfo := sourceClass isInterpreterClass
  						ifTrue: ['char *__interpBuildInfo = __buildInfo;']
  						ifFalse:
  							[sourceClass isCogitClass
  								ifTrue: ['char *__cogitBuildInfo = __buildInfo;']
  								ifFalse:
  									[sourceClass isPluginClass ifTrue:
  										[sourceClass exportBuildInfoOrNil]]]]
  		on: MessageNotUnderstood
  		do: [:ex| ex resume: false].
+ 	[slangDescription := self class monticelloDescriptionFor: self class.
- 	[slangDescription := self monticelloDescriptionFor: self class.
  	 sourceClass ifNotNil:
+ 		[sourceDescription := [sourceClass monticelloDescription]
+ 								on: MessageNotUnderstood
+ 								do: [:ex| self class monticelloDescriptionFor: sourceClass]]]
- 		[sourceDescription := self monticelloDescriptionFor: sourceClass]]
  		on: Error
  		do: [:ex| | now |
  			now := Time dateAndTimeNow printString.
  			^String streamContents:
  				[:s|
  				s nextPutAll: '/* Automatically generated from Squeak on '.
  				s nextPutAll: now.
  				s nextPutAll: ' */'; cr; cr.
  				s nextPutAll: 'static char __buildInfo[] = "Generated on '.
  				s nextPutAll: now.
  				s nextPutAll: '. Compiled on "'.
  				s nextPutAll: '__DATE__ ;'; cr.
  				exportBuildInfo ifNotNil:
  					[s nextPutAll: exportBuildInfo; cr].
  				s cr]].
  	^String streamContents:
  		[:s|
+ 		s nextPutAll: '/* Automatically generated by\	' withCRs.
+ 		s nextPutAll: (slangDescription copyReplaceAll: '\' withCRs with: '\	' withCRs)..
- 		s nextPutAll: '/* Automatically generated by'.
- 		s crtab.
- 		s nextPutAll: slangDescription.
  		sourceDescription ifNotNil:
+ 			[s nextPutAll: '\   from\	' withCRs; nextPutAll: sourceDescription].
- 			[s cr; nextPutAll: '   from'; crtab; nextPutAll: sourceDescription].
  		s cr; nextPutAll: ' */'; cr.
  		sourceDescription ifNotNil:
  			[s nextPutAll: 'static char __buildInfo[] = "'.
  			 s nextPutAll: sourceDescription.
  			 s nextPutAll: ' " __DATE__ ;'; cr.
  			exportBuildInfo ifNotNil:
  				[s nextPutAll: exportBuildInfo; cr].
  			s cr]]!

Item was removed:
- ----- Method: CCodeGenerator>>monticelloDescriptionFor: (in category 'C code generator') -----
- monticelloDescriptionFor: aClass
- 	"Answer a suitable Monticello package stamp to include in the header."
- 	| pkgInfo pkg uuid |
- 	pkgInfo := PackageOrganizer default packageOfClass: aClass.
- 	pkg := MCWorkingCopy allManagers detect: [:ea| ea packageName = pkgInfo packageName].
- 	pkg ancestry ancestors isEmpty ifFalse:
- 		[uuid := pkg ancestry ancestors first id].
- 	^aClass name, (pkg modified ifTrue: [' * '] ifFalse: [' ']), pkg ancestry ancestorString, ' uuid: ', uuid asString!

Item was changed:
  ----- Method: CCodeGenerator>>needToGenerateHeader:file:contents: (in category 'C code generator') -----
  needToGenerateHeader: headerName file: interpHdrPath contents: newContentsArg
  	"Check if we need to regenerate a header file.  We always need to if the contents have changed.
  	 But if not we can avoid needless recompilations by not regenerating.  So only regenerate if the
  	 package is clean (version doesn't include a '*').  If we can't find a package version ask the user."
  	| newContents oldContents |
  	(FileDirectory default fileExists: interpHdrPath) ifFalse:
  		[^true].
  	newContents := newContentsArg.
  	oldContents := (FileDirectory default oldFileNamed: interpHdrPath) contentsOfEntireFile.
  	(newContents beginsWith: '/*') = (oldContents beginsWith: '/*') ifFalse:
  		[(newContents beginsWith: '/*') ifTrue:
  			[newContents := newContents readStream upToAll: '*/'; skipSeparators; upToEnd].
  		 (oldContents beginsWith: '/*') ifTrue:
  			[oldContents := oldContents readStream upToAll: '*/'; skipSeparators; upToEnd]].
  	oldContents := oldContents copyReplaceAll: {Character cr. Character lf} with: {Character cr}.
  	oldContents replaceAll: Character lf with: Character cr.
  	^oldContents ~= newContents
+ 	 or: [[((self class monticelloDescriptionFor: vmClass) includes: $*) not]
- 	 or: [[((self monticelloDescriptionFor: vmClass) includes: $*) not]
  			on: Error
  			do: [:ex|
  				self confirm: headerName, ' contents are unchanged.\Writing the file may cause recompilation of support files.\Do you want to write the header file?\The interpreter will still be written either way.' withCRs]]!

Item was changed:
  ----- Method: CCodeGenerator>>shortMonticelloDescriptionForClass: (in category 'C code generator') -----
  shortMonticelloDescriptionForClass: aClass
  	"Answer a suitable Monticello package stamp to include in a moduleName."
  	| mdesc |
+ 	mdesc := [self class monticelloDescriptionFor: aClass]
- 	mdesc := [self monticelloDescriptionFor: aClass]
  				on: Error
  				do: [:ex| ^' ', Date today asString].
  	^mdesc copyFrom: 1 to: (mdesc indexOfSubCollection: ' uuid:') - 1!

Item was changed:
  ----- Method: CoInterpreter>>ifBackwardsCheckForEvents: (in category 'jump bytecodes') -----
  ifBackwardsCheckForEvents: offset
  	"Backward jump means we're in a loop.
  		- check for possible interrupts.
  		- check for long-running loops and JIT if appropriate."
  	| switched |
  	<inline: true>
  	offset < 0 ifTrue:
  		[localSP < stackLimit ifTrue:
  			[self externalizeIPandSP.
  			 switched := self checkForEventsMayContextSwitch: true.
  			 self returnToExecutive: true postContextSwitch: switched.
  			 self browserPluginReturnIfNeeded.
  			 self internalizeIPandSP].
  		method = lastBackwardJumpMethod
  			ifTrue:
  				[(backwardJumpCount := backwardJumpCount - 1) <= 0 ifTrue:
  					[(self methodWithHeaderShouldBeCogged: (self headerOf: method))
  						ifTrue:
  							[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 << (BytesPerWord * 8 - 2)]]]
- 							[backwardJumpCount := 1 bitShift: BytesPerWord * 8 - 2]]]
  			ifFalse:
  				[lastBackwardJumpMethod := method.
  				backwardJumpCount := minBackwardJumpCountForCompile]]!

Item was added:
+ ----- Method: MiscPrimitivePlugin class>>monticelloDescription (in category 'translation') -----
+ monticelloDescription
+ 	"Override to include the primitive-supplying classes."
+ 	"self monticelloDescription"
+ 	^super monticelloDescription, '\' withCRs,
+ 	 ((self translatedPrimitives
+ 		collect: [:pair| CCodeGenerator monticelloDescriptionFor: (Smalltalk classNamed: pair first)])
+ 			asSet asArray sort reduce: [:a :b| a, '\' withCRs, b])!

Item was added:
+ ----- Method: SoundGenerationPlugin class>>monticelloDescription (in category 'translation') -----
+ monticelloDescription
+ 	"Override to include the AbstractSound class."
+ 	"self monticelloDescription"
+ 	^super monticelloDescription, '\' withCRs, (CCodeGenerator monticelloDescriptionFor: AbstractSound)!

Item was changed:
  ----- Method: StackInterpreter>>stackPageByteSize (in category 'stack pages') -----
  stackPageByteSize
  	"Room for 512 bytes of frames gives around 40 frames a page which is a
  	 good compromise between overflow rate and latency in divorcing a page."
  	<inline: false>
+ 	^1 << (512 + self stackLimitOffset + self stackPageHeadroom - 1) highBit!
- 	^1 bitShift: (512 + self stackLimitOffset + self stackPageHeadroom - 1) highBit!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>registerMaskFor: (in category 'simulation stack') -----
  registerMaskFor: reg
  	"Answer a bit mask identifying the symbolic register.
  	 Registers are negative numbers."
+ 	^1 << (1 - reg)!
- 	^1 bitShift: 1 - reg!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>registerMaskFor:and: (in category 'simulation stack') -----
  registerMaskFor: reg1 and: reg2
  	"Answer a bit mask identifying the symbolic registers.
  	 Registers are negative numbers."
+ 	^1 << (1 - reg1) bitOr: 1 << (1 - reg2)!
- 	^(1 bitShift: 1 - reg1) bitOr: (1 bitShift: 1 - reg2)!

Item was changed:
  ----- Method: StackToRegisterMappingCogit>>registerMaskFor:and:and: (in category 'simulation stack') -----
  registerMaskFor: reg1 and: reg2 and: reg3
  	"Answer a bit mask identifying the symbolic registers.
  	 Registers are negative numbers."
+ 	^(1 << (1 - reg1) bitOr: 1 << (1 - reg2)) bitOr: 1 << (1 - reg3)!
- 	^((1 bitShift: 1 - reg1) bitOr: (1 bitShift: 1 - reg2)) bitOr: (1 bitShift: 1 - reg3)!

Item was added:
+ ----- Method: VMClass class>>monticelloDescription (in category 'translation') -----
+ monticelloDescription
+ 	"Answer the Monticello version of the packlage containing the receiver.
+ 	 This is a hook to allow subclasses to expand upon the default monticello description."
+ 	^CCodeGenerator monticelloDescriptionFor: self!



More information about the Vm-dev mailing list