|
Message
From: cvs at opencores.org<cvs@o...>
Date: Tue Jul 24 14:53:51 CEST 2007
Subject: [cvs-checkins] MODIFIED: jop ...
Date: 00/07/07 24:14:53 Added: jop/java/tools/src/wcet/components/graphbuilder/blocks BasicBlock.java InvokeBlock.java InvokeReturnBlock.java JOPBytecodeMethodHook.java MethodHook.java ReturnBlock.java Log: Revision Changes Path 1.1 jop/java/tools/src/wcet/components/graphbuilder/blocks/BasicBlock.java http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/wcet/components/graphbuilder/blocks/BasicBlock.java?rev=1.1&content-type=text/x-cvsweb-markup Index: BasicBlock.java =================================================================== /** * */ package wcet.components.graphbuilder.blocks; // import java.util.ArrayList; // import java.util.Iterator; import wcet.components.graphbuilder.instruction.exectime.ITimeAnalysisInstruction; import wcet.framework.interfaces.cfg.IVertexData; import wcet.framework.interfaces.instruction.IAnalysisInstruction; import wcet.framework.interfaces.instruction.OpCodes; /** * @author Elena Axamitova * @version 0.2 12.03.2007 * * Basic Block object. Represents a sequence of bytecodes without any jumps or jump * targets in the sequence. */ // TODO Instructions implemented in Java are not yet replaced with methods. // TODO maybe I should create some abstract ...Block classes public class BasicBlock implements IVertexData { // private ArrayList<ITimeAnalysisInstruction> instructions; /** * Basic block representing a sequence of bytecodes */ public static final int SIMPLE_BB = 0; /** * BasicBlock that stores information of a method invoke */ public static final int INVOKE_BB = 1; /** * BasicBlock that stores information of a method return */ public static final int RETURN_BB = 2; /** * worst case execution time of this blck in cycles */ protected int value; /** * this block type */ protected int type; /** * this block bytecode size in bytes */ protected int size; protected StringBuffer toString; public BasicBlock() { // this.instructions = new ArrayList<ITimeAnalysisInstruction>(); this.value = 0; this.type = BasicBlock.SIMPLE_BB; this.size = 0; this.toString = new StringBuffer(); } /** * Adds an analysis instruction to this block. * * @param insn - Instruction to be added */ public void addInstruction(IAnalysisInstruction insn) { ITimeAnalysisInstruction timeInsn = (ITimeAnalysisInstruction)insn; if (this.value != ITimeAnalysisInstruction.CYCLES_UNKNOWN) { int maxCycles = timeInsn.getCycles(); if (maxCycles != ITimeAnalysisInstruction.CYCLES_UNKNOWN) { this.value += maxCycles; } else { value = ITimeAnalysisInstruction.CYCLES_UNKNOWN; } } this.size += timeInsn.get8BitLength(); this.toString.append(OpCodes.OPCODE_NAMES[insn.getOpcode()]); this.toString.append(" "); } /** * @return this blck type
*/
public int getType(){
return this.type;
}
/*
* (non-Javadoc)
*
* @see wcet.interfaces.cfg.IVertexData#getValue()
*/
public int getValue() {
return this.value;
}
/**
* @return this block bytecode size in bytes
*/
public int getSize(){
return this.size;
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString(){
return "SimpleBB:"+this.size+", "+this.value+this.toString.toString();
}
}
1.1 jop/java/tools/src/wcet/components/graphbuilder/blocks/InvokeBlock.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/wcet/components/graphbuilder/blocks/InvokeBlock.java?rev=1.1&content-type=text/x-cvsweb-markup
Index: InvokeBlock.java
===================================================================
/**
*
*/
package wcet.components.graphbuilder.blocks;
import wcet.components.graphbuilder.instruction.exectime.MethodTimeAnalysisInsn;
import wcet.components.graphbuilder.methodgb.MethodKey;
import wcet.framework.interfaces.instruction.IAnalysisInstruction;
/**
* @author Elena Axamitova
* @version 0.1 11.04.2007
*
* BasicBlock extension that stores all relevant information of a return block.
*/
public class InvokeBlock extends InvokeReturnBlock {
public InvokeBlock(MethodKey key) {
super(key);
this.type = BasicBlock.INVOKE_BB;
}
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.InvokeReturnBlock#setAnalyserInstruction(wcet.framework.interfaces.instruction.IAnalysisInstruction)
*/
@Override
public void setAnalyserInstruction(IAnalysisInstruction myInsn) {
this.hiddenCycles = ((MethodTimeAnalysisInsn) myInsn).getHiddenCycles();
}
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.InvokeReturnBlock#toString()
*/
@Override
public String toString() {
String keyString;
if (this.methKey == null) {
keyString = "null";
} else {
keyString = this.methKey.toString();
}
return "InvBB:" + keyString + "Size:" + this.size;
}
}
1.1 jop/java/tools/src/wcet/components/graphbuilder/blocks/InvokeReturnBlock.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/wcet/components/graphbuilder/blocks/InvokeReturnBlock.java?rev=1.1&content-type=text/x-cvsweb-markup
Index: InvokeReturnBlock.java
===================================================================
/**
*
*/
package wcet.components.graphbuilder.blocks;
import com.jopdesign.wcet.WCETInstruction;
//import wcet.components.graphbuilder.instruction.ICacheMemoryConstants;
import wcet.components.graphbuilder.methodgb.MethodKey;
import wcet.framework.interfaces.instruction.IAnalysisInstruction;
/**
* @author Elena Axamitova
* @version 0.1 23.03.2007
*
* Common features of invoke and return blocks in a control flow graph.
*/
public abstract class InvokeReturnBlock extends BasicBlock {
/**
* key of the caller(retrun)/callee(invoke)
*/
protected MethodKey methKey =null;
/**
* number of hidden cyclen of this block's bytecode equivalent
*/
protected int hiddenCycles;
public InvokeReturnBlock(MethodKey key){
this.methKey = key;
this.hiddenCycles =0;
}
/**
* Set the size of this block's method
* @param s - size of the method
*/
public void setSize(int s){
this.size = s;
}
/**
* Set the instruction of this block (for example invokevirtual, areturn)
* @param myInsn - this block
*/
public abstract void setAnalyserInstruction(IAnalysisInstruction myInsn);
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.BasicBlock#getValue()
*/
@Override
public int getValue(){
return this.getCacheMissExecTime();
}
/**
* @return cycles needed to load this instruction in case of cache hit
*/
public int getCacheHitExecTime(){
int retVal = WCETInstruction.calculateB(true, this.getCacheSize());
return this.substractHiddenCycles(retVal);
/*int retVal = 0;
retVal = 4;
return this.substractHiddenCycles(retVal);
*/
}
/**
* @return cycles needed to load this instruction in case of cache miss
*/
public int getCacheMissExecTime(){
int retVal = WCETInstruction.calculateB(false, this.getCacheSize());
return this.substractHiddenCycles(retVal);
/*int retVal = 0;
retVal = 6+ ((this.getCacheSize())+1)*(2+ICacheMemoryConstants.cws);
return this.substractHiddenCycles(retVal);*/
}
/**
* @return this block's method key
*/
public MethodKey getMethodKey(){
return this.methKey;
}
/**
* @param retVal - load time of this method's instruction
* @return load time minus hidden cycles of this method's instruction
*/
private int substractHiddenCycles(int retVal){
if(retVal>this.hiddenCycles){
return retVal - this.hiddenCycles;
}else {
return 0;
}
}
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.BasicBlock#addInstruction(wcet.framework.interfaces.instruction.IAnalysisInstruction)
*/
@Override
public void addInstruction(IAnalysisInstruction insn) {
//do nothing
}
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.BasicBlock#toString()
*/
@Override
public abstract String toString();
/**
* Get the size in 32 bit words.
*
* @return (size in bytes div 4)+1
*/
private int getCacheSize(){
double result = Math.floor(this.size/4);
return (int)Math.round(result);
}
}
1.1 jop/java/tools/src/wcet/components/graphbuilder/blocks/JOPBytecodeMethodHook.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/wcet/components/graphbuilder/blocks/JOPBytecodeMethodHook.java?rev=1.1&content-type=text/x-cvsweb-markup
Index: JOPBytecodeMethodHook.java
===================================================================
/**
*
*/
package wcet.components.graphbuilder.blocks;
import wcet.components.graphbuilder.methodgb.MethodBlock;
import wcet.framework.interfaces.instruction.IAnalysisInstruction;
/**
* @author Elena Axamitova
* @version 0.1 11.04.2007
*
* Not needed now, maybe later.
*/
public class JOPBytecodeMethodHook extends MethodHook {
private IAnalysisInstruction instruction;
public JOPBytecodeMethodHook(int invBB, int retBB, MethodBlock mb, IAnalysisInstruction insn){
super(invBB, retBB, mb);
this.instruction = insn;
}
public IAnalysisInstruction getInstruction(){
return this.instruction;
}
}
1.1 jop/java/tools/src/wcet/components/graphbuilder/blocks/MethodHook.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/wcet/components/graphbuilder/blocks/MethodHook.java?rev=1.1&content-type=text/x-cvsweb-markup
Index: MethodHook.java
===================================================================
/**
*
*/
package wcet.components.graphbuilder.blocks;
import wcet.components.graphbuilder.methodgb.MethodBlock;
/**
* @author Elena Axamitova
* @version 0.1 17.03.2007
*
* Representation of an (yet) unprocesed method invocation in the control flow graph.
*/
public class MethodHook {
/**
* method block of the invoked method
*/
private MethodBlock methB;
/**
* vertex id of the return block of this method
*/
private int retBB;
/**
* vertex id of the invoke block of this method
*/
private int invBB;
//private MethodBlock methBlock;
public MethodHook(int invBB, int retBB, MethodBlock mb){
this.retBB = retBB;
this.invBB = invBB;
this.methB = mb;
}
/**
* @return corresponding return block vertex id
*/
public int getReturnBlock(){
return this.retBB;
}
/**
* @return corresponding invoke block vertex id
*/
public int getInvokeBlock(){
return this.invBB;
}
/**
* @return corresponding method block
*/
public MethodBlock getMethodBlock(){
return this.methB;
}
}
1.1 jop/java/tools/src/wcet/components/graphbuilder/blocks/ReturnBlock.java
http://www.opencores.org/cvsweb.shtml/jop/java/tools/src/wcet/components/graphbuilder/blocks/ReturnBlock.java?rev=1.1&content-type=text/x-cvsweb-markup
Index: ReturnBlock.java
===================================================================
/**
*
*/
package wcet.components.graphbuilder.blocks;
import wcet.components.graphbuilder.instruction.exectime.InsnTimeAnalysisInsn;
import wcet.components.graphbuilder.methodgb.MethodKey;
import wcet.framework.interfaces.instruction.IAnalysisInstruction;
/**
* @author Elena Axamitova
* @version 0.1 11.04.2007
*
* BasicBlock extension that stores all relevant information of a return block.
*/
public class ReturnBlock extends InvokeReturnBlock {
public ReturnBlock(MethodKey key){
super(key);
this.type = BasicBlock.RETURN_BB;
}
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.InvokeReturnBlock#setAnalyserInstruction(wcet.framework.interfaces.instruction.IAnalysisInstruction)
*/
@Override
public void setAnalyserInstruction(IAnalysisInstruction myInsn) {
this.hiddenCycles = ((InsnTimeAnalysisInsn)myInsn).getHiddenCycles();
}
/* (non-Javadoc)
* @see wcet.components.graphbuilder.blocks.InvokeReturnBlock#toString()
*/
@Override
public String toString() {
String keyString;
if (this.methKey == null) {
keyString = "null";
} else {
keyString = this.methKey.toString();
}
return "RetBB:" + keyString + "Size:" + this.size;
}
}
|
 |