BTW, I can reproduce the crash with latest Eliot's Cog and Pharo vm.

On Wed, Feb 20, 2013 at 11:00 AM, Guillermo Polito <guillermopolito@gmail.com> wrote:
'cause you don't know if the method has trailer or not I think... There are empty trailers and trailers embedding source (directly in the image)... isn't it?


On Wed, Feb 20, 2013 at 10:52 AM, Marcus Denker <marcus.denker@inria.fr> wrote:

On Feb 20, 2013, at 10:45 AM, Guillermo Polito <guillermopolito@gmail.com> wrote:

Hi!

There is this bug open I was taking a look yesterday:


The condense sources compacts the changes and source files, and adds a new method trailer to a compiled method with it's new source pointer. In order to do that, it does a #becomeForward: to the method.

CompiledMethod>>setSourcePointer: srcPointer
"We can't change the trailer of existing method, since
it could have completely different format. Therefore we need to
generate a copy with new trailer, containing an scrPointer, and then
#become it"
| trailer copy |
trailer := CompiledMethodTrailer new sourcePointer: srcPointer.
copy := self copyWithTrailerBytes: trailer.
>>> self becomeForward: copy.
^ copy

So far, with simple methods, so good.

However, there are cases, in which becoming the compiled method, breaks processes, sometimes getting a crash in the VM. For example:

(Delay class>>#handleTimerEvent) setSourcePosition: 200 inFile: 1

(ProcessorScheduler class>>#idleProcess) setSourcePosition: 200 inFile: 1

My assumption is that the #becomeForward: of compiled methods do not get well with the stack mapping in the vm... But just guessing.


I wonder why we don't just update the pointer.�
That is: we keep the method the same, rewrite the pointer, and nothing else.

Marcus