Hi Nicolai,

On Fri, Feb 26, 2016 at 1:50 PM, Nicolai Hess <[email protected]> wrote:

> 17618
> <https://pharo.fogbugz.com/f/cases/17618/Failing-test-ReleaseTest-testInstalledMethodsWithIncorrectTrailerKind>
> Failing test: ReleaseTest>>#testInstalledMethodsWithIncorrectTrailerKind
> Interesting bug.
> someone who can tell me what exactly is this trailer kind and why it is
> based
> on some "flag" in "method at: method size".
>

There's a rich class comment in CompiledMethodTrailer which explains a lot,
but let me add a little.

Back in the day the source pointer in methods (the pointer that says which
of the two source files and where in the file a method's source is kept)
was stored in three bytes added onto the end of a CompiledMethod after its
endPC.  Then Dan Ingalls added the ability to not have source files at all
but just to have named temporary variables.  he added a compressed version
of the temp names in bytes tacked on at the end of a method, replacing the
source pointer.  IIRC the difference between a source pointer, no source
pointer, or a compressed version of the temp names was all encoded in the
last byte.

Round about 2009 Igor Stasenko did a really nice reimplementation of this
scheme where he factored out the encoding tricks into
CompiledMethodTrailer, allowing one to generalize the scheme and add new
encoding types, for a total of 256 different kinds of trailer.

(and if you already know all of this, forgive me for trying to teach you to
suck eggs)
Anyway this trailer is

CompiledMethodTrailer >>encodeEmbeddedSourceQCompress

"data is string with method's source code, encode it using qCompress method"
self encodeUsingQCompress

CompiledMethodTrailer >>decodeEmbeddedSourceQCompress

"data is string with method's source code, encoded using qCompress method"
self qDecompress.

HTH

And why it seems to be wrong for many GT-methods:
>
> (CompiledMethod allInstances select:[:m | (m at: m size) = 24])
> collect:[:k |
>     k -> k trailer kind] "an Array(String
> class>>#gtInspectorFourtyTwo->#EmbeddedSourceQCompress
> OSEnvironment>>#getEnv:->#EmbeddedSourceQCompress
> OSEnvironment>>#getEnv:->#EmbeddedSourceQCompress GlobalVariable
> class>>#gtExampleSmalltalk->#EmbeddedSourceQCompress VirtualMachine
> class>>#gtExampleBasic->#EmbeddedSourceQCompress GLMBrowser
> class>>#gtExampleBasic->#EmbeddedSourceQCompress RPackageTag
> class>>#gtExamplePackageTag->#EmbeddedSourceQCompress Object
> class>>#gtExampleBasic->#EmbeddedSourceQCompress GLMCompositePresentation
> class>>#gtExampleCompositePresentation->#EmbeddedSourceQCompress
> LiteralVariable
> class>>#gtExampleUniqueLiteralVariable->#EmbeddedSourceQCompress
> GTSpotterRecorderEvent
> class>>#gtExampleAnySubclass->#EmbeddedSourceQCompress
> MetacelloAbstractPackageSpec
> class>>#gtExamplePackageSpec->#EmbeddedSourceQCompress
> MetacelloProjectReferenceSpec
> class>>#gtExampleProjectReferenceSpec->#EmbeddedSourceQCompress
> MetacelloProjectSpec
> class>>#gtExampleMetacelloSpec->#EmbeddedSourceQCompress MetacelloSpec
> class>>#gtExampleMetacelloSpec->#EmbeddedSourceQCompress MetacelloVersion
> class>>#gtExampleMetacelloVersion->#EmbeddedSourceQCompress GLMPresentation
> class>>#gtExampleBasic->#EmbeddedSourceQCompress Bag
> class>>#gtExampleBagWithTenElements->#EmbeddedSourceQCompress Bag
> class>>#gtExampleBagWithOneElement->#EmbeddedSourceQCompress
> GTDummyExamplesRecursive class>>#h->#EmbeddedSourceQCompress GLMAlertBrick
> class>>#gtExample->#EmbeddedSourceQCompress
> GTDummyExampleProvider>>#a->#EmbeddedSourceQCompress
> GTDummyExampleProvider>>#b->#EmbeddedSourceQCompress
> GTDummyExampleWithAssertions>>#a->#EmbeddedSourceQCompress
> GTDummyExampleWithAssertions>>#b->#EmbeddedSourceQCompress GTDummyExamples
> class>>#l->#EmbeddedSourceQCompress GTDummyExamples
> class>>#o->#EmbeddedSourceQCompress GTDummyExamplesInvalid
> class>>#a:->#EmbeddedSourceQCompress GTDummyExamplesPragmas
> class>>#a->#EmbeddedSourceQCompress GTDummyExamplesPragmas
> class>>#c->#EmbeddedSourceQCompress GTDummyExamplesPragmas
> class>>#b->#EmbeddedSourceQCompress GLMCollapsableBrick
> class>>#gtExample->#EmbeddedSourceQCompress FileReference
> class>>#gtExampleText->#EmbeddedSourceQCompress GTSpotterStep
> class>>#gtExampleBasic->#EmbeddedSourceQCompress GTEventAnnouncement
> class>>#gtExampleEmptyAnnouncement->#EmbeddedSourceQCompress
> UndefinedObject>>#DoIt->#EmbeddedSourceQCompress
> UndefinedObject>>#DoIt->#EmbeddedSourceQCompress)"
>

_,,,^..^,,,_
best, Eliot

Reply via email to