Commit 6bbb4ad3 by Andrew Haley Committed by Andrew Haley

java-tree.h (LOCAL_VAR_OUT_OF_SCOPE_P): New.

2003-09-12  Andrew Haley  <aph@redhat.com>

        * java-tree.h (LOCAL_VAR_OUT_OF_SCOPE_P): New.
        (struct lang_decl_var:freed): New variable.
        * decl.c (poplevel): Mark local vars that have gone out of scope.
        (push_jvm_slot): Don't use the RTL of a var that has gone out of
        scope.

From-SVN: r73675
parent 2a53208d
2003-09-12 Andrew Haley <aph@redhat.com>
* java-tree.h (LOCAL_VAR_OUT_OF_SCOPE_P): New.
(struct lang_decl_var:freed): New variable.
* decl.c (poplevel): Mark local vars that have gone out of scope.
(push_jvm_slot): Don't use the RTL of a var that has gone out of
scope.
2003-11-16 Jason Merrill <jason@redhat.com> 2003-11-16 Jason Merrill <jason@redhat.com>
* Make-lang.in (java.tags): Create TAGS.sub files in each directory * Make-lang.in (java.tags): Create TAGS.sub files in each directory
......
...@@ -116,7 +116,8 @@ push_jvm_slot (int index, tree decl) ...@@ -116,7 +116,8 @@ push_jvm_slot (int index, tree decl)
tmp = TREE_VEC_ELT (decl_map, index); tmp = TREE_VEC_ELT (decl_map, index);
while (tmp != NULL_TREE) while (tmp != NULL_TREE)
{ {
if (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp))) if (TYPE_MODE (type) == TYPE_MODE (TREE_TYPE (tmp))
&& ! LOCAL_VAR_OUT_OF_SCOPE_P (tmp))
rtl = DECL_RTL_IF_SET (tmp); rtl = DECL_RTL_IF_SET (tmp);
if (rtl != NULL) if (rtl != NULL)
break; break;
...@@ -1266,6 +1267,7 @@ poplevel (int keep, int reverse, int functionbody) ...@@ -1266,6 +1267,7 @@ poplevel (int keep, int reverse, int functionbody)
tree block = 0; tree block = 0;
tree decl; tree decl;
int block_previously_created; int block_previously_created;
{
#if defined(DEBUG_JAVA_BINDING_LEVELS) #if defined(DEBUG_JAVA_BINDING_LEVELS)
binding_depth--; binding_depth--;
...@@ -1306,12 +1308,13 @@ poplevel (int keep, int reverse, int functionbody) ...@@ -1306,12 +1308,13 @@ poplevel (int keep, int reverse, int functionbody)
&& DECL_INITIAL (decl) != 0 && DECL_INITIAL (decl) != 0
&& TREE_ADDRESSABLE (decl)) && TREE_ADDRESSABLE (decl))
{ {
/* If this decl was copied from a file-scope decl /* If this decl was copied from a file-scope decl on account
on account of a block-scope extern decl, of a block-scope extern decl, propagate TREE_ADDRESSABLE
propagate TREE_ADDRESSABLE to the file-scope decl. to the file-scope decl.
DECL_ABSTRACT_ORIGIN can be set to itself if warn_return_type is DECL_ABSTRACT_ORIGIN can be set to itself if
true, since then the decl goes through save_for_inline_copying. */ warn_return_type is true, since then the decl goes
through save_for_inline_copying. */
if (DECL_ABSTRACT_ORIGIN (decl) != 0 if (DECL_ABSTRACT_ORIGIN (decl) != 0
&& DECL_ABSTRACT_ORIGIN (decl) != decl) && DECL_ABSTRACT_ORIGIN (decl) != decl)
TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1; TREE_ADDRESSABLE (DECL_ABSTRACT_ORIGIN (decl)) = 1;
...@@ -1322,6 +1325,11 @@ poplevel (int keep, int reverse, int functionbody) ...@@ -1322,6 +1325,11 @@ poplevel (int keep, int reverse, int functionbody)
pop_function_context (); pop_function_context ();
} }
} }
else if (TREE_CODE (decl) == VAR_DECL
&& DECL_LANG_SPECIFIC (decl) != NULL
&& DECL_LOCAL_SLOT_NUMBER (decl))
LOCAL_VAR_OUT_OF_SCOPE_P (decl) = 1;
}
/* If there were any declarations in that level, /* If there were any declarations in that level,
or if this level is a function body, or if this level is a function body,
......
...@@ -947,6 +947,9 @@ union lang_tree_node ...@@ -947,6 +947,9 @@ union lang_tree_node
/* True if NODE is a class initialization flag. */ /* True if NODE is a class initialization flag. */
#define LOCAL_CLASS_INITIALIZATION_FLAG_P(NODE) \ #define LOCAL_CLASS_INITIALIZATION_FLAG_P(NODE) \
(DECL_LANG_SPECIFIC (NODE) && LOCAL_CLASS_INITIALIZATION_FLAG(NODE)) (DECL_LANG_SPECIFIC (NODE) && LOCAL_CLASS_INITIALIZATION_FLAG(NODE))
/* True if NODE is a variable that is out of scope. */
#define LOCAL_VAR_OUT_OF_SCOPE_P(NODE) \
(DECL_LANG_SPECIFIC(NODE)->u.v.freed)
/* Create a DECL_LANG_SPECIFIC if necessary. */ /* Create a DECL_LANG_SPECIFIC if necessary. */
#define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \ #define MAYBE_CREATE_VAR_LANG_DECL_SPECIFIC(T) \
if (DECL_LANG_SPECIFIC (T) == NULL) \ if (DECL_LANG_SPECIFIC (T) == NULL) \
...@@ -1031,6 +1034,7 @@ struct lang_decl_var GTY(()) ...@@ -1031,6 +1034,7 @@ struct lang_decl_var GTY(())
tree wfl; /* Original wfl */ tree wfl; /* Original wfl */
unsigned int final_iud : 1; /* Final initialized upon declaration */ unsigned int final_iud : 1; /* Final initialized upon declaration */
unsigned int cif : 1; /* True: decl is a class initialization flag */ unsigned int cif : 1; /* True: decl is a class initialization flag */
unsigned int freed; /* Decl is no longer in scope. */
}; };
/* This is what 'lang_decl' really points to. */ /* This is what 'lang_decl' really points to. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment