[Cuis-dev] BoxedMorph post-class definition change recompilation failure
Gerald Klix
cuis.01 at klix.ch
Fri Mar 24 06:45:55 PDT 2023
Please see below.
HTH,
Gerald
On 3/24/23 2:34 PM, Alexandre Rousseau wrote:
>
> Do you really need an instance variable?
>
> Yes. I would like to submit some (minor modification and impact)
> change sets for BoxedMorph and PluggableButtonMorph, for eventual
> discussion (somewhat related to theming).
>
>
> There is a method Class>>#addInstVarName: that lets you add
> instance variables.
>
> Perfect, thanks.
>
>
> You can use the -e command-line option to execute code from the
> command line.
>
> Hmmm. Where did you find out about the -e option? I am running this on
> macOS
> (obtained from https://github.com/OpenSmalltalk/opensmalltalk-vm) and
> invoking
> ./Squeak.app/Contents/MacOS/Squeak -help outputs:
>
> $ ./Squeak.app/Contents/MacOS/Squeak -h
> unknown option: -h
> Usage: Squeak [<option>...] [<imageName> [<argument>...]]
> ./Squeak.app/Contents/MacOS/Squeak [<option>...] --
> [<argument>...]
> Common <option>s:
> -help print this help message, then exit
> -memory <size>[kmg] use fixed heap size (added to image size)
> -nohandlers disable sigsegv & sigusr1 handlers
> -timephases print start load and run times
> -breaksel selector set breakpoint on send of selector
> -failonffiexception when in an FFI callout primitive catch
> exceptions and fail the primitive
> -breakmnu selector set breakpoint on MNU of selector
> -eden <size>[kmg] set eden memory to bytes
> -leakcheck num check for leaks in the heap
> -stackpages num use n stack pages
> -numextsems num make the external semaphore table num in size
> -noheartbeat disable the heartbeat for VM debugging.
> disables input
> -pollpip (0|1) output on each poll for input
> -eventtrace mask print input events with types in mask to
> stderr
> -logplugin name only log primitives in plugin
> -trace[=num] enable tracing (optionally to a specific
> value)
> -warnpid print pid in warnings
> -codesize <size>[mk] set machine code memory to bytes
> -tracestores enable store tracing (assert check stores)
> -cogmaxlits <n> set max number of literals for methods to
> be compiled to machine code
> -cogminjumps <n> set min number of backward jumps for
> interpreted methods to be considered for compilation to machine code
> -reportheadroom report unused stack headroom on exit
> -maxoldspace <size>[kmg] set max size of old space memory to bytes
> -logscavenge log scavenging to scavenge.log
> -headless run in headless (no window) mode (default:
> false)
> -headfull run in headful (window) mode (default: true)
> -opengl use OpenGL for drawing the VM window. Must
> be the first argument.
> -core-graphics use CoreGraphics for drawing the VM
> window. Must be the first argument.
> -metal use Metal for drawing the VM window. Must
> be the first argument.
> -version print version information, then exit
> -blockonerror on error or segv block, not exit. useful
> for attaching gdb
> -blockonwarn on warning block, don't warn. useful for
> attaching gdb
> -exitonwarn treat warnings as errors, exiting on warn
> Notes:
> <imageName> defaults to `squeak.image'.
> If '-memory' or '-maxoldspace' are not specified then the heap
> will grow dynamically.
> <argument>s are ignored, but are processed by the Squeak image.
> The first <argument> normally names a Squeak `script' to execute.
> Precede <arguments> by `--' to use default image.
>
>
> $ ./Squeak.app/Contents/MacOS/Squeak -version
> 5.0 5.20220602.1410 Mac OS X built on Jun 2 2022 15:55:29 UTC
> Compiler: Apple LLVM 12.0.0 (clang-1200.0.32.29) [Production Spur
> 64-bit x64 VM]
> CoInterpreter VMMaker.oscog-dtl.3185 uuid:
> 0e7f07b8-eed6-4362-b223-86c98594ddb9 Jun 2 2022
> StackToRegisterMappingCogit VMMaker.oscog-mt.3179 uuid:
> c6fbcb07-2a19-ed4f-8b40-9c119a70882a Jun 2 2022
> VM: 202206021410
> runner at Mac-1654183989075.local:work/opensmalltalk-vm/opensmalltalk-vm
> Date: Thu Jun 2 16:10:44 2022 CommitHash: c9fd365
> Plugins: 202206021410
> runner at Mac-1654183989075.local:work/opensmalltalk-vm/opensmalltalk-vm
>
Do something like:
squeak Cuis6.0-????.image -h
This will display a help text and briefly open the vm window.
>
> On Fri, Mar 24, 2023 at 4:23 AM Gerald Klix via Cuis-dev
> <cuis-dev at lists.cuis.st <mailto: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 <mailto: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/8cefccc6/attachment.htm>
More information about the Cuis-dev
mailing list