[Cuis-dev] BoxedMorph post-class definition change recompilation failure

Alexandre Rousseau yalexr at gmail.com
Fri Mar 24 12:09:37 PDT 2023


Nope. This still fails ...

> ./Squeak.app/Contents/MacOS/Squeak Cuis-Smalltalk-Dev/Cuis6.0-5686.image
> -d "BoxedMorph addInstVarName: 'someBorderStyle'"

 ...

Class reshaping: WorldMorph has some instance running
> #runDeferredUIMessages. This CompiledMethod would become invalid. Class
> reshaping aborted.
> Class reshaping: WorldMorph has some instance running
> #runDeferredUIMessages. This CompiledMethod would become invalid. Class
> reshaping aborted.
> Class reshaping: WorldMorph has some instance running #doOneCycleNow. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #doOneCycle:. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #mainLoop. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #mainLoop. This
> CompiledMethod would become invalid. Class reshaping aborted.


On Fri, Mar 24, 2023 at 4:23 AM Gerald Klix via Cuis-dev <
cuis-dev at lists.cuis.st> wrote:

> On 3/24/23 8:31 AM, Alexandre Rousseau via Cuis-dev wrote:
>
> I'm trying to modify rather than subclass BoxedMorp, adding a new instance
> var to the class definition. This fails while Transcript reports what
> follows.
>
> I'm guessing that recompilation of BoxedMorph does not play well while a
> WorldMorph (a subclass of BoxedMorph itself) instance is running.
>
> What would be a way to work around this?
>
> Class reshaping: InnerTextMorph has some instance running #acceptContents.
>
> This CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: InnerTextMorph has some instance running
> #processKeystrokeEvent:. This CompiledMethod would become invalid. Class
> reshaping aborted.
> Class reshaping: InnerTextMorph has some instance running
> #processKeystrokeEvent:. This CompiledMethod would become invalid. Class
> reshaping aborted.
> Class reshaping: InnerTextMorph has some instance running #keyStroke:.
> This CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: InnerTextMorph has some instance running #keyStroke:.
> This CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: HandMorph has some instance running
> #startKeyboardDispatch:. This CompiledMethod would become invalid. Class
> reshaping aborted.
> Class reshaping: HandMorph has some instance running #processEventQueue.
> This CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #doOneCycleNow. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #handsDo:. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #doOneCycleNow. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #doOneCycle:. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #mainLoop. This
> CompiledMethod would become invalid. Class reshaping aborted.
> Class reshaping: WorldMorph has some instance running #mainLoop. This
> CompiledMethod would become invalid. Class reshaping aborted.
>
>
> First, let me analyze that problem.
> Nearly every Morph you see on the screen – SystemWindow and
> thus BrowserWindow – is derived from BoxedMorph. Juan added save guards
> to Object>>#become:, because adding the target object of #become:
> might still have some active contexts on the stack and these
> active contexts refer to methods that where compiled for the
> source object of #bceome:. In your case the source object
> is the old class and the target object is the new class, with
> the added instance variable. If you will add the instance variable
> add the end, it would work out. Otherwise some
> morphic code in the running system will certainly crash.
>
> Now for ways around this mess:
>
> Do you really need an instance variable?
> Morphs also have properties, that should
> be used if the instance variable is nil for
> most morphs. Properties come in handy here,
> because the can be added at run-time.
>
> If you insist on adding instance variables,
> you have to add your variable with
> no morphic code on the stack, meaning you have to
> do it from the command line.
> There is a method Class>>#addInstVarName: that lets
> you add instance variables.
>
> You can use the -e command-line option
> to execute code from the command line.
>
>
> HTH,
>
> Gerald
> --
> Cuis-dev mailing list
> Cuis-dev at lists.cuis.st
> https://lists.cuis.st/mailman/listinfo/cuis-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230324/653b0978/attachment.htm>


More information about the Cuis-dev mailing list