* [java] Move binfo construction
@ 2004-07-09 19:35 Nathan Sidwell
2004-07-09 19:39 ` Andrew Haley
2004-07-10 0:32 ` Java: Fix TYPE_BINFO regression Bryce McKinlay
0 siblings, 2 replies; 4+ messages in thread
From: Nathan Sidwell @ 2004-07-09 19:35 UTC (permalink / raw)
To: gcc-patches; +Cc: Andrew Haley
[-- Attachment #1: Type: text/plain, Size: 437 bytes --]
This patch moves the java binfo construction next to the base binfo vector,
for the same reasons I changed C++%. Fortunately, Java was waay simpler!
built & tested on i686-pc-linux-gnu, ok?
nathan
% http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00902.html if you missed it.
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
[-- Attachment #2: binfo-6d.patch --]
[-- Type: text/plain, Size: 2932 bytes --]
2004-07-09 Nathan Sidwell <nathan@codesourcery.com>
* class.c (make_class): Do not create binfo here.
(set_super_info): Create it here.
* java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.
Index: java/class.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/class.c,v
retrieving revision 1.194
diff -c -3 -p -r1.194 class.c
*** java/class.c 8 Jul 2004 02:47:07 -0000 1.194
--- java/class.c 9 Jul 2004 15:48:51 -0000
*************** make_class (void)
*** 318,324 ****
{
tree type;
type = make_node (RECORD_TYPE);
- TYPE_BINFO (type) = make_tree_binfo (0);
MAYBE_CREATE_TYPE_TYPE_LANG_SPECIFIC (type);
return type;
--- 318,323 ----
*************** set_super_info (int access_flags, tree t
*** 473,481 ****
--- 472,482 ----
{
int total_supers = interfaces_count;
tree class_decl = TYPE_NAME (this_class);
+
if (super_class)
total_supers++;
+ TYPE_BINFO (this_class) = make_tree_binfo (0);
TYPE_VFIELD (this_class) = TYPE_VFIELD (object_type_node);
BINFO_BASE_BINFOS (TYPE_BINFO (this_class)) = make_tree_vec (total_supers);
if (super_class)
*************** set_super_info (int access_flags, tree t
*** 485,491 ****
BINFO_OFFSET (super_binfo) = integer_zero_node;
TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (this_class)), 0)
= super_binfo;
! CLASS_HAS_SUPER (this_class) = 1;
}
set_class_decl_access_flags (access_flags, class_decl);
--- 486,492 ----
BINFO_OFFSET (super_binfo) = integer_zero_node;
TREE_VEC_ELT (BINFO_BASE_BINFOS (TYPE_BINFO (this_class)), 0)
= super_binfo;
! CLASS_HAS_SUPER_FLAG (TYPE_BINFO (this_class)) = 1;
}
set_class_decl_access_flags (access_flags, class_decl);
Index: java/java-tree.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/java/java-tree.h,v
retrieving revision 1.208
diff -c -3 -p -r1.208 java-tree.h
*** java/java-tree.h 8 Jul 2004 07:46:06 -0000 1.208
--- java/java-tree.h 9 Jul 2004 15:48:54 -0000
*************** struct JCF;
*** 122,128 ****
/* True if the class whose TYPE_BINFO this is has a superclass.
(True of all classes except Object.) */
#define CLASS_HAS_SUPER_FLAG(BINFO) BINFO_FLAG_1 (BINFO)
! #define CLASS_HAS_SUPER(TYPE) CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE))
/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) \
--- 122,129 ----
/* True if the class whose TYPE_BINFO this is has a superclass.
(True of all classes except Object.) */
#define CLASS_HAS_SUPER_FLAG(BINFO) BINFO_FLAG_1 (BINFO)
! #define CLASS_HAS_SUPER(TYPE) \
! (TYPE_BINFO (TYPE) && CLASS_HAS_SUPER_FLAG (TYPE_BINFO (TYPE)))
/* Return the supertype of class TYPE, or NULL_TREE is it has none. */
#define CLASSTYPE_SUPER(TYPE) (CLASS_HAS_SUPER (TYPE) \
^ permalink raw reply [flat|nested] 4+ messages in thread
* [java] Move binfo construction
2004-07-09 19:35 [java] Move binfo construction Nathan Sidwell
@ 2004-07-09 19:39 ` Andrew Haley
2004-07-10 0:32 ` Java: Fix TYPE_BINFO regression Bryce McKinlay
1 sibling, 0 replies; 4+ messages in thread
From: Andrew Haley @ 2004-07-09 19:39 UTC (permalink / raw)
To: Nathan Sidwell; +Cc: gcc-patches
Nathan Sidwell writes:
> This patch moves the java binfo construction next to the base binfo vector,
> for the same reasons I changed C++%. Fortunately, Java was waay simpler!
>
> built & tested on i686-pc-linux-gnu, ok?
>
>
> 2004-07-09 Nathan Sidwell <nathan@codesourcery.com>
>
> * class.c (make_class): Do not create binfo here.
> (set_super_info): Create it here.
> * java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.
OK, thanks.
Andrew.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Java: Fix TYPE_BINFO regression
2004-07-09 19:35 [java] Move binfo construction Nathan Sidwell
2004-07-09 19:39 ` Andrew Haley
@ 2004-07-10 0:32 ` Bryce McKinlay
2004-07-12 21:13 ` Nathan Sidwell
1 sibling, 1 reply; 4+ messages in thread
From: Bryce McKinlay @ 2004-07-10 0:32 UTC (permalink / raw)
To: Nathan Sidwell; +Cc: gcc-patches, Andrew Haley, java-patches
This patch caused a Java testsuite regression for
libjava.compile/iface.java. The problem is that interface_of_p can
segfault due to lack of TYPE_BINFO if set_super_info() has not yet been
called on java.lang.Object. I'm checking in the patch below under the
"obvious" rule.
Regards
Bryce
2004-07-09 Bryce McKinlay <mckinlay@redhat.com>
* class.c (interface_of_p): Check for null TYPE_BINFO.
--- class.c 9 Jul 2004 18:36:02 -0000 1.195
+++ class.c 9 Jul 2004 23:18:33 -0000
@@ -533,8 +533,9 @@
int n, i;
tree basetype_vec;
- if (!(basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type2))))
+ if (! TYPE_BINFO (type2))
return 0;
+ basetype_vec = BINFO_BASE_BINFOS (TYPE_BINFO (type2));
n = TREE_VEC_LENGTH (basetype_vec);
for (i = 0; i < n; i++)
{
Nathan Sidwell wrote:
> This patch moves the java binfo construction next to the base binfo
> vector,
> for the same reasons I changed C++%. Fortunately, Java was waay simpler!
>
> built & tested on i686-pc-linux-gnu, ok?
>
> nathan
>
> % http://gcc.gnu.org/ml/gcc-patches/2004-07/msg00902.html if you
> missed it.
>
>------------------------------------------------------------------------
>
>2004-07-09 Nathan Sidwell <nathan@codesourcery.com>
>
> * class.c (make_class): Do not create binfo here.
> (set_super_info): Create it here.
> * java-tree.h (CLASS_HAS_SUPER): Cope with lack of a binfo.
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Java: Fix TYPE_BINFO regression
2004-07-10 0:32 ` Java: Fix TYPE_BINFO regression Bryce McKinlay
@ 2004-07-12 21:13 ` Nathan Sidwell
0 siblings, 0 replies; 4+ messages in thread
From: Nathan Sidwell @ 2004-07-12 21:13 UTC (permalink / raw)
To: Bryce McKinlay; +Cc: gcc-patches, Andrew Haley, java-patches
Bryce McKinlay wrote:
> This patch caused a Java testsuite regression for
> libjava.compile/iface.java. The problem is that interface_of_p can
> segfault due to lack of TYPE_BINFO if set_super_info() has not yet been
> called on java.lang.Object. I'm checking in the patch below under the
> "obvious" rule.
thanks. Forgot to test the library.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2004-07-12 15:35 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-09 19:35 [java] Move binfo construction Nathan Sidwell
2004-07-09 19:39 ` Andrew Haley
2004-07-10 0:32 ` Java: Fix TYPE_BINFO regression Bryce McKinlay
2004-07-12 21:13 ` Nathan Sidwell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).