[Vm-dev] what about image reading?

Eliot Miranda eliot.miranda at gmail.com
Thu Jan 13 21:45:29 UTC 2011


On Thu, Jan 13, 2011 at 11:57 AM, Tobias Pape <Das.Linux at gmx.de> wrote:

>
> Am 2011-01-13 um 19:46 schrieb David T. Lewis:
> >
> > On Thu, Jan 13, 2011 at 06:20:28PM +0100, Tobias Pape wrote:
> >>
> >> Am 2011-01-13 um 17:52 schrieb David T. Lewis:
> >>>
> >>> On Thu, Jan 13, 2011 at 05:26:34PM +0100, Tobias Pape wrote:
> >>>> [?]
> >>>> In a previous discussion, the method
> >>>> Interpreter>>readImageFromFile: f HeapSize: desiredHeapSize
> StartingAt: imageOffset
> >>>> was mentioned that can read the image format using the given offset.
> >>>> However, neither in the Smalltalk code nor in the generated C code I
> was able
> >>>> to find any uses of this.
> >>>>
> >>>> SqueakVMMaker/src ??? grep -iR readImageFromFileHeapSizeStartingAt *
> >>>> vm/interp.c:sqInt  readImageFromFileHeapSizeStartingAt(sqImageFile  f,
> usqInt desiredHeapSize, squeakFileOffsetType  imageOffset);
> >>>> vm/interp.c:sqInt readImageFromFileHeapSizeStartingAt(sqImageFile  f,
> usqInt desiredHeapSize, squeakFileOffsetType  imageOffset) {
> >>>>
> […]
> >>
> >> The _purpose_ of the 512byte skip was clear to me.
> >> I was just puzzled that there is no reference to the indicated method
> whatsoever.
> >> Can you give me a hint, where that is used?
> >
> > I'm away from Squeak at the moment, but look in class Interpreter
> > in package VMMaker. I think the method is
> #readImageFromFile:HeapSize:StartingAt:
> > or similar. The colons get removed from the method/function name as
> > part of the translation to C.
>
> Yes, that is true. I've already found that, if you refer to my original
> post.
> My point is, that
> NEITHER the smalltalk method
>        Interpreter>>#readImageFromFile:HeapSize:StartingAt:
> NOR the c function
>
> is called at all:
>  No senders for the Smalltalk method, no reference when
> searching all methods source code for readImageFrom, aside the actual
> implementation
> and a mention in some ‘important methods’ collection.
>  For the C-function, refer to my grep inside the generated source tree. No
> call at all.
>
> So, why are they existent, in the first place?
>

You're not searching all the C code ;)
 readImageFromFile:HeapSize:StartingAt: is called from the C main routine,
and the C main routine is not generated.  See platforms/{Mac
OS,iOS,win32,unix}/vm

McStalker.oscogvm$ grep readImageFromFile platforms/*/vm/*
platforms/Cross/vm/sq.h:sqInt
readImageFromFileHeapSizeStartingAt(sqImageFile f, usqInt desiredHeapSize,
squeakFileOffsetType imageOffset);
platforms/Cross/vm/sq.h:#define readImageFromFileHeapSize(f, s)
readImageFromFileHeapSizeStartingAt(f,s,0)
platforms/Mac OS/vm/sqMacMain.c:
 readImageFromFileHeapSizeStartingAt(f, sqGetAvailableMemory(), 0);
platforms/Mac OS/vm/sqMacNSPluginUILogic.c:
readImageFromFileHeapSizeStartingAt(f, squeakHeapMBytes, 0);
platforms/unix/vm/sqUnixMain.c:      readImageFromFileHeapSizeStartingAt(f,
extraMemory, 0);
platforms/win32/vm/sqWin32Intel.c:
 readImageFromFileHeapSizeStartingAt(imageFile, virtualMemory, 0);
platforms/win32/vm/sqWin32Intel.c:
 readImageFromFileHeapSizeStartingAt(imageFile, virtualMemory,
sqImageFilePosition(imageFile));


> So Long
>         -Tobias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20110113/9fae4a98/attachment.htm


More information about the Vm-dev mailing list