summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStiver <stiver.mail@gmail.com>2014-07-21 14:28:40 +0200
committerStiver <stiver.mail@gmail.com>2014-07-21 14:28:40 +0200
commit6606a474bf8a634e6ee5a525f338c06a40590712 (patch)
treee071182abd3099ab26f4db64039db355d5c0ed37
parent58427deb498ba9a0caff72db129d4cf41791d8e6 (diff)
downloadfernflower-6606a474bf8a634e6ee5a525f338c06a40590712.tar
fernflower-6606a474bf8a634e6ee5a525f338c06a40590712.tar.gz
fernflower-6606a474bf8a634e6ee5a525f338c06a40590712.tar.lz
fernflower-6606a474bf8a634e6ee5a525f338c06a40590712.tar.xz
fernflower-6606a474bf8a634e6ee5a525f338c06a40590712.zip
Fixed 'IDEA-127466: dup_x1 semantics broken'
-rw-r--r--src/de/fernflower/modules/decompiler/StackVarsProcessor.java2
-rw-r--r--src/de/fernflower/modules/decompiler/sforms/SSAUConstructorSparseEx.java78
-rw-r--r--timer/com/vladium/utils/timing/HRTimer.java86
3 files changed, 127 insertions, 39 deletions
diff --git a/src/de/fernflower/modules/decompiler/StackVarsProcessor.java b/src/de/fernflower/modules/decompiler/StackVarsProcessor.java
index e1f9218..0b64a97 100644
--- a/src/de/fernflower/modules/decompiler/StackVarsProcessor.java
+++ b/src/de/fernflower/modules/decompiler/StackVarsProcessor.java
@@ -206,6 +206,8 @@ public class StackVarsProcessor {
int[] ret = iterateExprent(lst, index, next, mapVarValues, ssa);
+ //System.out.println("***************** \r\n"+root.toJava());
+
if(ret[0] >= 0) {
index = ret[0];
} else {
diff --git a/src/de/fernflower/modules/decompiler/sforms/SSAUConstructorSparseEx.java b/src/de/fernflower/modules/decompiler/sforms/SSAUConstructorSparseEx.java
index 0fdcd47..32c07a9 100644
--- a/src/de/fernflower/modules/decompiler/sforms/SSAUConstructorSparseEx.java
+++ b/src/de/fernflower/modules/decompiler/sforms/SSAUConstructorSparseEx.java
@@ -247,45 +247,45 @@ public class SSAUConstructorSparseEx {
SFormsFastMapDirect varmap = varmaparr[0];
-// // field access
-// if(expr.type == Exprent.EXPRENT_FIELD) {
-//
-// int index;
-// if(mapFieldVars.containsKey(expr.id)) {
-// index = mapFieldVars.get(expr.id);
-// } else {
-// index = fieldvarcounter--;
-// mapFieldVars.put(expr.id, index);
-//
-// // ssu graph
-// ssuversions.createNode(new VarVersionPaar(index, 1));
-// }
-//
-// setCurrentVar(varmap, index, 1);
-//
-// } else if(expr.type == Exprent.EXPRENT_INVOCATION ||
-// (expr.type == Exprent.EXPRENT_ASSIGNMENT && ((AssignmentExprent)expr).getLeft().type == Exprent.EXPRENT_FIELD) ||
-// (expr.type == Exprent.EXPRENT_NEW && ((NewExprent)expr).getNewtype().type == CodeConstants.TYPE_OBJECT) ||
-// expr.type == Exprent.EXPRENT_FUNCTION) {
-//
-// boolean ismmpp = true;
-//
-// if(expr.type == Exprent.EXPRENT_FUNCTION) {
-//
-// ismmpp = false;
-//
-// FunctionExprent fexpr = (FunctionExprent)expr;
-// if(fexpr.getFunctype() >= FunctionExprent.FUNCTION_IMM && fexpr.getFunctype() <= FunctionExprent.FUNCTION_PPI) {
-// if(fexpr.getLstOperands().get(0).type == Exprent.EXPRENT_FIELD) {
-// ismmpp = true;
-// }
-// }
-// }
-//
-// if(ismmpp) {
-// varmap.removeAllFields();
-// }
-// }
+ // field access
+ if(expr.type == Exprent.EXPRENT_FIELD) {
+
+ int index;
+ if(mapFieldVars.containsKey(expr.id)) {
+ index = mapFieldVars.get(expr.id);
+ } else {
+ index = fieldvarcounter--;
+ mapFieldVars.put(expr.id, index);
+
+ // ssu graph
+ ssuversions.createNode(new VarVersionPaar(index, 1));
+ }
+
+ setCurrentVar(varmap, index, 1);
+
+ } else if(expr.type == Exprent.EXPRENT_INVOCATION ||
+ (expr.type == Exprent.EXPRENT_ASSIGNMENT && ((AssignmentExprent)expr).getLeft().type == Exprent.EXPRENT_FIELD) ||
+ (expr.type == Exprent.EXPRENT_NEW && ((NewExprent)expr).getNewtype().type == CodeConstants.TYPE_OBJECT) ||
+ expr.type == Exprent.EXPRENT_FUNCTION) {
+
+ boolean ismmpp = true;
+
+ if(expr.type == Exprent.EXPRENT_FUNCTION) {
+
+ ismmpp = false;
+
+ FunctionExprent fexpr = (FunctionExprent)expr;
+ if(fexpr.getFunctype() >= FunctionExprent.FUNCTION_IMM && fexpr.getFunctype() <= FunctionExprent.FUNCTION_PPI) {
+ if(fexpr.getLstOperands().get(0).type == Exprent.EXPRENT_FIELD) {
+ ismmpp = true;
+ }
+ }
+ }
+
+ if(ismmpp) {
+ varmap.removeAllFields();
+ }
+ }
if(varassign != null) {
diff --git a/timer/com/vladium/utils/timing/HRTimer.java b/timer/com/vladium/utils/timing/HRTimer.java
new file mode 100644
index 0000000..a3673a1
--- /dev/null
+++ b/timer/com/vladium/utils/timing/HRTimer.java
@@ -0,0 +1,86 @@
+
+package com.vladium.utils.timing;
+
+// ----------------------------------------------------------------------------
+/**
+ * A package-private implementation of {@link ITimer} based around native
+ * <code>getTime</code> method. It will work on any platform for which a JNI
+ * implementation of "hrtlib" library is available.<P>
+ *
+ * {@link TimerFactory} acts as the Factory for this class.<P>
+ *
+ * MT-safety: an instance of this class is safe to be used within the same
+ * thread only.
+ *
+ * @author (C) <a href="mailto:vroubtsov@illinoisalumni.org">Vlad Roubtsov</a>, 2002
+ */
+final class HRTimer implements ITimer, ITimerConstants
+{
+ // public: ................................................................
+
+ public void start ()
+ {
+ if (DO_STATE_CHECKS)
+ {
+ if (m_state != STATE_READY)
+ throw new IllegalStateException (this + ": start() must be called from READY state, current state is " + STATE_NAMES [m_state]);
+ }
+
+ if (DO_STATE_CHECKS) m_state = STATE_STARTED;
+ m_data = getTime ();
+ }
+
+ public void stop ()
+ {
+ // latch stop time in a local var before doing anything else:
+ final double data = getTime ();
+
+ if (DO_STATE_CHECKS)
+ {
+ if (m_state != STATE_STARTED)
+ throw new IllegalStateException (this + ": stop() must be called from STARTED state, current state is " + STATE_NAMES [m_state]);
+ }
+
+ m_data = data - m_data;
+ if (DO_STATE_CHECKS) m_state = STATE_STOPPED;
+ }
+
+ public double getDuration ()
+ {
+ if (DO_STATE_CHECKS)
+ {
+ if (m_state != STATE_STOPPED)
+ throw new IllegalStateException (this + ": getDuration() must be called from STOPPED state, current state is " + STATE_NAMES [m_state]);
+ }
+
+ return m_data;
+ }
+
+ public void reset ()
+ {
+ if (DO_STATE_CHECKS) m_state = STATE_READY;
+ }
+
+ // protected: .............................................................
+
+ // package: ...............................................................
+
+ // private: ...............................................................
+
+ /*
+ * This is supposed to return a fractional count of milliseconds elapsed
+ * since some indeterminate moment in the past. The exact starting point
+ * is not relevant because this timer class reports time differences only.
+ *
+ * JNI code in HRTIMER_LIB library is supposed to implement this. */
+ private static native double getTime ();
+
+
+ private int m_state; // used to keep track of timer state
+ private double m_data; // timing data
+
+ private static final String HRTIMER_LIB = "hrtlib";
+
+
+} // end of class
+// ----------------------------------------------------------------------------