* src/vm/jit/stack.c (stack_analyse): Fix: reset TYPE_VOID to
authoredwin <none@none>
Wed, 28 Feb 2007 22:30:31 +0000 (22:30 +0000)
committeredwin <none@none>
Wed, 28 Feb 2007 22:30:31 +0000 (22:30 +0000)
TYPE_ADR at the end of stack_analyse.

src/vm/jit/stack.c

index 14b18ac4f3f7233556db613f9b501abda4b327cf..c80029868aa3e525736ef8958065919d78816097 100644 (file)
@@ -22,7 +22,7 @@
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
    02110-1301, USA.
 
-   $Id: stack.c 7246 2007-01-29 18:49:05Z twisti $
+   $Id: stack.c 7420 2007-02-28 22:30:31Z edwin $
 
 */
 
@@ -4680,10 +4680,22 @@ icmd_BUILTIN:
 
        } while (sd.repeat && !deadcode);
 
-       /* reset locals of TYPE_RET to TYPE_ADR */
+    /* reset locals of TYPE_RET|VOID to TYPE_ADR */
+
+    /* A local variable may be used as both a returnAddress and a reference */
+    /* type variable, as we do not split variables between these types when */
+    /* renaming locals. While returnAddresses have been eliminated now, we  */
+    /* must assume that the variable is still used as TYPE_ADR.             */
+    /* The only way that a local can be TYPE_VOID at this point, is that it */
+    /* was a TYPE_RET variable for which incompatible returnAddresses were  */
+    /* merged. Thus we must treat TYPE_VOID in the same way as TYPE_RET     */
+    /* here.                                                                */
+    /* XXX: It would be nice to remove otherwise unused returnAddress       */
+    /*      variables from the local variable array, so they are not        */
+    /*      allocated by simplereg. (For LSRA this is not needed).          */
 
        for (i=0; i<sd.localcount; ++i) {
-               if (sd.var[i].type == TYPE_RET)
+               if (sd.var[i].type == TYPE_RET || sd.var[i].type == TYPE_VOID)
                        sd.var[i].type = TYPE_ADR;
        }