Problem with ColouringRegisterAllocator

Igor Stasenko siguctua at gmail.com
Thu Jun 5 09:32:57 UTC 2008


The bug was in my code

was

machine
	^ machine ifNil: [ MachineX86 new]

instead of:

machine
	^ machine ifNil: [ machine := MachineX86 new]

2008/6/2  <bryce at kampjes.demon.co.uk>:
> Igor Stasenko writes:
>  > in method addInterferenceEdge: firstRegister to: secondRegister
>  >
>  > is stumbled upon error: key not found when it does:
>  >
>  > secondNode := interferenceGraph at: secondRegister.
>  >
>  > an interferenceGraph keys  = a Set(t9 t11 t14 t10 t2 t24 t22 t19 t25
>  > t3 t8 t15 eax t20 t21 t16 t11 edx t17 t6 t3 t26 t12 t2 t4 t21 ecx t16
>  > t12 t9 t23 t1 t5 t20 t13 t15 t14 t5 t27 t1 t6 t19 eax t13 t4 t17 t18
>  > t28 t7 t8 t18 t10 t7)
>  >
>  > and secondRegister = eax.
>  >
>  > It looks like MedMachineRegister needs #= and #hash methods to make
>  > things working correctly with dictionaries.
>  >
>  > I'll try add these methods, lets see if issue will disappear.
>
> There should only ever be one instance of each register. The bug is
> creating the second one. That said, you may find it easier to
> impleemnt = and hash than track it down. Using identity is a
> deliberate design decision.
>
> Having multiple versions of the same item may cause problems. I
> think you may be OK with duplicate registers but am not sure.
>
>  > Btw, i don't know why or where it creates another instance of same
>  > register (MedMachineRegister name: #eax), in my code i using:
>  > 'machine registerNamed: #eax', which should create instance only once,
>  > and then return same instance for consequent calls.
>
> Bryce
> _______________________________________________
> Exupery mailing list
> Exupery at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/exupery
>



-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Exupery mailing list