commit-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[commit-cp] [patch #3437] Javap: constant pool numbers and sorting metho


From: Daniel Bonniot
Subject: [commit-cp] [patch #3437] Javap: constant pool numbers and sorting methods
Date: Wed, 13 Oct 2004 07:37:52 -0400
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7) Gecko/20040917 Firefox/0.9.3 StumbleUpon/1.998

This mail is an automated notification from the patch tracker
 of the project: classpath.




/**************************************************************************/
[patch #3437] Full Item Snapshot:

URL: <http://savannah.gnu.org/patch/?func=detailitem&item_id=3437>
Project: classpath
Submitted by: Daniel Bonniot
On: Wed 10/13/2004 at 11:30

Category:  None
Priority:  5 - Normal
Resolution:  None
Privacy:  Public
Assigned to:  None
Originator Email:  
Status:  Open


Summary:  Javap: constant pool numbers and sorting methods

Original Submission:  (This is a followup of 
http://lists.gnu.org/archive/html/cp-tools-discuss/2004-06/msg00001.html)

Hi,

I'm interested in using javap to compare two class files compiled for the same 
source file (and thus supposed to be similar). Basically, run javap on both and 
use diff. This kind of stuff is useful to debug or compare java compilers (or 
other languages compiling to java bytecode).

A first problem is that currently javap prints constant pool numbers. For 
instance the 87 in
#87=<Method java.lang.Object.<init> ()void>
This generates extraneous diffs if the constant pools are in different orders, 
or numbers are somehow shifted. I believe these numbers are rarely useful, 
especially as the constant pool itself is not printed as a header. So I think 
the default (and possibly only) behaviour should be to print
<Method java.lang.Object.<init> ()void>
This functionality is already present in gnu.bytecode, so it's a matter of 
setting a boolean (although I had to add constructors, because that option was 
not public).

A second problem is that methods might appear in different orders in the two 
classfiles. This also makes diffing basically useless. So it is useful to 
choose some canonical order. I chose to sort methods by alphabetical order.

Attach is a patch that does both of these things. They are not controlled by 
command-line options at this point. The new behaviour is as acceptable as the 
old one if one does not want to diff, so it might be as well to do it in all 
cases. I could add options if there is a reason why this would not be OK (but 
then i'd like to hear option names).

Feel free to apply the patch if it's acceptable as is, or to indicate if there 
is any issue with it.


Cheers,


Daniel


The Nice programming language: http://nice.sf.net






File Attachments
-------------------

-------------------------------------------------------
Date: Wed 10/13/2004 at 11:30  Name: javap.diff  Size: 4.16KB   By: bonniot
Implementation
http://savannah.gnu.org/patch/download.php?item_id=3437&amp;item_file_id=3758






For detailed info, follow this link:
<http://savannah.gnu.org/patch/?func=detailitem&item_id=3437>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/







reply via email to

[Prev in Thread] Current Thread [Next in Thread]