]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* cgraph.c (cgraph_node::release_body): New argument keep_arguments
authormarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Sep 2014 10:37:44 +0000 (10:37 +0000)
committermarxin <marxin@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 26 Sep 2014 10:37:44 +0000 (10:37 +0000)
introduced.
* cgraph.h: Likewise.
* cgraphunit.c (cgraph_node::create_wrapper): Usage of new argument introduced.
* ipa-utils.h (polymorphic_type_binfo_p): Safe check for binfos created by Java.
* tree-ssa-alias.c (ao_ref_base_alias_set): Static function transformed to global.
* tree-ssa-alias.h: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@215640 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/cgraph.c
gcc/cgraph.h
gcc/cgraphunit.c
gcc/ipa-utils.h
gcc/tree-ssa-alias.c
gcc/tree-ssa-alias.h

index dc03561323b49ed3a8362185d03e9f1d12f68cdf..d92a705edf34e32341d612b984700b3cb535aff9 100644 (file)
@@ -1,3 +1,13 @@
+2014-09-26  Martin Liska  <mliska@suse.cz>
+
+       * cgraph.c (cgraph_node::release_body): New argument keep_arguments
+       introduced.
+       * cgraph.h: Likewise.
+       * cgraphunit.c (cgraph_node::create_wrapper): Usage of new argument introduced.
+       * ipa-utils.h (polymorphic_type_binfo_p): Safe check for binfos created by Java.
+       * tree-ssa-alias.c (ao_ref_base_alias_set): Static function transformed to global.
+       * tree-ssa-alias.h: Likewise.
+
 2014-09-26  Jakub Jelinek  <jakub@redhat.com>
            Max Ostapenko  <m.ostapenko@partner.samsung.com>
 
index 1cfc783f80a220f6d9dab6d010b99352bc3329f5..fdcaf79b3585b7be550cdb071765b0c02f9bed17 100644 (file)
@@ -1625,16 +1625,19 @@ release_function_body (tree decl)
 /* Release memory used to represent body of function.
    Use this only for functions that are released before being translated to
    target code (i.e. RTL).  Functions that are compiled to RTL and beyond
-   are free'd in final.c via free_after_compilation().  */
+   are free'd in final.c via free_after_compilation().
+   KEEP_ARGUMENTS are useful only if you want to rebuild body as thunk.  */
 
 void
-cgraph_node::release_body (void)
+cgraph_node::release_body (bool keep_arguments)
 {
   ipa_transforms_to_apply.release ();
   if (!used_as_abstract_origin && symtab->state != PARSING)
     {
       DECL_RESULT (decl) = NULL;
-      DECL_ARGUMENTS (decl) = NULL;
+
+      if (!keep_arguments)
+       DECL_ARGUMENTS (decl) = NULL;
     }
   /* If the node is abstract and needed, then do not clear DECL_INITIAL
      of its associated function function declaration because it's
index 74819064fffb4da9adb914ddfa2763e3fc6e6fb3..4fd58a551d50f94809c18a3928257ae109036e0c 100644 (file)
@@ -917,7 +917,7 @@ public:
      Use this only for functions that are released before being translated to
      target code (i.e. RTL).  Functions that are compiled to RTL and beyond
      are free'd in final.c via free_after_compilation().  */
-  void release_body (void);
+  void release_body (bool keep_arguments = false);
 
   /* cgraph_node is no longer nested function; update cgraph accordingly.  */
   void unnest (void);
index b854e4b2a37d6c644f12004dd89ba3a6a61b0d0d..d463505235267984565ecf9c704c38a2ac982711 100644 (file)
@@ -2294,8 +2294,9 @@ cgraph_node::create_wrapper (cgraph_node *target)
     /* Preserve DECL_RESULT so we get right by reference flag.  */
     tree decl_result = DECL_RESULT (decl);
 
-    /* Remove the function's body.  */
-    release_body ();
+    /* Remove the function's body but keep arguments to be reused
+       for thunk.  */
+    release_body (true);
     reset ();
 
     DECL_RESULT (decl) = decl_result;
index 029f39a0462ea49ea53ed62ecd5082c0ad1ac488..465bc267f3c7a59b2631cfa8a27c2e546fdbc5d3 100644 (file)
@@ -179,8 +179,10 @@ odr_type_p (const_tree t)
 inline bool
 polymorphic_type_binfo_p (const_tree binfo)
 {
-  /* See if BINFO's type has an virtual table associtated with it.  */
-  return BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo)));
+  /* See if BINFO's type has an virtual table associtated with it.
+     Check is defensive because of Java FE produces BINFOs
+     without BINFO_TYPE set.   */
+  return BINFO_TYPE (binfo) && BINFO_VTABLE (TYPE_BINFO (BINFO_TYPE (binfo)));
 }
 #endif  /* GCC_IPA_UTILS_H  */
 
index 442112adb63b5141dc96bc881a6b5b85b2ac2aa1..1bf88e29548442d47ded04ae9edb8665abfdbff3 100644 (file)
@@ -559,7 +559,7 @@ ao_ref_base (ao_ref *ref)
 
 /* Returns the base object alias set of the memory reference *REF.  */
 
-static alias_set_type
+alias_set_type
 ao_ref_base_alias_set (ao_ref *ref)
 {
   tree base_ref;
index 436381a9519d447ec204a3bb0a8e76c1623b4b13..0d35283803a38045967c1df52e0b5f183e030e5e 100644 (file)
@@ -98,6 +98,7 @@ extern void ao_ref_init (ao_ref *, tree);
 extern void ao_ref_init_from_ptr_and_size (ao_ref *, tree, tree);
 extern tree ao_ref_base (ao_ref *);
 extern alias_set_type ao_ref_alias_set (ao_ref *);
+extern alias_set_type ao_ref_base_alias_set (ao_ref *);
 extern bool ptr_deref_may_alias_global_p (tree);
 extern bool ptr_derefs_may_alias_p (tree, tree);
 extern bool ref_may_alias_global_p (tree);