Commit 6422e913 authored by Lukáš Marek's avatar Lukáš Marek

Thread local annotation cannot change retention policy withouth parser changes

Fixed float and double sending in ShadowVM
Fixed after, loop and cflow tests
parent 5ad440fb
......@@ -1256,16 +1256,17 @@ JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendLong
pack_long(tld_get()->analysis_buff, to_send);
}
JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendFloatAsInt
(JNIEnv * jni_env, jclass this_class, jint to_send) {
pack_int(tld_get()->analysis_buff, to_send);
JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendFloat
(JNIEnv * jni_env, jclass this_class, jfloat to_send) {
pack_float(tld_get()->analysis_buff, to_send);
}
JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendDoubleAsLong
(JNIEnv * jni_env, jclass this_class, jlong to_send) {
JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendDouble
(JNIEnv * jni_env, jclass this_class, jdouble to_send) {
pack_long(tld_get()->analysis_buff, to_send);
pack_double(tld_get()->analysis_buff, to_send);
}
JNIEXPORT void JNICALL Java_ch_usi_dag_dislre_REDispatch_sendObject
......@@ -1296,13 +1297,12 @@ static JNINativeMethod redispatchMethods[] = {
{"sendShort", "(S)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendShort},
{"sendInt", "(I)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendInt},
{"sendLong", "(J)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendLong},
{"sendFloat", "(F)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendFloat},
{"sendDouble", "(D)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendDouble},
{"sendObject", "(Ljava/lang/Object;)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendObject},
{"sendObjectPlusData", "(Ljava/lang/Object;)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendObjectPlusData},
};
//{"sendFloatAsInt", "(I)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendFloatAsInt},
//{"sendDoubleAsLong", "(J)V", (void *)&Java_ch_usi_dag_dislre_REDispatch_sendDoubleAsLong},
// ******************* CLASS LOAD callback *******************
void JNICALL jvmti_callback_class_file_load_hook(
......
......@@ -2,13 +2,13 @@ package ch.usi.dag.disl.test.suite.after.app;
public class TargetClass {
public void print(boolean flag) {
public void print(final boolean flag) {
try {
System.out.println("app: TargetClass.print(..) - try:begin");
if (flag) {
String float_one = "1.0";
Integer int_one = Integer.valueOf(float_one);
final String float_one = "1.0";
final Integer int_one = Integer.valueOf(float_one);
System.out.println("app: UNREACHABLE " + int_one);
}
......@@ -18,23 +18,15 @@ public class TargetClass {
}
}
// FIXME
// this main breaks the test on class not found exception of this class
/*
* public static void main(String[] args) { try { TargetClass t = new
* TargetClass();
* System.out.println("app: TargetClass.main(..) - .print(false)");
* t.print(false);
* System.out.println("app: TargetClass.main(..) - .print(true)");
* t.print(true); } catch (Throwable e) {
* System.out.println("app: TargetClass.main(..) - catch"); } }
*/
public static void main(String[] args) {
TargetClass t = new TargetClass();
System.out.println("app: TargetClass.main(..) - .print(false)");
t.print(false);
System.out.println("app: TargetClass.main(..) - .print(true)");
t.print(true);
public static void main (final String [] args) {
try {
final TargetClass t = new TargetClass ();
System.out.println ("app: TargetClass.main(..) - .print(false)");
t.print (false);
System.out.println ("app: TargetClass.main(..) - .print(true)");
t.print (true);
} catch (final Throwable e) {
System.out.println ("app: TargetClass.main(..) - catch");
}
}
}
package ch.usi.dag.disl.test.suite.after.junit;
import static org.junit.Assert.fail;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -17,9 +15,6 @@ public class AfterTest {
@Test
public void test()
throws Exception {
// FIXME
fail("FIXME");
// see app TargetClass
r.start();
r.waitFor();
......
......@@ -8,3 +8,4 @@ app: TargetClass.print(..) - try:begin
app: TargetClass.print(..) - finally
disl: after
disl: afterThrowning
app: TargetClass.main(..) - catch
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test2/suite/cflow/app/TargetClass.main
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test2/suite/cflow/app/TargetClass.<init>
disl: IN CFLOW OF foo() ch/usi/dag/disl/test2/suite/cflow/app/TargetClass.foo
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test/suite/cflow/app/TargetClass.main
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test/suite/cflow/app/TargetClass.<init>
disl: IN CFLOW OF foo() ch/usi/dag/disl/test/suite/cflow/app/TargetClass.foo
app: TargetClass.foo() - begin
disl: IN CFLOW OF foo() ch/usi/dag/disl/test2/suite/cflow/app/TargetClass.goo
disl: IN CFLOW OF foo() ch/usi/dag/disl/test/suite/cflow/app/TargetClass.goo
app: TargetClass.goo()
app: TargetClass.foo() - end
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test2/suite/cflow/app/TargetClass.hoo
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test/suite/cflow/app/TargetClass.hoo
app: TargetClass.hoo() - begin
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test2/suite/cflow/app/TargetClass.goo
disl: NOT IN CFLOW OF foo() ch/usi/dag/disl/test/suite/cflow/app/TargetClass.goo
app: TargetClass.goo()
app: TargetClass.hoo() - end
......@@ -15,10 +15,8 @@ public class CodeExecuted extends RemoteAnalysis {
totalExecutedBytecodes += count;
}
// FIXME
//public void testingBasic(final boolean b, final byte by, final char c, final short s, final int i, final long l,
// final float f, final double d) {
public void testingBasic(final boolean b, final byte by, final char c, final short s, final int i, final long l) {
public void testingBasic(final boolean b, final byte by, final char c, final short s, final int i, final long l,
final float f, final double d) {
if(b != true) {
throw new RuntimeException("Incorect transfer of boolean");
}
......@@ -43,15 +41,13 @@ public class CodeExecuted extends RemoteAnalysis {
throw new RuntimeException("Incorect transfer of long");
}
// FIXME
//if(f != 1.5F) {
// throw new RuntimeException("Incorect transfer of float");
//}
if(f != 1.5F) {
throw new RuntimeException("Incorect transfer of float");
}
// FIXME
//if(d != 2.5) {
// throw new RuntimeException("Incorect transfer of double");
//}
if(d != 2.5) {
throw new RuntimeException("Incorect transfer of double");
}
}
public static void testingAdvanced(final ShadowObject s, final ShadowObject o, final ShadowObject c, final ShadowObject t) {
......
......@@ -34,11 +34,8 @@ public class CodeExecutedRE {
REDispatch.analysisEnd();
}
// FIXME
//public static void testingBasic(final boolean b, final byte by, final char c, final short s, final int i,
// final long l, final float f, final double d) {
public static void testingBasic(final boolean b, final byte by, final char c, final short s, final int i,
final long l) {
final long l, final float f, final double d) {
REDispatch.analysisStart(tbId);
REDispatch.sendBoolean(b);
......@@ -47,10 +44,8 @@ public class CodeExecutedRE {
REDispatch.sendShort(s);
REDispatch.sendInt(i);
REDispatch.sendLong(l);
// FIXME
//REDispatch.sendFloat(f);
// FIXME
//REDispatch.sendDouble(d);
REDispatch.sendFloat(f);
REDispatch.sendDouble(d);
REDispatch.analysisEnd();
}
......
......@@ -17,11 +17,8 @@ public class DiSLClass {
@After(marker = BodyMarker.class, scope = "TargetClass.main")
public static void testing() {
CodeExecutedRE.testingBasic(true, (byte) 125, 's', (short) 50000, 100000, 10000000000L);
// FIXME
//CodeExecutedRE.testingBasic(true, (byte) 125, 's', (short) 50000,
// 100000, 10000000000L, 1.5F, 2.5);
CodeExecutedRE.testingBasic(true, (byte) 125, 's', (short) 50000,
100000, 10000000000L, 1.5F, 2.5);
CodeExecutedRE.testingAdvanced("Corect transfer of String", "test", Object.class, Thread.currentThread());
......
package ch.usi.dag.disl.test.suite.dispatch.junit;
import static org.junit.Assert.fail;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -29,9 +27,6 @@ public class DispatchTest {
r.assertIsSuccessfull ();
r.assertEvaluationOut ("evaluation.out.resource");
r.assertRestOutErrNull ();
// FIXME
fail("FIXME - sendFloat is broken");
}
......
......@@ -7,8 +7,8 @@ import ch.usi.dag.disl.staticcontext.LoopStaticContext;
public class DiSLClass {
@Before(marker = BasicBlockMarker.class, scope = "TargetClass.print()", order = 0)
public static void precondition(LoopStaticContext lsc) {
System.out.println("disl: enter basic block ! index: " + lsc.getBBindex()
+ " loopstart? " + (lsc.isFirstOfLoop() ? "true" : "false"));
public static void precondition(final LoopStaticContext lsc) {
System.out.println("disl: Entering basic block."
+ " Is this a loopstart? " + (lsc.isFirstOfLoop() ? "true" : "false"));
}
}
package ch.usi.dag.disl.test.suite.loop.junit;
import static org.junit.Assert.fail;
import org.junit.After;
import org.junit.Test;
import org.junit.runner.RunWith;
......@@ -17,11 +15,6 @@ public class LoopTest {
@Test
public void test()
throws Exception {
fail("FIXME - nondeterministic");
// FIXME
// see client.out.1.resource and client.out.2.resource
// test might nondeterministically result in both of them
r.start();
r.waitFor();
r.assertIsFinished();
......
disl: enter basic block ! index: 0 loopstart? false
disl: enter basic block ! index: 1 loopstart? true
disl: enter basic block ! index: 2 loopstart? false
app: 0
disl: enter basic block ! index: 1 loopstart? true
disl: enter basic block ! index: 2 loopstart? false
app: 1
disl: enter basic block ! index: 1 loopstart? true
disl: enter basic block ! index: 2 loopstart? false
app: 2
disl: enter basic block ! index: 1 loopstart? true
disl: enter basic block ! index: 2 loopstart? false
app: 3
disl: enter basic block ! index: 1 loopstart? true
disl: enter basic block ! index: 3 loopstart? false
disl: enter basic block ! index: 0 loopstart? false
disl: enter basic block ! index: 2 loopstart? true
disl: enter basic block ! index: 1 loopstart? false
app: 0
disl: enter basic block ! index: 2 loopstart? true
disl: enter basic block ! index: 1 loopstart? false
app: 1
disl: enter basic block ! index: 2 loopstart? true
disl: enter basic block ! index: 1 loopstart? false
app: 2
disl: enter basic block ! index: 2 loopstart? true
disl: enter basic block ! index: 1 loopstart? false
app: 3
disl: enter basic block ! index: 2 loopstart? true
disl: enter basic block ! index: 3 loopstart? false
disl: Entering basic block. Is this a loopstart? false
disl: Entering basic block. Is this a loopstart? true
disl: Entering basic block. Is this a loopstart? false
app: 0
disl: Entering basic block. Is this a loopstart? true
disl: Entering basic block. Is this a loopstart? false
app: 1
disl: Entering basic block. Is this a loopstart? true
disl: Entering basic block. Is this a loopstart? false
app: 2
disl: Entering basic block. Is this a loopstart? true
disl: Entering basic block. Is this a loopstart? false
app: 3
disl: Entering basic block. Is this a loopstart? true
disl: Entering basic block. Is this a loopstart? false
......@@ -8,17 +8,17 @@ public class Agent {
// under Eclipse create runner for desired target class
// add these jvm parameters (example)
// -javaagent:build/eclipse-agent.jar
// -Ddisl.classes=bin/ch/usi/dag/disl/test/bodymarker/DiSLClass.class
// -Ddisl.classes=bin/ch/usi/dag/disl/test/suite/bodymarker/instr/DiSLClass.class
/**
* Premain method is a method called when the agent is loaded. As the name
* says, the method is called before the application main method.
*
*
* @param agentArguments
* @param instrumentation
*/
public static void premain (String agentArguments,
Instrumentation instrumentation) {
public static void premain (final String agentArguments,
final Instrumentation instrumentation) {
instrumentation.addTransformer(new Transformer());
}
......
......@@ -2,8 +2,6 @@ package ch.usi.dag.disl.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
/**
......@@ -21,7 +19,6 @@ import java.lang.annotation.Target;
* classes, they should be kept {@code private}.
*/
@Documented
@Retention(RetentionPolicy.RUNTIME)
@Target(value = { ElementType.FIELD })
public @interface ThreadLocal {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment