Skip to content

Commit

Permalink
Emit expressions tracing for most C.STATEMENTs
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmonettas committed Nov 27, 2024
1 parent b00a0bf commit 575b464
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@

### Changes
### Bugs fixed

- Trace most statements also

## 1.12.0-1 (06-09-2024)

### New Features

### Changes
### Bugs fixed

- Fix blank prefixes properties case
Expand Down
21 changes: 15 additions & 6 deletions src/jvm/clojure/lang/Compiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -2097,10 +2097,14 @@ public void emit(C context, ObjExpr objx, GeneratorAdapter gen){

if(context == C.STATEMENT)
{
if(retClass == long.class || retClass == double.class)
if(retClass == long.class || retClass == double.class) {
Emitter.emitExprTrace(gen, objx, coord, Type.getType(retClass));
gen.pop2();
else if(retClass != void.class)
}
else if(retClass != void.class) {
Emitter.emitExprTrace(gen, objx, coord, Type.getType(retClass));
gen.pop();
}
}
else
{
Expand Down Expand Up @@ -2351,9 +2355,15 @@ public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
if(context == C.STATEMENT)
{
if(retClass == long.class || retClass == double.class)
{
Emitter.emitExprTrace(gen, objx, coord, Type.getType(retClass));
gen.pop2();
}
else if(retClass != void.class)
{
Emitter.emitExprTrace(gen, objx, coord, Type.getType(retClass));
gen.pop();
}
}
else
{
Expand Down Expand Up @@ -4058,10 +4068,9 @@ public Object eval() {
public void emit(C context, ObjExpr objx, GeneratorAdapter gen){
emitUnboxed(context, objx, gen);
if(context != C.STATEMENT)
{
HostExpr.emitBoxReturn(objx,gen,retClass);
Emitter.emitExprTrace(gen, objx, coord, OBJECT_TYPE);
}
HostExpr.emitBoxReturn(objx,gen,retClass);

Emitter.emitExprTrace(gen, objx, coord, OBJECT_TYPE);

if(context == C.STATEMENT)
{
Expand Down
4 changes: 4 additions & 0 deletions test/clojure/test_clojure/storm_bodies.clj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
(let [r (b/tried)]
(is (= 4 r) "function return should be right.")
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.bodies" "tried" [] 524795972]
[:expr-exec 2 "3,1"]
[:expr-exec "#error[Dummy]" "3,2,1"]
[:expr-exec 4 "3,3,3"]
[:fn-return 4 ""]]
Expand Down Expand Up @@ -120,6 +121,9 @@
(let [r (b/doer)]
(is (= 8 r) "function return should be right.")
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.bodies" "doer" [] -378760067]
[:expr-exec 2 "3,1"]
[:expr-exec 4 "3,2"]
[:expr-exec 6 "3,3,1"]
[:expr-exec 8 "3,3,2"]
[:fn-return 8 ""]]
(u/capture)) "captured traces should match.")))
Expand Down

0 comments on commit 575b464

Please sign in to comment.