[squeak-dev] renaming a class causes invalid super pointer CompiledMethod..!

Tobias Pape Das.Linux at gmx.de
Tue Jan 20 21:05:55 UTC 2015


Hi,


On 20.01.2015, at 21:33, Eliot Miranda <eliot.miranda at gmail.com> wrote:

> 
> **	aClass updateMethodBindingsTo: binding.

While this will fix the home method problem,
the effect is that other bindings are not updated.
Probabl


A) In 4.4, this works:
	| p |
	p := Object subclass: #Peter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Unknown'.
	p compile: 'susi ^ Peter new'.
	" literals of #susi:
		{#Peter->Peter . #susi . #Peter->Peter}
	"
	p rename: #Anton.
	" literals of #susi:
		{#Anton->Anton . #susi . #Anton->Anton}
	"
	p new susi. "Works, returns an Anton, but source is out of sync"


B) In 4.5:
	| p |
	p := Object subclass: #Peter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Unknown'.
	p compile: 'susi ^ Peter new'.
	" literals of #susi:
		{#Peter=>Peter . #susi . #Peter=>Peter}
	"
	p rename: #Anton.
	" literals of #susi:
		{#Peter=>nil . #susi . #Peter=>nil}
	"
	p new susi. "Does not work, throws a DNU on nil, using #susi may crash the vm "


C) In Trunk, after Environments-topa.54:
	| p |
	p := Object subclass: #Peter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Unknown'.
	p compile: 'susi ^ Peter new'.
	" literals of #susi:
		{#Peter=>Peter . #susi . #Peter=>Peter}
	"
	p rename: #Anton.
	" literals of #susi:
		 {#Anton=>Anton . #susi . #Anton=>Anton}
	"
	p new susi. "Works, returns an Anton, but source is out of sync"


So, we got the 4.4 behavior back.
However, Colin (cc) explicitly has a test that checks that a rename actually
creates a new binding[1]. This mean, with Eliot's patch it would look like this:

D)
	| p |
	p := Object subclass: #Peter instanceVariableNames: '' classVariableNames: '' poolDictionaries: '' category: 'Unknown'.
	p compile: 'susi ^ Peter new'.
	" literals of #susi:
		{#Peter=>Peter . #susi . #Peter=>Peter}
	"
	p rename: #Anton.
	" literals of #susi:
		{#Peter=>nil . #susi . #Anton=>Anton}
	"
	p new susi. "Does not work, throws a DNU on nil, would not crash the VM, Source is in sync, because Peter is now undeclared."


After some discussion with Bert, we came to the conclusion that
either of C) or D) can be desirable; the literal `Peter` is actually undeclared (as per D))
and probably running into an error is the right thing. Yet C) retains backwards compatibility.

Ideas?

Best
	-Tobias



[1]: Colin, could you elaborate on that?







More information about the Squeak-dev mailing list