[Pharo-project] Problem with CompiledMethodTrailer

Igor Stasenko siguctua at gmail.com
Tue May 10 10:59:21 CEST 2011

On 10 May 2011 09:48, Mariano Martinez Peck <marianopeck at gmail.com> wrote:
> On Tue, May 10, 2011 at 9:41 AM, Marcus Denker <marcus.denker at inria.fr>
> wrote:
>> On May 10, 2011, at 9:32 AM, Mariano Martinez Peck wrote:
>> >
>> > what is even worst, is that even after removing those correct CM, and
>> > doing a GC etc...they still don't disappear.
>> >
>> There is
>>        ScriptLoader new cleanUpMethods
>> This is called from #cleanUpForRelease and normally should make sure there
>> are no old methods.
> hehehehe if I do: ScriptLoader new cleanUpForRelease, then inspect
> ((CompiledMethod allInstances select:  [:each | each trailer kind =
> #VarLengthSourcePointer] ) )
> they are not GC'ed and if then I click on the first element in the
> inspector.... VM CRASH!!!  with both, InterpreterVM and CogVM.
> :(

okay. it seems i found the offender. Its a CompiledMethod class>>cleanUp.
It changing a source pointer of all non-installed methods to 0.

When i do this, my image hangs.
Now i thinking that it should actually use empty trailer for those
methods i.e. CompiledMethodTrailer empty..

Still i found it strange why some methods has broken bytecode.

My theory is that some nasty code somewhere copied a compiled methods
using some unsafe technique, like:

1 to: oldMethod size do: [ :i | newMethod at: i put: (oldMethod at: i) ]

Because when you constructing compiled method normally (by compiling
them) , there is no way how you can get broken compiled methods. (we
would discover it much much earlier,
and in fact CompiledMethodTrailers are working for more than a year in
both pharo and squeak, and there was no any issues like this from
their side).

Best regards,
Igor Stasenko AKA sig.

More information about the Pharo-project mailing list