[Vm-dev] VM Maker: VMMaker.oscog-cb.1648.mcz

commits at source.squeak.org commits at source.squeak.org
Mon Jan 18 11:00:35 UTC 2016

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-cb.1648
Author: cb
Time: 18 January 2016, 11:59:22.027 am
UUID: c46bfd06-cfad-408f-a561-675b25295f41
Ancestors: VMMaker.oscog-eem.1647

Fixed a compilation problem.

Looks like the Stack VM works fine with immutability. Although I am not sure as the VM I generate right now is not very stable (but it doesn't seem to be related to immutability, when I disable it I have the same crashes).

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

Item was changed:
  ----- Method: InterpreterPrimitives>>canBeImmutable: (in category 'object access primitives') -----
  canBeImmutable: oop
  	<option: #IMMUTABILITY>
  	| scheduler processLists |
  	self assert: (objectMemory isNonImmediate: oop).
  	"For now we fail the primitive for contexts to we ensure there are no immutable contexts.
  	Later we can consider having immutable contexts and send cannotReturn callback
  	when returning to an immutable context. That would mean that setting a context 
  	to immutable would require a divorce and returns to immutable context are 
  	necessarily across stack pages"
  	(objectMemory isContext: oop) ifTrue: [ ^ false ].
  	"I don't get it for semaphores so they can't be immutable"
  	(objectMemory isSemaphoreObj: oop) ifTrue: [^ false].
  	"simple version of process management: we forbid Process and LinkedList instances to be immutable 
  	as well as the Processor and the array of activeProcess"
  	scheduler := self fetchPointer: ValueIndex ofObject: (self splObj: SchedulerAssociation).
  	processLists := objectMemory fetchPointer: ProcessListsIndex ofObject: scheduler.
  	oop = scheduler ifTrue: [ ^ false ].
  	oop = processLists ifTrue: [ ^ false ].
  	"Is it a linkedList ?"
+ 	(objectMemory classIndexOf: (objectMemory fetchPointer: 1 ofObject: processLists)) = (objectMemory classIndexOf: oop) ifTrue: [ ^ false ].
- 	(objectMemory classIndexOf: (processLists at: 1)) = (objectMemory classIndexOf: oop) ifTrue: [ ^ false ].
  	"is it a Process ?"
  	(objectMemory classIndexOf: (objectMemory fetchPointer: ActiveProcessIndex ofObject: scheduler)) =  (objectMemory classIndexOf: oop) ifTrue: [ ^ false ].
  	"The rest of the code is relative to process management: the Processor (the active 
  	process scheduler) can't be immutable, as well as all the objects relative to Process management "
  	"scheduler := self fetchPointer: ValueIndex ofObject: (self splObj: SchedulerAssociation).
  	processLists := objectMemory fetchPointer: ProcessListsIndex ofObject: scheduler.
  	((objectMemory formatOf: oop) = objectMemory nonIndexablePointerFormat)
  			[ (objectMemory isArrayNonImm: oop) ifFalse: [ ^ true ].
  			  ^ (oop = processLists) not ].
  	(objectMemory numSlotsOf: oop) >= 2 ifFalse: [ ^ true ].
  	""is the oop the scheduler itself ?""
  	oop = scheduler ifTrue: [ ^ false ].
  	1 to: (objectMemory numSlotsOf: processLists) do: [ :i |
  		""is the oop one of the linked lists ?""
  		(list := processLists at: i) = oop ifTrue: [^ false].
  		""is the oop one of the runnable process ?""
  		first := objectMemory fetchPointer: FirstLinkIndex ofObject: list.
  		first = objectMemory nilObject ifFalse: 
  			[ last := objectMemory fetchPointer: LastLinkIndex ofObject: list.
  			  link := first.
  			  [ link = last ] whileFalse: 
  				[ link = oop ifTrue: [ ^ false ]. 
  				  link := objectMemory fetchPointer: NextLinkIndex ofObject: link. ] ] ]."
  	^ true!

Item was added:
+ ----- Method: VMMaker class>>generateSqueakSpurStackVMWithImmutability (in category 'configurations') -----
+ generateSqueakSpurStackVMWithImmutability
+ 	"No primitives since we can use those from the Cog VM"
+ 	^VMMaker
+ 		generate: StackInterpreter
+ 		with: #(ObjectMemory Spur32BitMemoryManager
+ 				FailImbalancedPrimitives false
+ 				IMMUTABILITY true)
+ 		to: (FileDirectory default directoryNamed: self sourceTree, '/spurstacksrc') fullName
+ 		platformDir: (FileDirectory default directoryNamed: self sourceTree, '/platforms') fullName
+ 		including: #()!

More information about the Vm-dev mailing list