This is the mail archive of the java-patches@gcc.gnu.org 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]
Other format: [Raw text]

Patch: RFC: alignment fix in resolve.cc


Tom Tromey writes:
 > Last night I had a dream that told me about a potential bug in libgcj.
 > This morning I looked, and sure enough the recent alignment changes
 > weren't propagated to the runtime code that lays out interpreted
 > classes.
 > 
 > I believe there is no way to observe a bug here with 3.3.  I tried to
 > think of a case but couldn't.  (Maybe I'll have another dream to tell
 > me :-)
 > 
 > However, I think this problem could be visible on the trunk if using
 > -fno-assume-compiled.  And of course this will be an issue if/when
 > -findirect-dispatch is fully implemented.
 > 
 > Andrew, what do you think?

I think you've got it back to front.  All that the new code does is
fix things so that CNI code is compliant with what gcj has always
done.  clz->superclass->size() should already take this into account.

The Right Thing to do is always to pad the size of a class so that its
size is an integer multiple of its alignment.  As long as that's done
everything will be fine, and the extra padding is already there.

 > I haven't tested (or even compiled) this yet.
 > I wasn't sure how to get the alignment of the superclass, so the
 > patch just uses Object in all cases.  It seemed to me that that must
 > be ok; hopefully someone will tell me if I'm mistaken.

Andrew.


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