SyntheticAnalyzer: Allow the special unifyParam to be the last parameter.

Expression: Call setType in updateParentTypes.
InvokeOperator: print ThisOperator more often.


git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1293 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 24 years ago
parent cb12d3ead2
commit d0a70c3626
  1. 23
      jode/ChangeLog
  2. 22
      jode/jode/decompiler/LocalInfo.java
  3. 3
      jode/jode/decompiler/MethodAnalyzer.java.in
  4. 18
      jode/jode/expr/Expression.java.in
  5. 4
      jode/jode/expr/IfThenElseOperator.java
  6. 27
      jode/jode/expr/InvokeOperator.java.in
  7. 14
      jode/jode/jvm/SyntheticAnalyzer.java.in

@ -1,4 +1,21 @@
Tue Jan 30 15:35:19 2001 Jochen Hoenicke <jochen@gnu.org>
2001-01-31 Jochen Hoenicke <jochen@gnu.org>
* jode/expr/Expression.java.in (updateParentTypes): Call setType,
instead of merging the types. Other childs want to know about the
type change as well.
* jode/decompiler/LocalInfo.java (combineWith): Reorganized a bit,
but no changes.
* jode/expr/InvokeOperator.java.in (dumpExpression): Always print
the ThisOperator if a field is from a parent class of an outer
class is used. And always qualify the this operator if not
innermost.
2001-01-30 Jochen Hoenicke <jochen@gnu.org>
* jode/jvm/SyntheticAnalyzer.java.in (checkConstructorAccess):
Allow the special unifyParam to be the last parameter.
2001-01-30 Jochen Hoenicke <jochen@gnu.org>
* jode/decompiler/TabbedPrintWriter.java: Better gnu style handling:
(openBraceClass) (closeBraceClass)
@ -16,7 +33,7 @@ Tue Jan 30 15:35:19 2001 Jochen Hoenicke <jochen@gnu.org>
* jode/decompiler/UnaryOperator.java (dumpExpression): Insert
a space for GNU_SPACING.
Tue Jan 30 15:28:10 2001 Jochen Hoenicke <jochen@gnu.org>
2001-01-30 Jochen Hoenicke <jochen@gnu.org>
Added pascal style from Rolf Howarth <rolf@squarebox.co.uk>
* jode/decompiler/Options.java (PASCAL_STYLE): new constant.
@ -27,7 +44,7 @@ Tue Jan 30 15:28:10 2001 Jochen Hoenicke <jochen@gnu.org>
openBraceContinue, closeBrace, closeBraceNoSpace,
closeBraceContinue): handle flush left.
Tue Jan 30 00:28:10 2001 Jochen Hoenicke <jochen@gnu.org>
2001-01-30 Jochen Hoenicke <jochen@gnu.org>
* jode/type/NullType.java (intersection): Removed, since the
version in ReferenceType is more correct. Before

@ -126,13 +126,17 @@ public class LocalInfo implements Declarable {
* If this is called with ourself nothing will happen.
* @param li the local info that we want to shadow.
*/
public void combineWith(LocalInfo li) {
li = li.getLocalInfo();
if (shadow != null) {
getLocalInfo().combineWith(li);
} else {
if (this != li) {
shadow = li;
public void combineWith(LocalInfo shadow) {
if (this.shadow != null) {
getLocalInfo().combineWith(shadow);
return;
}
shadow = shadow.getLocalInfo();
if (this == shadow)
return;
this.shadow = shadow;
if (!nameIsGenerated)
shadow.name = name;
if (constExpr != null) {
@ -147,7 +151,7 @@ public class LocalInfo implements Declarable {
shadow.setType(type);
boolean needTypeUpdate = !li.type.equals(type);
boolean needTypeUpdate = !shadow.type.equals(type);
java.util.Enumeration enum = operators.elements();
while (enum.hasMoreElements()) {
@ -175,8 +179,6 @@ public class LocalInfo implements Declarable {
name = null;
operators = null;
}
}
}
/**
* Get the real LocalInfo. This may be different from the

@ -1011,8 +1011,7 @@ public class MethodAnalyzer implements Scope, ClassDeclarer {
expr).getSubExpressions()[0];
if (expr instanceof ThisOperator) {
outerValueArray[j] =
new ThisOperator(((ThisOperator)
expr).getClassInfo());
new ThisOperator(((ThisOperator) expr).getClassInfo());
continue;
}
LocalInfo li = null;

@ -53,23 +53,7 @@ public abstract class Expression {
}
public void updateParentType(Type otherType) {
Type newType = otherType.intersection(type);
if (type.equals(newType))
return;
if (newType == Type.tError) {
if (otherType == Type.tError) {
// Don't propagate type errors.
return;
}
GlobalOptions.err.println("updateParentType: Type error in "
+this+": merging "+getType()
+" and "+otherType);
if ((GlobalOptions.debuggingFlags
& GlobalOptions.DEBUG_TYPES) != 0)
Thread.dumpStack();
}
type = newType;
setType(newType);
if (parent != null)
parent.updateType();
}

@ -39,9 +39,9 @@ public class IfThenElseOperator extends Operator {
}
public void updateType() {
Type subType = Type.tSuperType(subExpressions[1].getType())
Type commonType = Type.tSuperType(subExpressions[1].getType())
.intersection(Type.tSuperType(subExpressions[2].getType()));
updateParentType(subType);
updateParentType(commonType);
}
public Expression simplify() {

@ -1058,28 +1058,17 @@ public final class InvokeOperator extends Operator
ThisOperator thisOp = (ThisOperator) subExpressions[0];
Scope scope = writer.getScope(thisOp.getClassInfo(),
Scope.CLASSSCOPE);
if (writer.conflicts(methodName, scope, Scope.METHODNAME)) {
thisOp.dumpExpression(writer, 950);
writer.breakOp();
writer.print(".");
} else if (/* This is a inherited field conflicting
* with a field name in some outer class.
if (writer.conflicts(methodName, scope, Scope.METHODNAME)
|| (/* This field is inherited from the parent of
* an outer class, or it is inherited from the
* parent of this class and there is a conflicting
* field in some outer class.
*/
getMethodAnalyzer() == null
&& writer.conflicts(methodName, null,
Scope.NOSUPERMETHODNAME)) {
ClassAnalyzer ana = methodAnalyzer.getClassAnalyzer();
while (ana.getParent() instanceof ClassAnalyzer
&& ana != scope)
ana = (ClassAnalyzer) ana.getParent();
if (ana == scope) {
// For a simple outer class we can say this
writer.print("this");
} else {
// For a class that owns a method that owns
// us, we have to give the full class name
&& (!isThis() ||
writer.conflicts(methodName, null,
Scope.NOSUPERMETHODNAME)))) {
thisOp.dumpExpression(writer, 950);
}
writer.breakOp();
writer.print(".");
}

@ -330,10 +330,11 @@ public class SyntheticAnalyzer implements Opcodes {
public boolean checkConstructorAccess() {
ClassInfo clazzInfo = method.getClazzInfo();
BytecodeInfo bytecode = method.getBytecode();
String[] paramTypes
= TypeSignature.getParameterTypes(method.getType());
Handler[] excHandlers = bytecode.getExceptionHandlers();
if (excHandlers != null && excHandlers.length != 0)
return false;
Iterator iter = bytecode.getInstructions().iterator();
Instruction instr = (Instruction) iter.next();
@ -343,8 +344,7 @@ public class SyntheticAnalyzer implements Opcodes {
if (instr.getLocalSlot() > slot
&& unifyParam == -1 && params > 0
&& TypeSignature.getParameterTypes(method.getType())
[params - 1].charAt(0) == 'L') {
&& paramTypes[params - 1].charAt(0) == 'L') {
unifyParam = params;
params++;
slot++;
@ -357,7 +357,12 @@ public class SyntheticAnalyzer implements Opcodes {
|| instr.getOpcode() == opc_dload) ? 2 : 1;
instr = (Instruction) iter.next();
}
if (instr.getOpcode() == opc_invokespecial) {
if (params > 0 && instr.getOpcode() == opc_invokespecial) {
if (unifyParam == -1 && params <= paramTypes.length
&& paramTypes[params - 1].charAt(0) == 'L')
unifyParam = params++;
Reference ref = instr.getReference();
String refClazz = ref.getClazz().substring(1);
if (!(refClazz.substring(0, refClazz.length()-1)
@ -371,6 +376,7 @@ public class SyntheticAnalyzer implements Opcodes {
|| unifyParam == -1
|| refType.getParameterTypes().length != params - 2)
return false;
instr = (Instruction) iter.next();
if (instr.getOpcode() != opc_return)
return false;

Loading…
Cancel
Save