Commit 00f93def by Nathan Froyd Committed by Nathan Froyd

expr.c (quick_stack): Change type to a VEC.

	* expr.c (quick_stack): Change type to a VEC.  Update comment.
	(tree_list_free_list): Delete.
	(flush_quick_stack): Update for quick_stack type change.
	(push_value): Likewise.
	(pop_value): Likewise.

From-SVN: r159782
parent 1db0429a
2010-05-24 Nathan Froyd <froydnj@codesourcery.com>
* expr.c (quick_stack): Change type to a VEC. Update comment.
(tree_list_free_list): Delete.
(flush_quick_stack): Update for quick_stack type change.
(push_value): Likewise.
(pop_value): Likewise.
2010-05-23 Steven Bosscher <steven@gcc.gnu.org> 2010-05-23 Steven Bosscher <steven@gcc.gnu.org>
* java-gimplify.c: Do not include tm.h, toplev.h. * java-gimplify.c: Do not include tm.h, toplev.h.
......
...@@ -90,8 +90,8 @@ tree dtable_ident = NULL_TREE; ...@@ -90,8 +90,8 @@ tree dtable_ident = NULL_TREE;
int always_initialize_class_p = 0; int always_initialize_class_p = 0;
/* We store the stack state in two places: /* We store the stack state in two places:
Within a basic block, we use the quick_stack, which is a Within a basic block, we use the quick_stack, which is a VEC of expression
pushdown list (TREE_LISTs) of expression nodes. nodes.
This is the top part of the stack; below that we use find_stack_slot. This is the top part of the stack; below that we use find_stack_slot.
At the end of a basic block, the quick_stack must be flushed At the end of a basic block, the quick_stack must be flushed
to the stack slot array (as handled by find_stack_slot). to the stack slot array (as handled by find_stack_slot).
...@@ -116,10 +116,7 @@ int always_initialize_class_p = 0; ...@@ -116,10 +116,7 @@ int always_initialize_class_p = 0;
So dup cannot just add an extra element to the quick_stack, but iadd can. So dup cannot just add an extra element to the quick_stack, but iadd can.
*/ */
static GTY(()) tree quick_stack; static GTY(()) VEC(tree,gc) *quick_stack;
/* A free-list of unused permanent TREE_LIST nodes. */
static GTY((deletable)) tree tree_list_free_list;
/* The physical memory page size used in this computer. See /* The physical memory page size used in this computer. See
build_field_ref(). */ build_field_ref(). */
...@@ -215,33 +212,24 @@ static void ...@@ -215,33 +212,24 @@ static void
flush_quick_stack (void) flush_quick_stack (void)
{ {
int stack_index = stack_pointer; int stack_index = stack_pointer;
tree prev, cur, next; unsigned ix;
tree t;
/* First reverse the quick_stack, and count the number of slots it has. */ /* Count the number of slots the quick stack is holding. */
for (cur = quick_stack, prev = NULL_TREE; cur != NULL_TREE; cur = next) for (ix = 0; VEC_iterate(tree, quick_stack, ix, t); ix++)
{ stack_index -= 1 + TYPE_IS_WIDE (TREE_TYPE (t));
next = TREE_CHAIN (cur);
TREE_CHAIN (cur) = prev;
prev = cur;
stack_index -= 1 + TYPE_IS_WIDE (TREE_TYPE (TREE_VALUE (cur)));
}
quick_stack = prev;
while (quick_stack != NULL_TREE) for (ix = 0; VEC_iterate(tree, quick_stack, ix, t); ix++)
{ {
tree decl; tree decl, type = TREE_TYPE (t);
tree node = quick_stack, type;
quick_stack = TREE_CHAIN (node);
TREE_CHAIN (node) = tree_list_free_list;
tree_list_free_list = node;
node = TREE_VALUE (node);
type = TREE_TYPE (node);
decl = find_stack_slot (stack_index, type); decl = find_stack_slot (stack_index, type);
if (decl != node) if (decl != t)
java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (node), decl, node)); java_add_stmt (build2 (MODIFY_EXPR, TREE_TYPE (t), decl, t));
stack_index += 1 + TYPE_IS_WIDE (type); stack_index += 1 + TYPE_IS_WIDE (type);
} }
VEC_truncate (tree, quick_stack, 0);
} }
/* Push TYPE on the type stack. /* Push TYPE on the type stack.
...@@ -282,16 +270,8 @@ push_value (tree value) ...@@ -282,16 +270,8 @@ push_value (tree value)
value = convert (type, value); value = convert (type, value);
} }
push_type (type); push_type (type);
if (tree_list_free_list == NULL_TREE) VEC_safe_push (tree, gc, quick_stack, value);
quick_stack = tree_cons (NULL_TREE, value, quick_stack);
else
{
tree node = tree_list_free_list;
tree_list_free_list = TREE_CHAIN (tree_list_free_list);
TREE_VALUE (node) = value;
TREE_CHAIN (node) = quick_stack;
quick_stack = node;
}
/* If the value has a side effect, then we need to evaluate it /* If the value has a side effect, then we need to evaluate it
whether or not the result is used. If the value ends up on the whether or not the result is used. If the value ends up on the
quick stack and is then popped, this won't happen -- so we flush quick stack and is then popped, this won't happen -- so we flush
...@@ -604,15 +584,8 @@ static tree ...@@ -604,15 +584,8 @@ static tree
pop_value (tree type) pop_value (tree type)
{ {
type = pop_type (type); type = pop_type (type);
if (quick_stack) if (VEC_length (tree, quick_stack) != 0)
{ return VEC_pop (tree, quick_stack);
tree node = quick_stack;
quick_stack = TREE_CHAIN (quick_stack);
TREE_CHAIN (node) = tree_list_free_list;
tree_list_free_list = node;
node = TREE_VALUE (node);
return node;
}
else else
return find_stack_slot (stack_pointer, promote_type (type)); return find_stack_slot (stack_pointer, promote_type (type));
} }
......
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