[Vm-dev] SystemTracing: SystemTracing-dtl.23.mcz
David T. Lewis
lewis at mail.msen.com
Mon Dec 12 04:01:23 UTC 2011
Hi Stef,
I loaded the PharoTaskForces version of SystemTracing into a Pharo
image, then did the update to handle block closures. I was able
to convert the Pharo 1.4 image to 64-bit format and run it under
an interpreter VM for 64-bit object memory.
To update the PharoTaskForces version, you can file in the attached
SystemTracer2-writeAndTrace.st. This will not cause any problems
for tracing to 32-bit formats, but will allow you to also trace
to a 64-bit format if you like.
You also will want to fix SystemTracer64>>writeFileHeader to use
'Smalltalk vm extraVMMemory' instead of 'SmalltalkImage current extraVMMemory'
otherwise you will get a deprecation warning that will hang your
image after doing the trace.
Dave
On Fri, Dec 09, 2011 at 05:30:16PM -0500, David T. Lewis wrote:
> Thanks Stef,
>
> I'll try to look at it when I get a chance. I did a quick check with
> Pharo 1.4, but I just did not have enough time to follow up on the issues.
> I'll have a look at PharoTaskForces because I'm sure it's addressed there.
>
> Dave
>
> On Fri, Dec 09, 2011 at 10:52:44PM +0100, stephane ducasse wrote:
> >
> > hi david
> >
> > the systemTracing package for pharo is available in PharoTaskForces
> > I do not know what changed compared with the one of squeak.
> >
> > Stef
> >
> > On Dec 8, 2011, at 6:49 PM, David T. Lewis wrote:
> >
> > >
> > > This is an update to the system tracer that makes it possible to
> > > trace current Squeak images to 64-bit image format. Prior to this
> > > update, only pre-closure images could be converted to 64-bit object
> > > format.
> > >
> > > Thanks to Eliot for the tip that pointed me to the solution, which
> > > is that instances of BlockClosure need to have the value of their
> > > startpc instance variable adjusted to match byte offsets in the
> > > enclosing compiled method when converting from 32-bit to 64-bit
> > > object format.
> > >
> > > This works on Squeak, not yet tested on Pharo.
> > >
> > > Dave
> > >
> > >
> > > On Thu, Dec 08, 2011 at 05:17:49AM +0000, squeak-dev-noreply at lists.squeakfoundation.org wrote:
> > >> Dave Lewis uploaded a new version of SystemTracing to project SystemTracing:
> > >> http://www.squeaksource.com/SystemTracing/SystemTracing-dtl.23.mcz
> > >>
> > >> ==================== Summary ====================
> > >>
> > >> Name: SystemTracing-dtl.23
> > >> Author: dtl
> > >> Time: 7 December 2011, 11:17:47 am
> > >> UUID: 9f6136af-8117-416c-bf54-baf2a32bb571
> > >> Ancestors: SystemTracing-dtl.22
> > >>
> > >> Support tracing closure-enabled images to 64-bit object format.
> > >>
> > >> When tracing to a different word size, e.g. trace to 64-bit image from a 32-bit image, adjust the startpc of all BlockClosure instances to account for different word size in the enclosing compiled method.
-------------- next part --------------
'From Squeak3.11alpha of 6 December 2011 [latest update: #11804] on 10 December 2011 at 7:35:34 pm'!
!SystemTracer2 methodsFor: 'private' stamp: 'dtl 12/7/2011 22:57'!
writeAndTrace: object
"Write the image representation of me on byteStream at my oop, and add my not-yet-seen fields to traceQueue."
| lengthAndHeaderSize oop byteSize byteBuffer |
lengthAndHeaderSize := self lengthAndHeaderSizeFor: object.
oop := oopMap at: object ifAbsent: [object isNil ifTrue: [nilOop] ifFalse: [self halt: 'oop should have been added to oopMap when object was add to traceQueue']].
"Write header"
byteStream position: oop - ((lengthAndHeaderSize second - 1) * wordSize).
byteStream nextPutAll: (self
headersFor: object class
classOop: (self reserve: object class from: object field: -1 "class field")
hash: (self identityHashFor: object)
numFields: (self fixedPlusIndexableSizeFor: object)
).
"Write fields"
(object class isPointers or: [object class == CompiledMethod]) ifTrue: [
object class == BlockClosure ifTrue: [ | startpc diff |
"Adjust startpc of a BlockClosure to account for possibly different width
of word-sized instance variables and header in its enclosing compiled method."
startpc := object startpc.
diff := self wordSize - Smalltalk wordSize.
object instVarAt: 2
put: (object startpc + (object outerContext method numLiterals + 1 * diff)).
byteStream nextPutAll: (self object: object
allFieldsWithIndex: [:val :i | self reserve: val from: object field: i]
collect: WordArray).
object instVarAt: 2 put: startpc
] ifFalse: [
byteStream nextPutAll: (self object: object
allFieldsWithIndex: [:val :i | self reserve: val from: object field: i]
collect: WordArray)
]
] ifFalse: [ "isBits"
byteStream nextPutAll: object.
object class isBytes
ifTrue: [ "fill bytes unused in last word"
1 to: (wordSize-1) - (object basicSize + (wordSize-1) \\ wordSize)
do: [:i | byteStream nextPut: 0]]
ifFalse: [(wordSize = 8 and: [object basicSize odd]) ifTrue:
[ "fill word unused in last long8"
byteStream nextPutAll: (WordArray with: 0)]].
].
object class == CompiledMethod ifTrue: [
byteSize := object basicSize - object initialPC + 1.
byteBuffer := ByteArray new: byteSize.
byteBuffer replaceFrom: 1 to: byteSize with: object startingAt: object initialPC.
"intermediate ByteArray needed since byteStream (a file) cannot putAll from a subclass of ByteArray (CompiledMethod)"
byteStream nextPutAll: byteBuffer.
"fill bytes unused in last word"
1 to: (wordSize-1) - (byteBuffer size + (wordSize-1) \\ wordSize)
do: [:i | byteStream nextPut: 0].
].
"Double check that fields take up expected size"
byteStream position = (oop + (lengthAndHeaderSize first * wordSize)) ifFalse: [
self error: 'object size discrepency'].
^ oop! !
More information about the Vm-dev
mailing list