[Vm-dev] Re: [Pharo-dev] Should literals be immutable ?
stepharo
stepharo at free.fr
Mon Oct 27 22:42:25 UTC 2014
Levente
I think that the first step is not to make sure that you cannot hack
inside literals like mad. But to make sure that in
99.99 % of the case, this assumption can hold.
Stef
On 27/10/14 15:46, Levente Uzonyi wrote:
>
>
>
> On Mon, 27 Oct 2014, Eliot Miranda wrote:
>
>> I disagree. It's about an incremental improvement. A per-object
> immutability bit used to protect against direct alteration of literals
> works. Right now there's nothing to stop one recompiling a method, and
> per-object immutability doesn't change that. So mutable compiled
> methods are tolerable (at least in VW we kept methods mutable). But
> having the bit stop direct modification of literals is goodness, not to
> be avoided because it doesn't prevent more exotic modification via
> become.
>
> But if you allow mutable CompiledMethods, then Clement's example can
> be rewritten as:
>
> MyClass >> #foo
>
> ^#(false) first
> ifFalse: [
> 'first call since compilation' logCr.
> thisContext method in: [ :method |
> (method literalAt: (method literals indexOf: #(false))
> put: { true }) ] ]
> ifTrue: [ 'other calls' logCr ]
>
> (#becomeForward: could also be used on the literal).
>
> How will you avoid implementing the deoptimization of the method (the
> slow path) when this is possible?
>
> Levente
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20141027/ac34f545/attachment.htm
More information about the Vm-dev
mailing list