[Vm-dev] Interpreter simulator error

K K Subbu kksubbu.ml at gmail.com
Thu May 7 07:46:42 UTC 2020


On 06/05/20 1:19 am, karl ramberg wrote:
> 
> Bitmap(Object)>>at:put:
> Receiver: a Bitmap of length 5499668
> Arguments and temporary variables:
> index: 4902231
> value: 0.006711409395973154
> Receiver's instance variables:
> a Bitmap of length 5499668
When I trace the stack, this occurs when a float value 1.0 is stored in 
the first slot of a float array of size 6 through an plugin 
(FloatArrayPlugin). The Bitmap here is memory (sized in words). When 
running on native VM, this code works fine but triggers an error when 
simulator tries to mimic a CArray at:put:.
----
memory 4118397 (words)
a CArray
arrayBaseAddress: 	14488972 (bytes)
ptrOffset: 	0
unitSize: 	4

CArray>>at: offset put: val
   ptrOffset = 0 ifFalse: [self error: 'only expect base address to 
receive at:put: message'].
   unitSize = 1 ifTrue: [^ interpreter byteAt: arrayBaseAddress + offset 
put: val].
   unitSize = 4 ifTrue: [^ interpreter longAt: arrayBaseAddress + 
(offset * 4) put: val].

InterpreterSimulatorLSB>>longAt: byteAddress put: a32BitValue
   ^memory at: (byteAddress // 4) + 1 put: a32BitValue
-----
But I don't understand why a valid store into memory with an index 
within bounds raises an error:
-----
Object>>at: index put: value
   index isInteger ifTrue:
     [self class isVariable
       ifTrue: [(index >= 1 and: [index <= self size])
         ifTrue: [self errorImproperStore]
         ifFalse: [self errorSubscriptBounds: index]]
-----

I could reproduce this error on released images on Ubuntu Linux (64bit 
host).
* Run Squeak3.8.1-6747full.image (this contains VMMaker code)
* Open a workspace and inspect:
     InterpreterSimulator new openOn: 'Squeak32-3.8g-6548.image')
* run 'self test' from the code pane of inspector
* after swapping bytes and relocating objects, an error dialog pops up
(see attached log)

Regards .. Subbu
-------------- next part --------------
A non-text attachment was scrubbed...
Name: SqueakDebug.log
Type: text/x-log
Size: 5292 bytes
Desc: not available
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20200507/b4074eba/attachment.bin>


More information about the Vm-dev mailing list