VM Maker Inbox: Cog-bgs.374.mcz

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

VM Maker Inbox: Cog-bgs.374.mcz

commits-2
 
A new version of Cog was added to project VM Maker Inbox:
http://source.squeak.org/VMMakerInbox/Cog-bgs.374.mcz

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

Name: Cog-bgs.374
Author: bgs
Time: 19 February 2020, 7:17:47.528515 pm
UUID: 552020b8-0d57-40ab-95ed-1330c3aa4039
Ancestors: Cog-eem.373

Factor #createNewCPU into its own method.

This facilitates switching between simulator implementations.
Having monolithic #new had the following two problems: (1) even if implementationClass pointed to something different, it was still creating an actual C struct corresponding to the original class; (2) it insisted that the implementationClass implement #atAddress: which is internal business of the implementation class.

=============== Diff against Cog-eem.373 ===============

Item was added:
+ ----- Method: CogProcessorAlien class>>createNewCPU (in category 'instance creation') -----
+ createNewCPU
+ ^self atAddress: self primitiveNewCPU
+ "Factoring this to its own method is done to be able to switch
+ between different implementations of the simulator such as
+ Alien, Petrich-1 GEM5-over-RSP or Petrich-2 symbolic execution."!

Item was changed:
  ----- Method: CogProcessorAlien class>>new (in category 'instance creation') -----
  new
  | sim |
+ sim := self implementationClass createNewCPU.
- sim := self implementationClass atAddress: self primitiveNewCPU.
  sim reset.
  SavedState at: sim put: nil.
  ^sim!