From 908c1b43186a933c313b33cf1d814865fc1ffa46 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Tue, 22 Apr 2014 09:29:02 -0400 Subject: [PATCH] rta: guard `add_send` with a specific set, instead of overusing `live_methods`. Eg. a monomorph method could be live, without being subject to try_send. Signed-off-by: Jean Privat --- src/rapid_type_analysis.nit | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/rapid_type_analysis.nit b/src/rapid_type_analysis.nit index c68d33a..1017b08 100644 --- a/src/rapid_type_analysis.nit +++ b/src/rapid_type_analysis.nit @@ -161,9 +161,13 @@ class RapidTypeAnalysis return tree end - # Methods that are are still candidate to the try_send + # Methods that are still candidate to the try_send private var totry_methods = new HashSet[MMethod] + # Methods that are or were candidate to the try_send + # Used to ensure that try_send is only used once + private var try_methods = new HashSet[MMethod] + # The method definitions that remain to visit private var todo = new List[MMethodDef] @@ -379,9 +383,10 @@ class RapidTypeAnalysis fun add_send(recv: MType, mproperty: MMethod) do - if live_methods.has(mproperty) then return + if try_methods.has(mproperty) then return #print "new prop: {mproperty}" live_methods.add(mproperty) + try_methods.add(mproperty) if mproperty.mpropdefs.length == 1 then # If there is only one definition, just add the definition and do not try again the property var d = mproperty.mpropdefs.first -- 1.7.9.5