FlowBlock: Handle nops.

StructuredBlock stupid typo.
TransformConstructors: multiple bug fixes, comments updated
Makefile optimized


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1219 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
jochen 25 years ago
parent d79c1f7b8b
commit 7fc1ab0b1e
  1. 2
      jode/jode/flow/FlowBlock.java.in
  2. 4
      jode/jode/flow/Makefile.am
  3. 4
      jode/jode/flow/StructuredBlock.java.in
  4. 53
      jode/jode/flow/TransformConstructors.java

@ -818,7 +818,7 @@ public class FlowBlock {
info.gen.addAll(succGen); info.gen.addAll(succGen);
info.kill.addAll(succKill); info.kill.addAll(succKill);
} }
} else { } else if (!(block instanceof EmptyBlock)) {
checkConsistent(); checkConsistent();
if ((GlobalOptions.debuggingFlags if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_FLOW) != 0) { & GlobalOptions.DEBUG_FLOW) != 0) {

@ -8,7 +8,7 @@ JAVADEP = $(top_builddir)/javaDependencies.pl -subdir=$(subdir)\
CLASSPATH = @CLASSPATH@ CLASSPATH = @CLASSPATH@
CLASSLIB = @CLASSLIB@ CLASSLIB = @CLASSLIB@
SUBSTCP = @SUBSTCP@ SUBSTCP = @SUBSTCP@
BUILD_CLASSPATH = $(top_srcdir):$(top_builddir):$(CLASSPATH):$(CLASSLIB) FULL_CLASSPATH := $(shell $(SUBSTCP) $(top_srcdir):$(top_builddir):$(CLASSPATH):$(CLASSLIB))
MY_JAVA_FILES = \ MY_JAVA_FILES = \
BreakBlock.java \ BreakBlock.java \
@ -58,7 +58,7 @@ EXTRA_DIST = $(MY_JAVA_FILES)
@QUOTE@-include Makefile.dep @QUOTE@-include Makefile.dep
%.class: %.java %.class: %.java
$(JAVAC) -classpath `$(SUBSTCP) $(BUILD_CLASSPATH):$(CLASSLIB)` -d $(top_builddir) $< $(JAVAC) -classpath $(FULL_CLASSPATH) -d $(top_builddir) $<
Makefile.dep: $(MY_JAVA_FILES:.java=.class) Makefile.dep: $(MY_JAVA_FILES:.java=.class)
$(JAVADEP) $^ $(JAVADEP) $^

@ -503,8 +503,8 @@ public abstract class StructuredBlock {
} }
done.add(declarable); done.add(declarable);
declare.add(declarable); declare.add(declarable);
if (declare instanceof ClassAnalyzer) if (declarable instanceof ClassAnalyzer)
((ClassAnalyzer) declare).makeDeclaration(done); ((ClassAnalyzer) declarable).makeDeclaration(done);
} }
StructuredBlock[] subs = getSubBlocks(); StructuredBlock[] subs = getSubBlocks();
for (int i=0; i<subs.length; i++) for (int i=0; i<subs.length; i++)

@ -371,31 +371,31 @@ public class TransformConstructors {
private Expression renameJikesSuper(Expression expr, private Expression renameJikesSuper(Expression expr,
MethodAnalyzer methodAna, MethodAnalyzer methodAna,
int firstOuterSlot, int firstOuterSlot,
int firstParamSlot, int firstParamSlot) {
int slotDist) {
if (expr instanceof LocalLoadOperator) { if (expr instanceof LocalLoadOperator) {
LocalLoadOperator llop = (LocalLoadOperator) expr; LocalLoadOperator llop = (LocalLoadOperator) expr;
int slot = llop.getLocalInfo().getSlot(); int slot = llop.getLocalInfo().getSlot();
if (slot < firstOuterSlot) if (slot >= firstOuterSlot && slot < firstParamSlot)
return llop; return outerValues.getValueBySlot(slot);
if (slot >= firstParamSlot) { else {
Type[] paramTypes = methodAna.getType().getParameterTypes(); Type[] paramTypes = methodAna.getType().getParameterTypes();
int param; int param;
slot -= slotDist + 1; /* Adjust the slot */
for (param = 0; slot > 0 && param < paramTypes.length; param++) if (slot >= firstParamSlot)
slot -= firstParamSlot - firstOuterSlot;
for (param = 0; slot > 1 && param < paramTypes.length; param++)
slot -= paramTypes[param].stackSize(); slot -= paramTypes[param].stackSize();
llop.setLocalInfo(methodAna.getParamInfo(1+param)); llop.setLocalInfo(methodAna.getParamInfo(1+param));
llop.setMethodAnalyzer(methodAna); llop.setMethodAnalyzer(methodAna);
return llop; return llop;
} }
return outerValues.getValueBySlot(slot);
} }
if (expr instanceof Operator) { if (expr instanceof Operator) {
Expression subExpr[] = ((Operator)expr).getSubExpressions(); Expression subExpr[] = ((Operator)expr).getSubExpressions();
for (int i=0; i< subExpr.length; i++) { for (int i=0; i< subExpr.length; i++) {
Expression newSubExpr = Expression newSubExpr =
renameJikesSuper(subExpr[i], methodAna, renameJikesSuper(subExpr[i], methodAna,
firstOuterSlot, firstParamSlot, slotDist); firstOuterSlot, firstParamSlot);
if (newSubExpr != subExpr[i]) if (newSubExpr != subExpr[i])
((Operator)expr).setSubExpressions(i, newSubExpr); ((Operator)expr).setSubExpressions(i, newSubExpr);
} }
@ -425,21 +425,26 @@ public class TransformConstructors {
* constructor$?(optional outerValues[0], params); * constructor$?(optional outerValues[0], params);
* } * }
* *
* The outerValues[0] parameter is the normal this of the * The outerValues[0] parameter is the this local in the
* surrounding method (but what is the surrounding method? * surrounding method. But we can't be sure, what the
* That can't be determined in some cases). If the * surrounding method is, since it could be either the method
* surrounding method is static, the outerValues[0] parameter * that uses the class, or a method that declares the class, that
* disappears! * contains the method that uses the class.<br>
*
* If the surrounding method is static, the outerValues[0]
* parameter disappears.
* *
* Move optional super to method constructor$? * Move optional super to method constructor$?
* (renaming local variables) and mark constructor and * (renaming local variables) and mark constructor and
* constructor$? as Jikes constructor. * constructor$? as Jikes constructor. */
*/
StructuredBlock sb = constr.getMethodHeader().block; StructuredBlock sb = constr.getMethodHeader().block;
Vector localLoads = null; Vector localLoads = null;
InstructionBlock superBlock = null; InstructionBlock superBlock = null;
if (i >= type0Count) { if (i >= type0Count) {
/* Extract the super() or this() call at the beginning
* of the constructor
*/
if (!(sb instanceof SequentialBlock) if (!(sb instanceof SequentialBlock)
|| !(sb.getSubBlocks()[1] instanceof InstructionBlock)) || !(sb.getSubBlocks()[1] instanceof InstructionBlock))
continue constr_loop; continue constr_loop;
@ -493,8 +498,8 @@ public class TransformConstructors {
if (outerValues.isJikesAnonymousInner()) if (outerValues.isJikesAnonymousInner())
paramCount--; paramCount--;
int minOuterCount = 0;
int maxOuterCount = paramCount - methodParams.length + 2; int maxOuterCount = paramCount - methodParams.length + 2;
int minOuterCount = maxOuterCount - 1;
int slot = 1; int slot = 1;
int firstParam = 1; int firstParam = 1;
Expression outer0 = null; Expression outer0 = null;
@ -502,18 +507,18 @@ public class TransformConstructors {
if (maxOuterCount > 0 if (maxOuterCount > 0
&& methodParams.length > 1 && methodParams.length > 1
&& outerValues.getCount() > 0) { && outerValues.getCount() > 0) {
/* check if the outerValues[0] param is present. /* Check if the outerValues[0] param is present.
* we can't be sure if maxOuterCount equals 1, but * we can't be sure if maxOuterCount equals 1, but
* we assume so. * we assume so, since at this time all possible
* Also calculate the correct minOuterSlots. * info about outers have been collected.
*/ */
if (((LocalLoadOperator)methodParams[firstParam] if (((LocalLoadOperator)methodParams[firstParam]
).getLocalInfo().getSlot() == 1) { ).getLocalInfo().getSlot() == 1) {
minOuterCount = maxOuterCount;
outer0 = outerValues.getValue(0); outer0 = outerValues.getValue(0);
firstParam++; firstParam++;
} else } else
maxOuterCount--; maxOuterCount--;
minOuterCount = maxOuterCount;
for (int j=0; j < maxOuterCount; j++) for (int j=0; j < maxOuterCount; j++)
slot += paramTypes[j].stackSize(); slot += paramTypes[j].stackSize();
} }
@ -541,13 +546,13 @@ public class TransformConstructors {
if (superBlock != null) { if (superBlock != null) {
Expression newExpr = Expression newExpr =
renameJikesSuper(superBlock.getInstruction(), methodAna, renameJikesSuper(superBlock.getInstruction(), methodAna,
firstOuterSlot, firstParamSlot, slotDist); firstOuterSlot, firstParamSlot);
superBlock.removeBlock(); superBlock.removeBlock();
methodAna.insertStructuredBlock(superBlock); methodAna.insertStructuredBlock(superBlock);
} }
if (outer0 != null) { if (outer0 != null) {
constr.getParamInfo(1).setExpression(outer0); methodAna.getParamInfo(1).setExpression(outer0);
cons[i].getMethodHeader().simplify(); methodAna.getMethodHeader().simplify();
} }
if ((GlobalOptions.debuggingFlags if ((GlobalOptions.debuggingFlags

Loading…
Cancel
Save