Ok, I was playing with flushing caches and stuff... Its still a bit obsure
to me why the example in the workspace works and the code coverage doesnot.
However, I managed to hack the VM to make it work :).
It looks like the VM is treating the objects as methods, as cog methods. So
I added the following validation in the commonSend:
methodHeader2 = longAt((GIV(newMethod) + BaseHeaderSize) + (HeaderIndex <<
ShiftForWord));
if (isCogMethodReference(methodHeader2) *&& isCompiledMethodHeader
(methodHeader2)*) {
/* begin externalizeIPandSP */
assert((((usqInt)localIP)) != (ceReturnToInterpreterPC()));
GIV(instructionPointer) = oopForPointer(localIP);
GIV(stackPointer) = localSP;
GIV(framePointer) = localFP;
executeCoggedNewMethodmethodHeader(1, methodHeader2);
}
And it works :).
I cc Eliot, so maybe he has an idea...
Guille
On Thu, May 30, 2013 at 5:43 PM, Guillermo Polito <[email protected]
> wrote:
> Yes, this is a problem with Cog and Method wrappers it seems. Camille
> found not so long ago that when installing a method wrapper with instance
> variables, the VM just crashes. I think this should be the case.
>
> Anyway, I was just playing a bit because I want to use method wrappers for
> some experiments.
> So, the following looks like working when using wrappers with no inst vars.
>
> method := MyA>>#a.
> [
> MyA methodDictionary at: #a put: MyWrapper new.
> anA := MyA new.
> res := anA a.
> ] ensure: [
> MyA methodDictionary at: #a put: method.
> method flushCache.
> ].
> res
>
> Doing the same with a wrapper with inst vars just crashes the vm. However,
> if flushing the method cache after installing the method in the method
> dictionary, makes it work...
>
> method := MyA>>#a.
> [
> MyA methodDictionary at: #a put: MyWrapperWithInstVar new.
> method flushCache.
> anA := MyA new.
> res := anA a.
> ] ensure: [
> MyA methodDictionary at: #a put: method.
> method flushCache.
> ].
> res
>
> So it looks like a problem in the JIT cache not cleared :).
>
> Now, I was looking at the TestCoverage class, to see how to make it work,
> but not results yet :P.
>
> Guille
>
>
> On Sun, May 26, 2013 at 6:48 PM, Frank Shearar <[email protected]>wrote:
>
>> Hi,
>>
>> I wanted to see FileSystem's coverage, so I
>> * downloaded 3.0 via curl http://get.pharo.org/30+vm | bash,
>> * fired up the image,
>> * opened the TestRunner,
>> * highlighted the three FileSystem packages,
>> * "select all"ed,
>> * pressed "Run Coverage"
>>
>> and the VM crashed with a segfault. I tried with a few other packages,
>> and every time I tried to run coverage the VM died with the same
>> message:
>>
>> Segmentation fault Sun May 26 15:46:45 2013
>>
>>
>> pharo VM version: 3.9-7 #1 Wed Mar 13 18:22:44 CET 2013 gcc 4.4.3
>> Built from: NBCoInterpreter NativeBoost-CogPlugin-EstebanLorenzano.18
>> uuid: a53445f9-c0c0-4015-97a3-be7db8d9ed6b Mar 13 2013
>> With: NBCogit NativeBoost-CogPlugin-EstebanLorenzano.18 uuid:
>> a53445f9-c0c0-4015-97a3-be7db8d9ed6b Mar 13 2013
>> Revision: git://gitorious.org/cogvm/blessed.git Commit:
>> 412abef33cbed05cf1d75329e451d71c0c6aa5a7 Date: 2013-03-13 17:48:50
>> +0100 By: Esteban Lorenzano <[email protected]> Jenkins build #14535
>> Build host: Linux linux-ubuntu-10 2.6.32-38-server #83-Ubuntu SMP Wed
>> Jan 4 11:26:59 UTC 2012 x86_64 GNU/Linux
>> plugin path: /home/frank/Downloads/pharo-3.0/pharo-vm/ [default:
>> /home/frank/Downloads/pharo-3.0/pharo-vm/]
>>
>>
>> C stack backtrace:
>> pharo-vm/pharo[0x80a0c0c]
>> pharo-vm/pharo[0x80a0f28]
>> [0x408410]
>> [0x77744f1e]
>> [0x777447c8]
>> [0x7819010f]
>> [0x777454f9]
>> [0x777447c8]
>> [0x7818e112]
>> [0x777fc687]
>> [0x777456ea]
>> [0x77744668]
>>
>>
>> Smalltalk stack dump:
>> 0xbfc98e4c I [] in InteractiveResolverTest(TestCase)>runCase
>> 0x78f0bfc8: a(n) InteractiveResolverTest
>> 0xbfc98e6c M BlockClosure>ensure: 0x78fa4c34: a(n) BlockClosure
>> 0xbfc98e90 I InteractiveResolverTest(TestCase)>runCase 0x78f0bfc8:
>> a(n) InteractiveResolverTest
>> 0xbfc98eb4 I [] in TestResult>runCase: 0x78f0bdcc: a(n) TestResult
>> 0xbfc98ed0 M BlockClosure>on:do: 0x78fa4a30: a(n) BlockClosure
>> 0xbfc98ef8 I TestResult>runCase: 0x78f0bdcc: a(n) TestResult
>> 0xbfc98f1c I InteractiveResolverTest(TestCase)>run: 0x78f0bfc8: a(n)
>> InteractiveResolverTest
>> 0xbfc98f3c M [] in TestSuite>run: 0x78f0bfb0: a(n) TestSuite
>> 0xbfc98f5c M OrderedCollection>do: 0x78f0bfdc: a(n) OrderedCollection
>> 0xbfc9fdf0 I [] in TestSuite>run: 0x78f0bfb0: a(n) TestSuite
>> 0xbfc9fe10 M BlockClosure>ensure: 0x78fa48e4: a(n) BlockClosure
>> 0xbfc9fe34 I TestSuite>run: 0x78f0bfb0: a(n) TestSuite
>> 0xbfc9fe58 I [] in TestRunner>runSuite: 0x78e405bc: a(n) TestRunner
>> 0xbfc9fe80 I BlockClosure>cull:cull: 0x78f9c050: a(n) BlockClosure
>> 0xbfc9feb0 I [] in TestRunner>executeSuite:as: 0x78e405bc: a(n) TestRunner
>> 0xbfc9fed0 M BlockClosure>ensure: 0x78f9c420: a(n) BlockClosure
>> 0xbfc9fef4 I TestRunner>executeSuite:as: 0x78e405bc: a(n) TestRunner
>> 0xbfc9ff1c I TestRunner>runSuite: 0x78e405bc: a(n) TestRunner
>> 0xbfc9ff3c M [] in TestRunner>collectCoverageFor: 0x78e405bc: a(n)
>> TestRunner
>> 0xbfc9ff5c M BlockClosure>ensure: 0x78f9bfcc: a(n) BlockClosure
>> 0xbfc97e54 M [] in TestRunner>collectCoverageFor: 0x78e405bc: a(n)
>> TestRunner
>> 0xbfc97e74 M BlockClosure>ensure: 0x78f0dd7c: a(n) BlockClosure
>> 0xbfc97ea8 I BlockClosure>valueUnpreemptively 0x78f0dd7c: a(n)
>> BlockClosure
>> 0xbfc97ed4 I TestRunner>collectCoverageFor: 0x78e405bc: a(n) TestRunner
>> 0xbfc97ef8 M TestRunner>runCoverage 0x78e405bc: a(n) TestRunner
>> 0xbfc97f18 I PluggableButtonMorph>performAction: 0x78e6c24c: a(n)
>> PluggableButtonMorph
>> 0xbfc97f38 M [] in PluggableButtonMorph>mouseUp: 0x78e6c24c: a(n)
>> PluggableButtonMorph
>> 0xbfc97f5c M Array(SequenceableCollection)>do: 0x78ed9f14: a(n) Array
>> 0xbfc93e08 M PluggableButtonMorph>mouseUp: 0x78e6c24c: a(n)
>> PluggableButtonMorph
>> 0xbfc93e28 M PluggableButtonMorph(Morph)>handleMouseUp: 0x78e6c24c:
>> a(n) PluggableButtonMorph
>> 0xbfc93e44 M MouseButtonEvent>sentTo: 0x78ed9eec: a(n) MouseButtonEvent
>> 0xbfc93e60 M PluggableButtonMorph(Morph)>handleEvent: 0x78e6c24c: a(n)
>> PluggableButtonMorph
>> 0xbfc93e7c M PluggableButtonMorph(Morph)>handleFocusEvent: 0x78e6c24c:
>> a(n) PluggableButtonMorph
>> 0xbfc93ea4 M [] in HandMorph>sendFocusEvent:to:clear: 0x77b1c270: a(n)
>> HandMorph
>> 0xbfc93ec0 M [] in PasteUpMorph>becomeActiveDuring: 0x7796b824: a(n)
>> PasteUpMorph
>> 0xbfc93edc M BlockClosure>on:do: 0x78ed9e5c: a(n) BlockClosure
>> 0xbfc93f08 M PasteUpMorph>becomeActiveDuring: 0x7796b824: a(n)
>> PasteUpMorph
>> 0xbfc93f2c M HandMorph>sendFocusEvent:to:clear: 0x77b1c270: a(n) HandMorph
>> 0xbfc93f54 M HandMorph>sendEvent:focus:clear: 0x77b1c270: a(n) HandMorph
>> 0xbfc92e44 M HandMorph>sendMouseEvent: 0x77b1c270: a(n) HandMorph
>> 0xbfc92e68 M HandMorph>handleEvent: 0x77b1c270: a(n) HandMorph
>> 0xbfc92e94 M HandMorph>processEvents 0x77b1c270: a(n) HandMorph
>> 0xbfc92eac M [] in WorldState>doOneCycleNowFor: 0x7797ab44: a(n)
>> WorldState
>> 0xbfc92ed0 M Array(SequenceableCollection)>do: 0x77846894: a(n) Array
>> 0xbfc92eec M WorldState>handsDo: 0x7797ab44: a(n) WorldState
>> 0xbfc92f08 M WorldState>doOneCycleNowFor: 0x7797ab44: a(n) WorldState
>> 0xbfc92f24 M WorldState>doOneCycleFor: 0x7797ab44: a(n) WorldState
>> 0xbfc92f40 M PasteUpMorph>doOneCycle 0x7796b824: a(n) PasteUpMorph
>> 0xbfc92f60 I [] in MorphicUIManager>? 0x7797ebd4: a(n) MorphicUIManager
>> 0x77c9891c s [] in BlockClosure>?
>>
>> Most recent primitives
>> class
>> class
>> class
>> class
>> class
>> class
>> class
>>
>>
>