|
Message
From: cvs at opencores.org<cvs@o...>
Date: Sat Jun 24 10:01:48 CEST 2006
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/06/06 24:10:01 Modified: jop/java/tools/src/com/jopdesign/wcet WCETAnalyser.java WCETMethodBlock.java WCETBasicBlock.java Added: jop/java/tools/src/com/jopdesign/wcet WU.java Log: Can run StartLift Revision Changes Path 1.48 jop/java/tools/src/com/jopdesign/wcet/WCETAnalyser.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/wcet/WCETAnalyser.java.diff?r1=1.47&r2=1.48 (In the diff below, changes in quantity of whitespace are not shown.) Index: WCETAnalyser.java =================================================================== RCS file: /cvsroot/rasped/jop/java/tools/src/com/jopdesign/wcet/WCETAnalyser.java,v retrieving revision 1.47 retrieving revision 1.48 diff -u -b -r1.47 -r1.48 --- WCETAnalyser.java 22 Jun 2006 09:54:50 -0000 1.47 +++ WCETAnalyser.java 24 Jun 2006 08:01:47 -0000 1.48 @@ -1152,101 +1152,3 @@ // } while ((ih = ih.getNext()) != null); // Some utilitilities -class WU{ - - /** - * Parse WCA annotation - * @param wcaA Java source line possibly with a @WCA comment - * @return key,value String pairs - */ - public static HashMap wcaA(String wcaA){ - HashMap wcaAH = null; - int ai = wcaA.indexOf("@WCA"); - if(ai!=-1){ - wcaAH = new HashMap(); - String c = wcaA.substring(ai+"@WCA".length()); - StringTokenizer st = new StringTokenizer(c.trim()); - while(st.hasMoreTokens()){ - StringTokenizer stv = new StringTokenizer(st.nextToken(),"="); - String key = stv.nextToken(); - if(key.indexOf('<')!=-1) - key = key.substring(0,key.indexOf('<')); - if(!key.equals("loop")){ - System.out.println("WCA only understands \"loop\" token at this time, not:"+key); - System.exit(-1); - } - String val = stv.nextToken(); - wcaAH.put(key,val); - } - } - return wcaAH; - } - - /** - * Inserts spaces in front of a string. - * @param len the desired total length - * @param val the string - * @return the prepadded string - */ - public static String prepad(String val, int len){ - StringBuffer sb = new StringBuffer(); - for(int i=len;i>val.length();i--){ - sb.append(" "); - } - sb.append(val); - return sb.toString(); - } - - /** - * Inserts spaces behind a string. - * @param len the desired total length - * @param val the string - * @return the prepadded string - */ - public static String postpad(String val, int len){ - StringBuffer sb = new StringBuffer(); - sb.append(val); - for(int i=len;i>val.length();i--){ - sb.append(" "); - } - return sb.toString(); - } - - /** - * Return n repetitions of a string, which is usually a single character. - * @param val the string - * @param n the repetitions - * @return the repeated string - */ - public static String repeat(String val, int n){ - StringBuffer sb = new StringBuffer(); - for(int i=0;i<n;i++){ - sb.append(val); - } - return sb.toString(); - } - public static String printChains(ArrayList links){ - StringBuffer sb = new StringBuffer();
- for (int i=0;i<links.size();i++){
- sb.append("links["+i+"]"+printChain((ArrayList)links.get(i))+"\n");
- }
- return sb.toString();
- }
- /**
- * Print link info
- * @param link WCETBasicBlock
- * @return
- */
- public static String printChain(ArrayList link){
- StringBuffer sb = new StringBuffer();
- sb.append("chain[size="+link.size()+"]:");
- for (int j=0;j<link.size();j++){
- WCETBasicBlock wcbb = (WCETBasicBlock)link.get(j);
- sb.append(wcbb.getIDS());
- if(j<link.size()-1)
- sb.append(" -> ");
-
- }
- return sb.toString();
- }
-}
\ No newline at end of file
1.3 jop/java/tools/src/com/jopdesign/wcet/WCETMethodBlock.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/wcet/WCETMethodBlock.java.diff?r1=1.2&r2=1.3
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WCETMethodBlock.java
===================================================================
RCS file: /cvsroot/rasped/jop/java/tools/src/com/jopdesign/wcet/WCETMethodBlock.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- WCETMethodBlock.java 22 Jun 2006 11:12:32 -0000 1.2
+++ WCETMethodBlock.java 24 Jun 2006 08:01:47 -0000 1.3
@@ -142,6 +142,8 @@
public void check(){
if(!analyzed){
+System.out.println("about to check:"+name);
+System.out.println("abstract"+methodbcel.isAbstract());
controlFlowGraph();
@@ -198,9 +200,13 @@
} else {
n = 0;
}
+System.out.println("dg for:"+name);
directedGraph();
- wca.wcasb.append(toString());
+System.out.println("link for:"+name);
link();
+System.out.println("about to string:"+name);
+ wca.wcasb.append(toString());
+
if(!wca.cfgwcmbs.contains(this))
wca.cfgwcmbs.add(this);
wca.dotout.print("\tdot -Tps "+dotf+" > "+dotf.substring(0,dotf.length()-4)+".eps\n");
@@ -250,6 +256,7 @@
(((InvokeInstruction)ih.getInstruction()).getClassName(getCpg())).indexOf("Native")==-1){
//System.out.println("classname:"+((InvokeInstruction)ih.getInstruction()).getClassName(getCpg()));
//System.out.println("wca.nativeClass:"+wca.nativeClass);
+//System.out.println("INVOKEINSTRUCTION");
createBasicBlock(ih);
createBasicBlock(ih.getNext());
} else if (ih.getInstruction() instanceof BranchInstruction) {
@@ -326,10 +333,38 @@
T.bid = bid;
TreeMap newbbs = new TreeMap();
-
+System.out.println("cfg for:"+name);
for (Iterator iter = getBbs().keySet().iterator(); iter.hasNext();) {
WCETBasicBlock wbb = (WCETBasicBlock) getBbs().get(
(Integer) iter.next());
+ if(wbb.nodetype != WCETBasicBlock.SNODE && wbb.nodetype != WCETBasicBlock.TNODE){
+ if(wbb.stih.getInstruction() instanceof InvokeInstruction){
+ wbb.nodetype = WCETBasicBlock.INODE;
+ String methodid = ((InvokeInstruction)wbb.stih.getInstruction()).getClassName(getCpg())
+ +"."
+ +((InvokeInstruction)wbb.stih.getInstruction()).getMethodName(getCpg())
+ +((InvokeInstruction)wbb.stih.getInstruction()).getSignature(getCpg());
+ String retsig = ((InvokeInstruction)wbb.stih.getInstruction()).getReturnType(getCpg()).getSignature();
+
+ //signature Java Type, Z boolean, B byte, C char, S short, I int
+ //J long, F float, D double, L fully-qualified-class, [ type type[]
+System.out.println("found inode and wbb.bbinvo="+methodid);
+ wbb.bbinvo = methodid;
+System.out.println("-bbinvo:"+wbb.bbinvo);
+System.out.println("-name:"+name);
+System.out.println("-cname:"+cname);
+System.out.println("-IDS:"+wbb.getIDS());
+
+ } else{
+ wbb.nodetype = WCETBasicBlock.BNODE;
+ wbb.bbinvo = null;
+ }
+ //TODO: research how this should be done (athrow discussion with ms)
+ if(wbb.getInbbs().size() == 0){
+ System.out.println("Warning: connecting S to "+wbb.getIDS());
+ wbb.addTargeter(S);
+ }
+ }
newbbs.put(new Integer(wbb.bid),wbb);
//System.out.println("CFG putting "+wbb.bid+" in newbbs. Nodetype:"+wbb.nodetype);
}
@@ -365,7 +400,8 @@
// hook the called method to the outgoing node
if(wcbb.nodetype == WCETBasicBlock.INODE){
-
+System.out.println("linking inode in:"+name);
+System.out.println("and linking bbinvo:"+wcbb.bbinvo);
//if(wca.getMethod(wcbb.bbinvo)==null){
// System.out.println("wca.getMethod(wcbb.bbinvo) == null");
//}
@@ -375,13 +411,17 @@
// System.out.println("wca.getWCMB(wca.getMethod(wcbb.bbinvo)) == null");
//}
wcbb.invowcmb = wca.getWCMB(wca.getMethod(wcbb.bbinvo));
+if(wcbb.invowcmb==null)
+ System.out.println("link target: null (probably inherited)");
+else
+ System.out.println("link target:"+wcbb.invowcmb.name);
if(wcbb.invowcmb==null){ //check super class(es)
-//System.out.println("jc:"+jc.getClassName());
-//System.out.println("method:"+methodbcel.getName());
+System.out.println("jc:"+jc.getClassName());
+System.out.println("method:"+methodbcel.getName());
//System.out.println("sig:"+methodbcel.getSignature());
//System.out.println("wcbb.invowcmb0==null");
String bbinvotmp = wcbb.bbinvo;
-//System.out.println("bbinvotmp0:"+bbinvotmp);
+System.out.println("bbinvotmp0:"+bbinvotmp);
String jcinvostr = wcbb.bbinvo.substring(0,wcbb.bbinvo.lastIndexOf('.'));
String minvo = wcbb.bbinvo.substring(wcbb.bbinvo.lastIndexOf('.'));
//System.out.println("minvo:"+minvo);
@@ -394,8 +434,14 @@
break;
}
}
+
bbinvotmp = jcinvo.getSuperclassName()+minvo;
+System.out.println("inherited bbinvotmp: "+bbinvotmp);
+System.out.println("jcinvo:"+jcinvo.getClassName());
wcbb.invowcmb = wca.getWCMB(wca.getMethod(bbinvotmp));
+System.out.println("wcbb.invowcmb.name:"+wcbb.invowcmb.name);
+System.out.println("wcbb.invowcmb.cname:"+wcbb.invowcmb.cname);
+ wcbb.invowcmb.check();
if(jcinvo == null || wcbb.invowcmb == null){
System.out.println("Could not resolve inheritance for: "+jcinvostr);
@@ -429,6 +475,9 @@
System.out.println("jc abstract:"+jc.isAbstract());
}
}
+ else
+ wcbb.invowcmb.check();
+
leaf = false;
@@ -876,6 +925,8 @@
for (Iterator iter = bbs.keySet().iterator(); iter.hasNext();) {
Integer keyInt = (Integer) iter.next();
WCETBasicBlock wcbb = (WCETBasicBlock) bbs.get(keyInt);
+System.out.println("about to codestring this type of node:"+wcbb.nodetype);
+System.out.println("ids:"+wcbb.getIDS());
codeString.append(wcbb.toCodeString());
}
codeString.append("=========================================================================\n");
1.2 jop/java/tools/src/com/jopdesign/wcet/WCETBasicBlock.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/wcet/WCETBasicBlock.java.diff?r1=1.1&r2=1.2
(In the diff below, changes in quantity of whitespace are not shown.)
Index: WCETBasicBlock.java
===================================================================
RCS file: /cvsroot/rasped/jop/java/tools/src/com/jopdesign/wcet/WCETBasicBlock.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- WCETBasicBlock.java 22 Jun 2006 09:54:50 -0000 1.1
+++ WCETBasicBlock.java 24 Jun 2006 08:01:47 -0000 1.2
@@ -809,21 +809,27 @@
//invoke instructions
if(ih.getInstruction() instanceof InvokeInstruction){
- String methodid = ((InvokeInstruction)ih.getInstruction()).getClassName(wcmb.getCpg())
+if(nodetype!=WCETBasicBlock.INODE){
+ bbinvo = ((InvokeInstruction)ih.getInstruction()).getClassName(wcmb.getCpg())
+"."
+((InvokeInstruction)ih.getInstruction()).getMethodName(wcmb.getCpg())
+((InvokeInstruction)ih.getInstruction()).getSignature(wcmb.getCpg());
+}
String retsig = ((InvokeInstruction)ih.getInstruction()).getReturnType(wcmb.getCpg()).getSignature();
-
+////
//signature Java Type, Z boolean, B byte, C char, S short, I int
//J long, F float, D double, L fully-qualified-class, [ type type[]
- bbinvo = methodid;
- Method m = wcmb.wca.getMethod(methodid);
- if(methodid.startsWith("com.jopdesign.sys.Native")){
+// bbinvo = methodid;
+System.out.println("extra bbinvo:"+bbinvo);
+ Method m = wcmb.wca.getMethod(bbinvo);
+System.out.println("bbinvo:"+bbinvo);
+System.out.println("name:"+wcmb.name);
+System.out.println("cname:"+wcmb.cname);
+ if(bbinvo.startsWith("com.jopdesign.sys.Native")){
int opcode = wcmb.wca.getNativeOpcode(m.getName());//methodid);
if(opcode == -1){
sb.append(WU.prepad("*to check",10));
- invoStr = methodid + " did not find mapping";
+ invoStr = bbinvo + " did not find mapping";
}else
{
int cycles = WCETInstruction.getCycles(opcode,false,0);
@@ -832,7 +838,7 @@
sb.append(WU.prepad(Integer.toString(cycles),10));
sb.append(" ");
sb.append(" ");
- invoStr = methodid;
+ invoStr = bbinvo;
}
}
else if(m!=null && !m.isAbstract()){
@@ -895,9 +901,9 @@
}
sb.append(" ");
- invoStr = methodid+", invoke(n="+invon+"):"+invokehit+"/"+invokemiss+" return(n="+wcmb.getN()+"):"+rethit+"/"+retmiss;
+ invoStr = bbinvo+", invoke(n="+invon+"):"+invokehit+"/"+invokemiss+" return(n="+wcmb.getN()+"):"+rethit+"/"+retmiss;
if((((InvokeInstruction)ih.getInstruction()).getClassName(wcmb.getCpg())).equals(wcmb.wca.nativeClass)){
- invoStr = methodid;
+ invoStr = bbinvo;
}
}
else{
1.1 jop/java/tools/src/com/jopdesign/wcet/WU.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/com/jopdesign/wcet/WU.java?rev=1.1&content-type=text/x-cvsweb-markup
Index: WU.java
===================================================================
package com.jopdesign.wcet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
/**
* Utility class for WCA.
* @author rup,ms
*/
public class WU{
/**
* Parse WCA annotation
* @param wcaA Java source line possibly with a @WCA comment
* @return key,value String pairs
*/
public static HashMap wcaA(String wcaA){
HashMap wcaAH = null;
int ai = wcaA.indexOf("@WCA");
if(ai!=-1){
wcaAH = new HashMap();
String c = wcaA.substring(ai+"@WCA".length());
StringTokenizer st = new StringTokenizer(c.trim());
while(st.hasMoreTokens()){
StringTokenizer stv = new StringTokenizer(st.nextToken(),"=");
String key = stv.nextToken();
if(key.indexOf('<')!=-1)
key = key.substring(0,key.indexOf('<'));
if(!key.equals("loop")){
System.out.println("WCA only understands \"loop\" token at this time, not:"+key);
System.exit(-1);
}
String val = stv.nextToken();
wcaAH.put(key,val);
}
}
return wcaAH;
}
/**
* Inserts spaces in front of a string.
* @param len the desired total length
* @param val the string
* @return the prepadded string
*/
public static String prepad(String val, int len){
StringBuffer sb = new StringBuffer();
for(int i=len;i>val.length();i--){
sb.append(" ");
}
sb.append(val);
return sb.toString();
}
/**
* Inserts spaces behind a string.
* @param len the desired total length
* @param val the string
* @return the prepadded string
*/
public static String postpad(String val, int len){
StringBuffer sb = new StringBuffer();
sb.append(val);
for(int i=len;i>val.length();i--){
sb.append(" ");
}
return sb.toString();
}
/**
* Return n repetitions of a string, which is usually a single character.
* @param val the string
* @param n the repetitions
* @return the repeated string
*/
public static String repeat(String val, int n){
StringBuffer sb = new StringBuffer();
for(int i=0;i<n;i++){
sb.append(val);
}
return sb.toString();
}
public static String printChains(ArrayList links){
StringBuffer sb = new StringBuffer();
for (int i=0;i<links.size();i++){
sb.append("links["+i+"]"+printChain((ArrayList)links.get(i))+"\n");
}
return sb.toString();
}
/**
* Print link info
* @param link WCETBasicBlock
* @return
*/
public static String printChain(ArrayList link){
StringBuffer sb = new StringBuffer();
sb.append("chain[size="+link.size()+"]:");
for (int j=0;j<link.size();j++){
WCETBasicBlock wcbb = (WCETBasicBlock)link.get(j);
sb.append(wcbb.getIDS());
if(j<link.size()-1)
sb.append(" -> ");
}
return sb.toString();
}
}
|
 |