[Pharo-dev] [Vm-dev] Re: [ANN] Ephemeron Support is Ready
Yuriy Tymchuk
yuriy.tymchuk at me.com
Thu Jun 30 08:28:27 UTC 2016
Maybe I will find some time to hack the tree-matching rules to highlight the matched piece of code. It’s so frustrating that they don’t do it…
Uko
> On 30 Jun 2016, at 10:17, Marcus Denker <marcus.denker at inria.fr> wrote:
>
>
>
>
> finalizationProcess
> "The finalization process arranges to send mourn to each element of the VM's finalization queue,
> which is accessed via primitiveFetchMourner. The VM signals FinalizationSemaphore whenever
> the queue is non-empty. This process loops, waiting on the semaphore, fetches the first element
> of the queue and then spawns a process at a higher priority to acually send the mourn messages.
> If an error occurs in the higher priority mourn loop process then this process will simply spawn
> another process, hence ensuring that errors in finalization methods don't break finalization.
>
> In addition this process also runs the old finalization scheme, supporting clients of the older,
> WeakRegistry based scheme. Hopefully this will go away when all cleints have moved over."
> | throttle firstMourner |
> throttle := Semaphore new.
> [FinalizationSemaphore wait; initSignals.
> "Support the old scheme until things have changed over..."
> self doOldFinalization.
> [firstMourner := self primitiveFetchMourner.
> firstMourner notNil] whileTrue:
> [[throttle signal.
> self mournLoopWith: firstMourner] forkAt: Processor activePriority + 1.
> throttle wait]]
>
> Doh! So I wrote a naked block, not a loop !! So it did nothing. Thank you!! I think the compiler should warn about naked blocks.
>
>
> I added a new Code-Critic rule "RBDeadBlockRule", with
>
> initialize
> super initialize.
> self matcher
> matches: '`{:node | node isBlock and: [node parent isSequence
> and: [ node isLastStatementInBlock not ]]}'
> do: [ :node :answer | node ]
>
> This now shows a warning in the tools (the explanation is shown when clicking on the ? button):
> It does not yet highlight the block and has no automatic transformation to fix the problem, but as
> a first step it should be nice to have.
>
>
> <Dead.jpg>
>
> This is in 60 update 126.
>
> (I did not read the mail again before doing it, so now it is called "dead", not "naked", we can change
> that... dead somehow makes it look to be related a "dead context"...).
>
> Marcus
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20160630/f587a7ac/attachment.htm
More information about the Vm-dev
mailing list