This is the mail archive of the java@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] | |
Jon> Unfortunately, I don't get scared off easy :P :-) Jon> If you could send me both of those optimization passes, that would be Jon> terrific. I'll look at them and see if I can do anything. If not, Jon> I'll figure it out :) Cool. I've attached a patch and a couple of files. The patch adds some needed support for devirtualization. (I think part of it is already in the tree -- the java-tree.def bit.) Basically it wraps virtual and interface method invocations in OBJ_TYPE_REF trees, so that we can more easily detect them later. The first file implements devirtualization. The idea is that if we know something about the runtime type of an object, we can "strength reduce" calls, either virtual->nonvirtual, or interface->virtual. As I recall right now it is very lame, as in it only looks at calls on objects which were allocated with 'new Something'. (I thought maybe I changed this but I didn't read the code today to see...) One way I tried this was to add a printf to the pass and then rebuild the library; that let me see how often the optimization triggered... The second file implements "invariant propagation". The idea is that some things, like the vtable pointer or the length field of an array, cannot change in java. So, we can collapse these to their first (dominating) load. Arguably this should be done in a non-gcj-specific way in GCC. That would mean adding some way to explain this property in the trees and then making sure the optimizers can handle it properly. Note that this isn't quite enough to handle array bounds check elimination -- this pass works around the "aliasing problem" mentioned in the PR, but then, apparently, the optimizers (VRP I think) don't realize the real meaning of our unsigned comparison trick ... fixing this probably requires either changing gcj not to emit the unsigned comparison (but in this case we'd want to recapture this optimization later on) or changing the appropriate tree optimizer. As I recall one or both of these passes will crash on some files in libjava. How to get these in is an open problem. I'm sure we don't want to check in the hack that is currently used to register the passes. Tom
Attachment:
My-devirt-patch
Description: devirt patch
Attachment:
tree-ssa-devirt.c
Description: tree-ssa-devirt.c
Attachment:
tree-ssa-invariant.c
Description: tree-ssa-invariant.c
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |