[Vm-dev] VM Maker Inbox: VMMaker.oscog-dtl.2910.mcz

David T. Lewis lewis at mail.msen.com
Fri Dec 25 03:28:51 UTC 2020

This replaces VMMaker.oscog-dtl.2711 from the VMMaker inbox (9 February 2020),
which I will move to treated.

I merged the original submission, made a few changes, and added one new
primitive based on earlier suggestions on vm-dev.

This provides primitive support to allow the image to inform the VM that it
can change the image format number from 68021 to 68533 after the image has
been recompiled with SistaV1.

It also provides a primitive for querying the VM for supported bytecode
sets, such that this will work:

  Smalltalk supportedEncoders ==> {EncoderForV3 . EncoderForV3PlusClosures . EncoderForSistaV1}

I am attaching a change set that illustrates the use of the two primitives.


-------------- next part --------------
'From Squeak6.0alpha of 22 December 2020 [latest update: #20129] on 24 December 2020 at 9:48:09 pm'!
"Change Set:		DemonstrateMultipleByteCodePrimitives-dtl
Date:			24 December 2020
Author:			David T. Lewis

Demonstrate primitiveMultipleBytecodeSetsActive and primitiveBytecodeSetsAvailable

Show how the multiple bytecode support primitives might be used. Note that CompiledCode>>multipleBytecodeSetsActive: is already implemented in trunk.

Smalltalk multipleBytecodeSetsActive ==> true

Smalltalk supportedEncoders ==> {EncoderForV3 . EncoderForV3PlusClosures . EncoderForSistaV1}

!SmalltalkImage methodsFor: 'vm bytecodes' stamp: 'dtl 12/24/2020 21:36'!
	"Answer the encoder names for the bytecode sets supported by the VM."

	<primitive: 'primitiveBytecodeSetsAvailable'>
! !

!SmalltalkImage methodsFor: 'vm bytecodes' stamp: 'dtl 12/24/2020 21:00'!
	"Answer true if multiple bytecode support is active in the VM"

	<primitive: 'primitiveMultipleBytecodeSetsActive'>
! !

!SmalltalkImage methodsFor: 'vm bytecodes' stamp: 'dtl 12/24/2020 21:09'!
multipleBytecodeSetsActive: aBoolean
	"Inform the VM when multiple bytecode sets, typically the Sista bytecodes
	in addition to the traditional V3 bytecode set, are now in use is this image.
	The VM may use this information to update the image format number when
	saving the image to the file system."

	"This method is already implemented in trunk in class CompiledCode"

	<primitive: 'primitiveMultipleBytecodeSetsActive'>
! !

!SmalltalkImage methodsFor: 'vm bytecodes' stamp: 'dtl 12/24/2020 20:58'!
	"Answer the list of encoders that the VM can support"

	"Smalltalk supportedEncoders"

	^ self availableByteCodeSets
		collect: [:e | Smalltalk classNamed: e]
		thenSelect: [ :e | e notNil ]! !

More information about the Vm-dev mailing list