[Vm-dev] How to convert a Byte to an integer in VMMaker

Klaus D. Witzel klaus.witzel at cobss.com
Wed Aug 15 18:24:11 UTC 2007

Hi Math,

IIRC #positive32BitIntegerFor: returns a boxed instance of  
LargePositiveInteger and it looks like that is not what you want to pass  
to #sufficientSpaceToInstantiate: and to #instantiateClass:

I suggest to have a look at the implementor of #experimentalBytecode, that  
one reads bytes from the current IP and makes use of them.


On Wed, 15 Aug 2007 14:17:58 +0200, Mathieu Suen wrote:

>  Hi.
> I am in VMMaker and I want to convert the current bytecode to the  
> corresponding integer.
> How could I do that?
> For the time being I have write the following instruction:
> 	self fetchNextBytecode.
> 	closSize := self positive32BitIntegerFor: currentBytecode.
> 	self fetchNextBytecode.
> 	"The following may cause GC!"
> 	self success: (self sufficientSpaceToInstantiate:  (self splObj:  
> ClosureEnvObject) indexableSize: closSize).
> 	successFlag ifTrue: [
> 		self storePointer: 4
> 			ofObject: activeContext
> 			withValue:(self instantiateClass: (self splObj: ClosureEnvObject)  
> indexableSize: closSize)]]
> But it don't seems to work
> Thanks for helping
> 	Mth

More information about the Vm-dev mailing list