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

Alexandre Rousseau yalexr at gmail.com
Fri Mar 24 17:26:04 PDT 2023


>
> Adding an instance variable to Morph is tricky. Hence this preamble..."


Thanks. Very clear.    ... preamble, as in, to be performed via command
line -s <script> parameter?

On Fri, Mar 24, 2023 at 7:49 PM Juan Vuletich <juan at cuis.st> wrote:

> Those safeguards are there for a reason. Just removing them without really
> understanding what's going on is asking for trouble.
>
> To see how to do what you want to do, but in a safe way, see (for
> instance) change set #4110. You'll need to unzip the relevant file in
> /PreviousUpdates.
>
> Hope this helps.
>
> Cheers,
>
> On 3/24/2023 6:30 PM, Alexandre Rousseau via Cuis-dev wrote:
>
> I just learned a new word. Thanks. :)
>
> I compared this behaviour to that of Squeak 6. The latter issues a warning
> but in situ recompilation succeeds without subsequent side effects, in and
> this and subsequent sessions.
>
> Even replacing "Object >> become:" with the Squeak equivalent fails
> (errors).
>
> Bummer that. Will dig deeper if I can find time and shovel.
>
>
>
> On Fri, Mar 24, 2023 at 4:55 PM Gerald Klix <cuis.01 at klix.ch> wrote:
>
>> Oh well, this is becoming a bigger gymkhana.
>>
>> I presume you have too hack Object>>#become:; in essence disable all the
>> checking code
>> before { self } elementsExchangeIdentityWith: { otherObject }.
>>
>> NB:
>> The same method in Squeak just reads:
>>
>> become: otherObject
>>     "Primitive. Swap the object pointers of the receiver and the argument.
>>      All variables in the entire system that used to point to the
>> receiver now
>>      point to the argument, and vice-versa. Fails if either object is
>> read-only
>>      or is an immediate such as a SmallInteger."
>>
>>     {self} elementsExchangeIdentityWith: {otherObject}
>>
>>
>> Use the browsers "versions" button to restore the old version.
>> You can do all of this while the image is running.
>>
>> Again I learned two things:
>>
>> 1. Juan's precautionary code in become: checks all running processes.
>> 2. Command line parsing is done after the UI's display process was
>> started.
>>
>> See SystemDictionary>>#snapshot:andQuit:embedded:clearAllClassState:.
>> self processCommandLineArguments comes after
>> UISupervisor spawnNewMorphicProcessFor: (guiRootObject ifNil: [
>> guiRootObject := guiRootObjectClass newWorld ]).
>>
>>
>> HTH,
>>
>> Gerald
>>
>>
>>
>>
>> On 3/24/23 8:09 PM, Alexandre Rousseau wrote:
>>
>> 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
>>>
>>
>>
>
> --
> Juan Vuletichcuis.stgithub.com/jvuletichresearchgate.net/profile/Juan-Vuletichindependent.academia.edu/JuanVuletichpatents.justia.com/inventor/juan-manuel-vuletichlinkedin.com/in/juan-vuletich-75611b3twitter.com/JuanVuletich
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230324/2d055cb2/attachment-0001.htm>


More information about the Cuis-dev mailing list