[squeak-dev] The Trunk: Kernel-eem.851.mcz

commits at source.squeak.org commits at source.squeak.org
Mon May 19 18:42:46 UTC 2014


Eliot Miranda uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-eem.851.mcz

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

Name: Kernel-eem.851
Author: eem
Time: 19 May 2014, 11:41:55.614 am
UUID: 3ced43fc-fd88-4b0c-b029-fd870592dbc2
Ancestors: Kernel-dtl.850

First part of Kernel multiple bytecode sets switchover.  Make
sure CompiledMethod>>ncoderClass works as expected
before depening on it.

=============== Diff against Kernel-dtl.850 ===============

Item was changed:
  ByteArray variableByteSubclass: #CompiledMethod
  	instanceVariableNames: ''
+ 	classVariableNames: 'LargeFrame PrimaryBytecodeSetEncoderClass SecondaryBytecodeSetEncoderClass SmallFrame'
- 	classVariableNames: 'LargeFrame SmallFrame'
  	poolDictionaries: ''
  	category: 'Kernel-Methods'!
  
+ !CompiledMethod commentStamp: 'eem 5/12/2014 18:02' prior: 0!
+ My instances are methods suitable for interpretation by the virtual machine.  This is the only class in the system whose instances have both indexable pointer fields and indexable 8-bit integer fields.  The first part of a CompiledMethod is pointers, the second part is bytes.  I'm a subclass of ByteArray to avoid duplicating some of ByteArray's methods, not because a CompiledMethod is-a ByteArray.
- !CompiledMethod commentStamp: 'ul 1/29/2011 13:18' prior: 0!
- My instances are methods suitable for interpretation by the virtual machine.  This is the only class in the system whose instances intermix both indexable pointer fields and indexable integer fields.
- I'm a subclass of ByteArray to avoid duplicating some of ByteArray's methods, not because a CompiledMethod is-a ByteArray.
  
+ Class variables:
+ SmallFrame								- the number of stack slots in a small frame Context
+ LargeFrame							- the number of stack slots in a large frame Context
+ PrimaryBytecodeSetEncoderClass		- the encoder class that defines the primary instruction set
+ SecondaryBytecodeSetEncoderClass	- the encoder class that defines the secondary instruction set
+ 
- 	
  The current format of a CompiledMethod is as follows:
  
+ 	header (4 or 8 bytes, SmallInteger)
+ 	literals (4 or 8 bytes each, Object)
+ 	bytecodes  (variable, bytes)
+ 	trailer (variable, bytes)
- 	header (4 bytes)
- 	literals (4 bytes each)
- 	bytecodes  (variable)
- 	trailer (variable)
  
+ The header is a 31-bit signed integer (a SmallInteger) with one of the two following formats, selected by the sign bit:
- The header is a 30-bit integer with the following format:
  
+ sign bit 0, header >= 0:
+ 	(index 0)		9 bits:	main part of primitive number   (#primitive)
+ 	(index 9)		8 bits:	number of literals (#numLiterals)
+ 	(index 17)		1 bit:	whether a large frame size is needed (#frameSize)
+ 	(index 18)		6 bits:	number of temporary variables (#numTemps)
+ 	(index 24)		4 bits:	number of arguments to the method (#numArgs)
+ 	(index 28)		1 bit:	high-bit of primitive number (#primitive)
+ 	(index 29)		1 bit:	flag bit, ignored by the VM  (#flag)
+ 	(index 30/63)	sign bit: 0 selects the Primary instruction set (#signFlag)
+ sign bit 1, header < 0:
+ 	(index 0)		16 bits:	number of literals (#numLiterals)
+ 	(index 16)		  1 bit:	has primitive
+ 	(index 17)		  1 bit:	whether a large frame size is needed (#frameSize)
+ 	(index 18)		  6 bits:	number of temporary variables (#numTemps)
+ 	(index 24)		  4 bits:	number of arguments to the method (#numArgs)
+ 	(index 28)		  2 bits:	reserved for an access modifier (00-unused, 01-private, 10-protected, 11-public)
+ 	(index 30/63)	sign bit: 1 selects the Secondary instruction set (e.g. NewsqueakV4) (#signFlag)
+ i.e. the Secondary Bytecode Set expands the number of literals to 65535 by assuming a CallPrimitive bytecode.
- (index 0)	9 bits:	main part of primitive number   (#primitive)
- (index 9)	8 bits:	number of literals (#numLiterals)
- (index 17)	1 bit:	whether a large frame size is needed (#frameSize)
- (index 18)	6 bits:	number of temporary variables (#numTemps)
- (index 24)	4 bits:	number of arguments to the method (#numArgs)
- (index 28)	1 bit:	high-bit of primitive number (#primitive)
- (index 29)	1 bit:	flag bit, ignored by the VM  (#flag)
  
+ The trailer is an encoding of an instance of CompiledMethodTrailer.  It is typically used to encode the index into the source files array of the method's source, but may be used to encode other values, e.g. tempNames, source as a string, etc.  See the class CompiledMethodTrailer.!
- 
- The trailer has two variant formats.  In the first variant, the last byte is at least 252 and the last four bytes represent a source pointer into one of the sources files (see #sourcePointer).  In the second variant, the last byte is less than 252, and the last several bytes are a compressed version of the names of the method's temporary variables.  The number of bytes used for this purpose is the value of the last byte in the method.
- !

Item was changed:
  ----- Method: CompiledMethod class>>initialize (in category 'class initialization') -----
  initialize    "CompiledMethod initialize"
  	"Initialize class variables specifying the size of the temporary frame
  	needed to run instances of me."
  
  	SmallFrame := 16.	"Context range for temps+stack"
+ 	LargeFrame := 56.
+ 	PrimaryBytecodeSetEncoderClass ifNil:
+ 		[PrimaryBytecodeSetEncoderClass := EncoderForV3PlusClosures].
+ 	SecondaryBytecodeSetEncoderClass ifNil:
+ 		[SecondaryBytecodeSetEncoderClass := EncoderForV3PlusClosures]!
- 	LargeFrame := 56!

Item was added:
+ ----- Method: CompiledMethod>>encoderClass (in category 'accessing') -----
+ encoderClass
+ 	"Answer the encoder class that encoded the bytecodes in this method.
+ 	 The sign flag bit is used by the VM to select a bytecode set."
+ 
+ 	^self header >= 0
+ 		ifTrue: [PrimaryBytecodeSetEncoderClass]
+ 		ifFalse: [SecondaryBytecodeSetEncoderClass]!



More information about the Squeak-dev mailing list