VM Maker: VMMaker.oscog-eem.2168.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

VM Maker: VMMaker.oscog-eem.2168.mcz

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

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

Name: VMMaker.oscog-eem.2168
Author: eem
Time: 20 March 2017, 9:36:24.734633 am
UUID: f11daee9-39ca-42c3-b82a-69194460407a
Ancestors: VMMaker.oscog-eem.2167

Cogit:
Implement the SysV/WIN64 split for the X64 cogit file.

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

Item was added:
+ ----- Method: CogAbstractInstruction class>>ifTranslateableAddWithOptionsTo: (in category 'translation') -----
+ ifTranslateableAddWithOptionsTo: aCollection
+ (self wordSize = Cogit objectMemoryClass wordSize
+ and: [self identifyingPredefinedMacros notNil]) ifTrue:
+ [aCollection add: {self. {#ISA. self ISA}}]!

Item was removed:
- ----- Method: CogAbstractInstruction class>>translateableSubclasses (in category 'translation') -----
- translateableSubclasses
- "CogAbstractInstruction translateableSubclasses"
- ^self subclasses select:
- [:compilerClass|
- compilerClass wordSize = Cogit objectMemoryClass wordSize
- and: [compilerClass identifyingPredefinedMacros notNil]]!

Item was added:
+ ----- Method: CogAbstractInstruction class>>translateableSubclassesAndOptions (in category 'translation') -----
+ translateableSubclassesAndOptions
+ "CogAbstractInstruction translateableSubclassesAndOptions"
+ | translateableSubclassesAndOptions |
+ translateableSubclassesAndOptions := OrderedCollection new.
+ self subclasses do:
+ [:subclass|
+ subclass ifTranslateableAddWithOptionsTo: translateableSubclassesAndOptions].
+ ^translateableSubclassesAndOptions sort:
+ [:a :b|
+ a first name < b first name
+ or: [a first name = b first name "If equal, sort on the ABI"
+ and: [a last last < b last last]]]!

Item was added:
+ ----- Method: CogX64Compiler class>>ifTranslateableAddWithOptionsTo: (in category 'translation') -----
+ ifTranslateableAddWithOptionsTo: aCollection
+ "Override to create cogitX64.c and cogitX64Win64.c"
+ (self wordSize = Cogit objectMemoryClass wordSize
+ and: [self identifyingPredefinedMacros notNil]) ifTrue:
+ [aCollection
+ add: {self. {#ISA. self ISA. #ABI. #SysV}};
+ add: {self. {#ISA. self ISA. #ABI. #WIN64}}]!

Item was added:
+ ----- Method: CogX64Compiler class>>moduleName (in category 'translation') -----
+ moduleName
+ "CogAbstractInstruction subclasses collect: [:ea| ea moduleName]"
+ ^'cogit', self ISA, (initializationOptions at: #ABI ifAbsent: [''])!

Item was changed:
  ----- Method: Cogit class>>generateCodeStringForCogitDotC (in category 'translation') -----
  generateCodeStringForCogitDotC
  "Generate a skeletal cogit.c that includes the relevant cogitFOO.c
  for the appropriate subclasses of CogAbstractInstruction."
 
  ^String streamContents:
  [:s|
  s nextPutAll: '/* Automatically generated by\ ' withCRs.
  s nextPutAll: (CCodeGenerator monticelloDescriptionFor: self).
  s cr; nextPutAll: ' */'.
  s cr; cr; nextPut: $#.
+ self translateableInstructionSubclassesAndInstalledOptionsDo:
- (CogAbstractInstruction translateableSubclasses sort: [:a :b| a name < b name]) do:
  [:class |
  s nextPutAll: 'if '.
  class identifyingPredefinedMacros
  do: [:predefinedMacro| s nextPutAll: 'defined('; nextPutAll: predefinedMacro; nextPut: $)]
  separatedBy: [s nextPutAll: ' || '].
  s cr; cr; nextPutAll: '# include "'; nextPutAll: class moduleName; nextPutAll: '.c"'.
  s cr; cr; nextPutAll: '#el'].
  s nextPutAll: 'se'.
  #( 'As yet no Cogit implementation appears to exist for your platform.'
  'Consider implementing it, starting by adding a subclass of CogAbstractInstruction.') do:
  [:msg| s cr; nextPutAll: '# error '; nextPutAll: msg].
  s cr; nextPutAll: '#endif'; cr]!

Item was added:
+ ----- Method: Cogit class>>translateableInstructionSubclassesAndInstalledOptionsDo: (in category 'translation') -----
+ translateableInstructionSubclassesAndInstalledOptionsDo: aBlock
+ "Evaluate aBlock with the translateable subclass and its options installed, being careful to clean-up afterwards."
+ CogAbstractInstruction translateableSubclassesAndOptions do:
+ [:pair|
+ [:class :options| | toRemove |
+ toRemove := Set new.
+ options pairsDo:
+ [:key :value|
+ (initializationOptions includesKey: key) ifFalse:
+ [toRemove add: key].
+ initializationOptions at: key put: value].
+ aBlock value: class.
+ toRemove do: [:key| initializationOptions removeKey: key]]
+ valueWithArguments: pair]!

Item was changed:
  ----- Method: VMMaker>>generateCogitFiles (in category 'generate sources') -----
  generateCogitFiles
+ "Translate the Smalltalk description of the virtual machine's JITs into C."
- "Translate the Smalltalk description of the virtual machine into C.  If 'self doInlining' is true, small method bodies are inlined to reduce procedure call overhead.  On the PPC, this results in a factor of three speedup with only 30% increase in code size.  Subclasses can use specialised versions of CCodeGenerator and interpreterClass."
-
  | cogitClass cg |
  (cogitClass := self interpreterClass cogitClass) ifNil: [^nil].
  self generateCogitIncludeFileFor: cogitClass.
+ cogitClass translateableInstructionSubclassesAndInstalledOptionsDo:
- CogAbstractInstruction translateableSubclasses do:
  [:compilerClass|
- optionsDictionary at: #ISA put: compilerClass ISA.
  cg := self generateCogitFileFor: cogitClass].
  cg vmClass additionalHeadersDo:
  [:headerName :headerContents| | filePath |
  filePath := self coreVMDirectory fullNameFor: headerName.
  (cg needToGenerateHeader: headerName file: filePath contents: headerContents) ifTrue:
  [cg storeHeaderOnFile: filePath contents: headerContents]].
  cogitClass apiExportHeaderName ifNotNil:
  [cg storeAPIExportHeader: cogitClass apiExportHeaderName
  OnFile: (self sourceFilePathFor: cogitClass apiExportHeaderName)]!

Item was changed:
  ----- Method: VMMaker>>needsToRegenerateCogitFile (in category 'generate sources') -----
  needsToRegenerateCogitFile
  "Check the timestamp for the relevant classes and then the timestamp for the main source file (e.g. interp.c)
  file if it already exists. Answer if the file needs regenerating."
 
  | cogitClass cogitClasses tStamp |
  cogitClasses := (cogitClass := self interpreterClass cogitClass) withAllSuperclasses copyUpThrough: Cogit.
  cogitClasses addAllLast: (cogitClass ancilliaryClasses: self options).
  tStamp := cogitClasses inject: 0 into: [:tS :cl| tS max: cl timeStamp].
 
+ "don't translate if the file(s) is newer than my timeStamp"
+ ((self coreVMDirectory fileNamesMatching: cogitClass activeCompilerClass moduleName, '*') allSatisfy:
+ [:fileName|
+ (self coreVMDirectory entryAt: fileName ifAbsent: [nil])
+ ifNil: [false]
+ ifNotNil:
+ [:fstat| | mTime |
+ mTime := fstat modificationTime.
+ mTime isInteger ifFalse: [mTime := mTime asSeconds].
+ tStamp > mTime]]) ifTrue:
+ [^self confirm: ('The ', self configurationNameIfAny, cogitClass printString,
+ ', ', cogitClass activeCompilerClass, '\classes have not been modified since the ',
+ cogitClass processorSpecificSourceFileName,
+ ' source file\was last generated.  Do you still want to regenerate it?') withCRs].
- "don't translate if the file is newer than my timeStamp"
- (self coreVMDirectory entryAt: cogitClass processorSpecificSourceFileName ifAbsent: [nil]) ifNotNil:
- [:fstat| | mTime |
- mTime := fstat modificationTime.
- mTime isInteger ifFalse: [mTime := mTime asSeconds].
- tStamp < mTime ifTrue:
- [^self confirm: ('The ', self configurationNameIfAny, cogitClass printString,
- ', ', cogitClass activeCompilerClass, '\classes have not been modified since the ',
- cogitClass processorSpecificSourceFileName,
- ' source file\was last generated.  Do you still want to regenerate it?') withCRs]].
  ^true!

Loading...