[Vm-dev] Re: [Pharo-project] SystemTracer

Guillermo Polito guillermopolito at gmail.com
Thu Mar 15 19:49:17 UTC 2012


On Thu, Mar 15, 2012 at 4:26 PM, Guillermo Polito <guillermopolito at gmail.com
> wrote:

>
>
> On Thu, Mar 15, 2012 at 1:58 PM, Eliot Miranda <eliot.miranda at gmail.com>wrote:
>
>>
>> Hi Guillermo,
>>
>> On Wed, Mar 14, 2012 at 12:48 PM, Guillermo Polito <
>> guillermopolito at gmail.com> wrote:
>>
>>> Hi Eliot,
>>>
>>> do you have a pointer of where can I see the differences between the old
>>> Squeak format and the cog image format, so I can make SystemTracer work on
>>> Cog vms?
>>>
>>
>> So the image format differences are
>> - floats are in platform order, not necessarily in big-endian order
>> - the layout of the specialObjectsArray is slightly different (documented
>> in recreateSpecialObjectsArray)
>> - there are more words in the header, see
>> StackInterpreter>writeImageFileIO:, i.e.
>>
>> in Cog:
>> self putLong: self imageFormatVersion toFile: f.
>> self putLong: headerSize toFile: f.
>>  self putLong: imageBytes toFile: f.
>> self putLong: objectMemory startOfMemory toFile: f.
>>  self putLong: objectMemory specialObjectsOop toFile: f.
>> self putLong: objectMemory newObjectHash toFile: f.
>>  self putLong: self ioScreenSize toFile: f.
>> self putLong: self getImageHeaderFlags toFile: f.
>>  self putLong: extraVMMemory toFile: f.
>> self putShort: desiredNumStackPages toFile: f.
>>  self putShort: self unknownShortOrCodeSizeInKs toFile: f.
>> self putLong: desiredEdenBytes toFile: f.
>>  self putShort: (maxExtSemTabSizeSet ifTrue: [self
>> ioGetMaxExtSemTableSize] ifFalse: [0]) toFile: f.
>> self putShort: 0 toFile: f.
>>  1 to: 4 do: [:i | self putLong: 0 toFile: f].  "fill remaining header
>> words with zeros"
>>
>> in Interpreter:
>>  self putLong: (self imageFormatVersion) toFile: f.
>> self putLong: headerSize toFile: f.
>>  self putLong: imageBytes toFile: f.
>> self putLong: (self startOfMemory) toFile: f.
>>  self putLong: specialObjectsOop toFile: f.
>> self putLong: lastHash toFile: f.
>>  self putLong: (self ioScreenSize) toFile: f.
>> self putLong: fullScreenFlag toFile: f.
>>  self putLong: extraVMMemory toFile: f.
>> 1 to: 7 do: [:i | self putLong: 0 toFile: f].  "fill remaining header
>> words with zeros"
>>
>> Then
>>
>> getImageHeaderFlags
>> "Answer the flags that are contained in the 7th long of the image header."
>>  ^fullScreenFlag "0 or 1"
>> + (VMBIGENDIAN ifTrue: [0] ifFalse: [2]) "this is the
>> imageFloatsLittleEndian flag"
>>  + (processHasThreadId ifTrue: [4] ifFalse: [0])
>> + (flagInterpretedMethods ifTrue: [8] ifFalse: [0])
>>  + (preemptionYields ifTrue: [0] ifFalse: [16])
>> + (noThreadingOfGUIThread ifTrue: [32] ifFalse: [0])
>>  + (imageHeaderFlags bitAnd: 63 bitInvert32) "these are any flags we do
>> not recognize"
>>
>> Now most of the information in the flags is accessible from
>> vmParameterAt: (or some convenience methods).  e.g. vm parameter 49 is the
>> max external semaphore table size, and vm parameter 48 is the following
>> flags:
>>
>> getCogVMFlags
>> "Answer an array of flags indicating various properties of the Cog VM.
>>  Bit 0: implies the image's Process class has threadId as its 3rd inst
>> var (zero relative)
>>  Bit 1: if set, methods that are interpreted will have the flag bit set
>> in their header
>>  Bit 2: if set, implies preempting a process does not put it to the back
>> of its run queue"
>>  ^objectMemory integerObjectOf: (processHasThreadId ifTrue: [1] ifFalse:
>> [0])
>> + (flagInterpretedMethods ifTrue: [2] ifFalse: [0])
>>  + (preemptionYields ifTrue: [0] ifFalse: [4])
>> + (noThreadingOfGUIThread ifTrue: [8] ifFalse: [0])
>>
>
> Hehe, in pharo the comment reaches up to 41 :).  I'll look at squeak to
> update it.
>

And squeak's reach up to 40 :/ in
http://ftp.squeak.org/4.1/SqueakV41.sources.gz


>
>
>>
>> Read the comment for vmParameterAt: to get things like num stack pages
>> and cog code size.
>>
>> Is this OK?  I know it's a bit of a mess. If you or I (we?) write it up
>> where should we put the info?
>>
>>>
>>> Thanks,
>>> Guille
>>>
>>> On Thu, Jan 27, 2011 at 6:36 PM, Levente Uzonyi <leves at elte.hu> wrote:
>>>
>>>> On Thu, 27 Jan 2011, Benjamin wrote:
>>>>
>>>>  It works for  PharoCore-1.1-11196-UNSTABLE.1 but it seems to be the
>>>>> only version where it works :S
>>>>>
>>>>> Does someone know why ?
>>>>>
>>>>
>>>> It doesn't support Cog's image format. Try an image with the original
>>>> Squeak format. You can convert your image with the latest SqueakVM. Only
>>>> the unix VM was released with this feature yet, so you can use that
>>>> http://squeakvm.org/unix/ or build a VM for your favorite platform.
>>>>
>>>>
>>>> Levente
>>>>
>>>>
>>>>
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Ben
>>>>>
>>>>> On Jan 27, 2011, at 3:36 PM, Benjamin wrote:
>>>>>
>>>>>  Hello guys,
>>>>>>
>>>>>> for one of my projects, I'm trying to use SystemTracer to create
>>>>>>  anew image, but it appears that it doesn't work on Pharo ...
>>>>>> I can create a new image, but I can't open it. I've tried with an
>>>>>> older VM (Squeak 3.8.18beta1U), but it's the same ...
>>>>>>
>>>>>>
>>>>>> Did someone already have this problem ? Does someone have a solution ?
>>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks in advance,
>>>>>>
>>>>>> Ben
>>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>
>>
>>
>> --
>> best,
>> Eliot
>>
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20120315/e48a9aad/attachment-0001.htm


More information about the Vm-dev mailing list