﻿'From Squeak6.0beta of 24 May 2022 [latest update: #21829] on 30 May 2022 at 1:46:05 pm'!

!SmalltalkImage methodsFor: 'image' stamp: 'mt 5/30/2022 13:38'!
imageFormatVersion

	| version multi mask |
	(version := self primImageFormatVersion) ifNil: [^ nil].
	([multi := CompiledCode multipleBytecodeSetsActive] on: Error do: []) ifNil: [^ nil].
	mask := 512. "See StackInterpreter class >> #initializeMiscConstants in VMMaker."
	^ multi
		ifTrue: [version bitOr: mask]
		ifFalse: [version]! !

!SmalltalkImage methodsFor: 'image' stamp: 'mt 5/30/2022 13:34'!
primImageFormatVersion
	"Answer an integer identifying the type of image in memory. The image version number may
	identify the format of the image (e.g. 32 or 64-bit word size) or specific requirements
	of the image (e.g. block closure support required). This invokes an optional primitive
	that may not be available on all virtual machines."

	"Smalltalk image imageFormatVersion"

	<primitive: 'primitiveImageFormatVersion'>

	"Cog provides a VM parameter"
	^[Smalltalk vm vmParameterAt: 41]
		on: Error
		do: [self notify: 'This virtual machine does not support the optional ',
				'primitive #primitiveImageFormatVersion' translated.
			nil]
! !


!SystemReporter methodsFor: 'reporting' stamp: 'mt 5/30/2022 13:44'!
reportImage: aStream
	self header: 'Image' on: aStream.
	aStream 
		nextPutAll: Smalltalk image imageName; cr;
		nextPutAll: SystemVersion current version; cr;
		nextPutAll: Smalltalk image lastUpdateString; cr;
		nextPutAll: Smalltalk image currentChangeSetString; cr.
	[aStream
			nextPutAll: 'Image format: ';
			print: Smalltalk image imageFormatVersion;
			nextPutAll: ' (';
			print: Smalltalk image wordSize * 8;
			nextPutAll: ' bit)'; cr.
	 Smalltalk image imageFormatVersion ~= Smalltalk image imageFormatVersionFromFile ifTrue:
	 [aStream
			nextPutAll: 'Image format (file): ';
			print: Smalltalk image imageFormatVersionFromFile;
			nextPutAll: ' (';
			print: Smalltalk image wordSize * 8;
			nextPutAll: ' bit)'; cr]]
		on: Warning
		do: ["primitive not present in VM"].
	[aStream
			nextPutAll: 'Preferred bytecode set: ';
			nextPutAll: CompiledMethod preferredBytecodeSetEncoderClass bytecodeSetName; cr]
		on: MessageNotUnderstood 
		do: [:ex | ex resume: '---'].
		
	"self new reportImage: Transcript. Transcript flush"! !

