diff options
author | Andrew Haley <aph@redhat.com> | 2002-10-14 18:12:12 +0000 |
---|---|---|
committer | Andrew Haley <aph@gcc.gnu.org> | 2002-10-14 18:12:12 +0000 |
commit | 3eb429b2ce44213e20b23ee8e8f5ec9b617926fa (patch) | |
tree | 53b1e0a1a868f57ff4e3b0a8d8b515b98e20cf7d /gcc/tree-inline.c | |
parent | 34146b9406f4281fc83386e58059457cba1b5e1b (diff) | |
download | gcc-3eb429b2ce44213e20b23ee8e8f5ec9b617926fa.zip gcc-3eb429b2ce44213e20b23ee8e8f5ec9b617926fa.tar.gz gcc-3eb429b2ce44213e20b23ee8e8f5ec9b617926fa.tar.bz2 |
tree-inline.c (remap_block): All local class initialization flags go in the outermost scope.
2002-10-14 Andrew Haley <aph@redhat.com>
* tree-inline.c (remap_block): All local class initialization
flags go in the outermost scope.
(expand_call_inline): Call java_inlining_map_static_initializers.
(expand_call_inline): Call java_inlining_merge_static_initializers.
* java/lang.c (merge_init_test_initialization): New.
(java_inlining_merge_static_initializers): New.
(inline_init_test_initialization): New.
(java_inlining_map_static_initializers): New.
* tree-inline.c (expand_call_inline): Convert retvar to expected
type.
From-SVN: r58129
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index cf4754c..f0194ad 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -336,6 +336,23 @@ remap_block (block, decls, id) { tree new_var; + /* All local class initialization flags go in the outermost + scope. */ + if (LOCAL_CLASS_INITIALIZATION_FLAG_P (old_var)) + { + /* We may already have one. */ + if (! splay_tree_lookup (id->decl_map, (splay_tree_key) old_var)) + { + tree outermost_block; + new_var = remap_decl (old_var, id); + DECL_ABSTRACT_ORIGIN (new_var) = NULL; + outermost_block = DECL_SAVED_TREE (current_function_decl); + TREE_CHAIN (new_var) = BLOCK_VARS (outermost_block); + BLOCK_VARS (outermost_block) = new_var; + } + continue; + } + /* Remap the variable. */ new_var = remap_decl (old_var, id); /* If we didn't remap this variable, so we can't mess with @@ -1180,7 +1197,9 @@ expand_call_inline (tp, walk_subtrees, data) *inlined_body = copy_body (id); #else /* INLINER_FOR_JAVA */ { - tree new_body = copy_body (id); + tree new_body; + java_inlining_map_static_initializers (fn, id->decl_map); + new_body = copy_body (id); TREE_TYPE (new_body) = TREE_TYPE (TREE_TYPE (fn)); BLOCK_EXPR_BODY (expr) = add_stmt_to_compound (BLOCK_EXPR_BODY (expr), @@ -1218,9 +1237,17 @@ expand_call_inline (tp, walk_subtrees, data) = chainon (COMPOUND_BODY (stmt), scope_stmt); #else /* INLINER_FOR_JAVA */ if (retvar) - BLOCK_EXPR_BODY (expr) - = add_stmt_to_compound (BLOCK_EXPR_BODY (expr), - TREE_TYPE (retvar), retvar); + { + /* Mention the retvar. If the return type of the function was + promoted, convert it back to the expected type. */ + if (TREE_TYPE (TREE_TYPE (fn)) != TREE_TYPE (retvar)) + retvar = build1 (NOP_EXPR, TREE_TYPE (TREE_TYPE (fn)), retvar); + BLOCK_EXPR_BODY (expr) + = add_stmt_to_compound (BLOCK_EXPR_BODY (expr), + TREE_TYPE (retvar), retvar); + } + + java_inlining_merge_static_initializers (fn, id->decl_map); #endif /* INLINER_FOR_JAVA */ /* Clean up. */ |