|
Message
From: cvs at opencores.org<cvs@o...>
Date: Sun Nov 5 00:28:00 CET 2006
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/06/11 05:00:28 Modified: jop/java/tools/src/com/jopdesign/build JOPizer.java StringInfo.java Log: Moved mtab pointer and array length from the object/array to the handle Revision Changes Path 1.15 jop/java/tools/src/com/jopdesign/build/JOPizer.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/build/JOPizer.java.diff?r1=1.14&r2=1.15 (In the diff below, changes in quantity of whitespace are not shown.) Index: JOPizer.java =================================================================== RCS file: /cvsroot/martin/jop/java/tools/src/com/jopdesign/build/JOPizer.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -b -r1.14 -r1.15 --- JOPizer.java 4 Oct 2006 17:34:06 -0000 1.14 +++ JOPizer.java 4 Nov 2006 23:27:59 -0000 1.15 @@ -41,7 +41,6 @@ // TODO add all changes??? public static final int METHOD_MAX_SIZE = 1024; - public static boolean useHandle = true; public static boolean dumpMgci = false; PrintWriter out; 1.3 jop/java/tools/src/com/jopdesign/build/StringInfo.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/build/StringInfo.java.diff?r1=1.2&r2=1.3 (In the diff below, changes in quantity of whitespace are not shown.) Index: StringInfo.java =================================================================== RCS file: /cvsroot/martin/jop/java/tools/src/com/jopdesign/build/StringInfo.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -b -r1.2 -r1.3 --- StringInfo.java 13 Jun 2005 18:42:27 -0000 1.2 +++ StringInfo.java 4 Nov 2006 23:27:59 -0000 1.3 @@ -15,7 +15,8 @@ */ public class StringInfo { - final static int STR_OBJ_LEN = 2; + // two handles a two word plus reference to char[] + final static int STR_OBJ_LEN = 2+2+1; public static HashMap usedStrings = new HashMap(); public static List list = new LinkedList(); @@ -36,20 +37,7 @@ usedStrings.put(s, si); list.add(si); - if (JOPizer.useHandle) { - /* flavius version - length += HANDLE_Words; // jump the string handle - length += HEADER_Words; // jump the string object header - length += STRING_Words; // jump the string object - length += HANDLE_Words; // jump the char[] handle - length += HEADER_Words; // jump the array header - length += s.length(); // jump the array contents - */ - length += STR_OBJ_LEN+1+s.length(); - length += 2; // two handles, no GC info for now - } else { - length += STR_OBJ_LEN+1+s.length(); - } + length += STR_OBJ_LEN+s.length(); } public static StringInfo getStringInfo(String s) { StringInfo si = (StringInfo) usedStrings.get(s); @@ -58,40 +46,13 @@ /** * Get the address of the String object. - * Internal startAddress points to the beginning of the object (the mtab pointer), - * but the returned reference is the the pointer to the first field. + * Internal startAddress points to the the object (= first field). * @return */ public int getAddress() { - if (JOPizer.useHandle) { return startAddress; - } else { - return startAddress+1; } - } - - // FIXME Should actually include ObjectImage - // to be common to GC - // the number of words needed before the actual pointer - // (or reference) to the string - // these are part of an actual handle
- public static final int PREHANDLE_Words = 1;
- // words needed in any object header
- public static final int HEADER_Words = 2; // changed from 4;
- // (MP moved to the handle, GCIptr moved to the class info)
- // string object size (no header)
- // ... it is just a value -> handle to a char array
- public static final int STRING_Words = 1;
-
- // handle size
- public static final int HANDLE_Words = 2;
-
- /*
- public int getHandle() {
- return startAddress + PREHANDLE_Words;
- }
- */
public StringInfo(String s, int addr) {
string = s;
@@ -132,46 +93,15 @@
}
public void dump(PrintWriter out, ClassInfo strcli, int arrygcinfo) {
- if (JOPizer.useHandle) {
+
int addr = stringTableAddress+startAddress;
commentary(string, addr, out);
- out.println("\t"+(addr+3)+",\t//\tString handle points to the first field");
- out.println("\t"+(addr+5)+",\t//\tchar[] handle points to the first element");
+ out.println("\t"+(addr+4)+",\t//\tString handle points to the first field");
out.println("\t"+strcli.methodsAddress+",\t//\t pointer to String mtab ");
- out.println("\t"+(addr+1)+",\t//\tchar ref. points to char[] handle");
-
- /* flavius version
-// String disp = string.replaceAll("\n","/n");
-// out.println("// ADDR:"+startAddress+" Constant String: \""+disp+"\"");
- commentary(string, startAddress, out);
- out.println("// Handle :"+getHandle());
- // write out the string handle
- int objptr = getHandle()+HEADER_Words+1;
- out.println("\t"+(strcli.methodsAddress-2)+", \t// String class info");
- out.println("\t"+objptr+", \t// instance ptr");
- // write the string object
- // out.println("\t"+strcli.methodsAddress+",\t// methods pointer");
- // out.println("\t"+strcli.gcinfoAddress+",\t// gc info address");
- out.println("\t"+getHandle()+",\t// handle");
- out.println("\t"+STRING_Words+",\t// object size");
- int charptr = objptr+STRING_Words+PREHANDLE_Words;
- out.println("\t"+charptr+",\t// string content handle");
- out.println("\t"+arrygcinfo+", \t// non-ref array fake class info");
- out.println("\t"+(objptr+STRING_Words+HANDLE_Words+HEADER_Words)+",\t// char[] pointer");
- // write also the header for the array!
- // out.println("\t0,\t// methods pointer - not used for arrays");
- // out.println("\t"+arrygcinfo+",\t// gc info for arrays of non-refs");
- out.println("\t"+charptr+",\t// handle");
- */
- } else {
- out.print("\t"+strcli.methodsAddress+", "+
- (stringTableAddress+startAddress+STR_OBJ_LEN+1)+",");
- commentary(string, stringTableAddress+startAddress, out);
-
- }
+ out.println("\t"+(addr+5)+",\t//\tchar[] handle points to the first element");
+ out.println("\t"+string.length()+",\t// array length in the handle");
+ out.println("\t"+(addr+2)+",\t//\tchar ref. points to char[] handle");
- // out.println("\t"+string.length()+",\t// array length");
- out.println("\t"+string.length()+",");
byte chrsp[] = string.getBytes();
out.print("\t");
for(int i=0;i<chrsp.length;i++) {
|
 |