This is the mail archive of the mailing list for the Java project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: New C++ ABI: patches.

Alexandre Petit-Bianco writes:

> I can see that the vtbl is ajusted before being stored:

It looks like standard behavior with the new C++ compiler. The
computation takes place in cp/class.c:dfs_accumulate_vtbl_inits. The
write back takes place at the end of cp/init.c:expand_virtual_init().
I think we only see its here because it's the only time we're given a
chance to write a constructor in C++.

Since we don't want the C++ compiler to adjust the vtable, we can
reverse things manually. Or better, change the C++ compiler so that it
doesn't do that in certain cases. Here's a patch (Mark, what do you
think?) This let me pass the `int.class' problem. My sanity tests are
now all OK on x86/linux. I haven't tried recompiling the entire
runtime with it yet, but the build is running. I'm going to tests this
on PPC too. So if I can get Alpha to work, we could switch pretty soon
IMO. I don't think issues like the mangling of Unicode characters are
going to be resolved soon, we'll go with what we have.


2001-01-12  Alexandre Petit-Bianco  <>

	* cp/init.c: (dfs_accumulate_vtbl_inits): Not accumulation for
	Java type. 

Index: class.c
RCS file: /cvs/gcc/egcs/gcc/cp/class.c,v
retrieving revision 1.355
diff -u -p -r1.355 class.c
--- class.c     2001/01/10 23:06:26     1.355
+++ class.c     2001/01/13 01:28:18
@@ -7156,7 +7156,10 @@ dfs_accumulate_vtbl_inits (binfo, orig_b
   tree inits = NULL_TREE;
-  if (BINFO_NEW_VTABLE_MARKED (orig_binfo, t))
+  if (BINFO_NEW_VTABLE_MARKED (orig_binfo, t)
+      // Don't accumulate for Java types. Java object ctors written in
+      // C++ shouldn't fix the vtbl.
+      && !TYPE_FOR_JAVA (BINFO_TYPE (binfo)))
       tree vtbl;
       tree index;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]