Skip to content

Commit 77e4f4d

Browse files
committed
Trace objects methods calls as ClassName.method-name, instead of just method-name
1 parent 0a24b15 commit 77e4f4d

File tree

6 files changed

+61
-25
lines changed

6 files changed

+61
-25
lines changed

CHANGELOG.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,18 @@
55
### New Features
66

77
### Changes
8+
9+
- Trace objects methods calls as ClassName.method-name, instead of just method-name
10+
11+
### Bugs fixed
12+
13+
## 1.12.2 (26-08-2025)
14+
15+
### New Features
16+
17+
### Changes
18+
19+
- Just rebasing on top of official 1.12.2
820
921
### Bugs fixed
1022

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<artifactId>clojure</artifactId>
66
<name>clojure</name>
77
<packaging>jar</packaging>
8-
<version>1.12.0-10</version>
8+
<version>1.12.2-1</version>
99
<url>http://clojure.org/</url>
1010
<description>Clojure core environment and runtime library.</description>
1111

src/clj/clojure/core_deftype.clj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -836,7 +836,7 @@
836836
specs)]
837837
(map (fn [[[target & args] & body]]
838838
(cons (with-meta (apply vector (vary-meta target assoc :tag c) args)
839-
{:clojure.storm/fn-trace-sym mname})
839+
{:clojure.storm/fn-trace-sym (symbol (str c "." mname))})
840840
body))
841841
specs)))]
842842
[p (zipmap (map #(-> % first name keyword) fs)

src/jvm/clojure/lang/Compiler.java

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8751,7 +8751,7 @@ CONSTANT_IDS, new IdentityHashMap(),
87518751
{
87528752

87538753
// [STORM] For each evaluation, before macroexpanding :
8754-
// We add this same code on the compile path
8754+
// This is the same code added in the load path
87558755
// Supporting the compile path is useful only for debugging, like using
87568756
// clj-java-decompiler
87578757
// ------------------------------------------------------------------------
@@ -9584,6 +9584,19 @@ private static Map findMethodsWithName(String name, Map mm){
95849584
return ret;
95859585
}
95869586

9587+
private String objectClassName(String objExprName) {
9588+
String objClassName = "";
9589+
int dotIdx=objExprName.lastIndexOf(".");
9590+
if (objExprName.indexOf("reify__") != -1) {
9591+
objClassName = objExprName.substring(objExprName.indexOf("reify__"));
9592+
} else if (dotIdx != -1) {
9593+
objClassName = objExprName.substring(dotIdx + 1);
9594+
}
9595+
else {
9596+
objClassName = objExprName;
9597+
}
9598+
return objClassName;
9599+
}
95879600
public void emit(ObjExpr obj, ClassVisitor cv){
95889601
Method m = new Method(getMethodName(), getReturnType(), getArgTypes());
95899602

@@ -9607,12 +9620,15 @@ public void emit(ObjExpr obj, ClassVisitor cv){
96079620
}
96089621
gen.visitCode();
96099622

9610-
9611-
String fqMethodName = Compiler.munge(Compiler.currentNS().name.name) + "$" + getMethodName();
9623+
9624+
String fqMethodName = "";
96129625

96139626
Label prologueTryStartLabel = null;
9614-
if(!skipFnCallTrace)
9627+
9628+
if(!skipFnCallTrace) {
9629+
fqMethodName = Compiler.munge(Compiler.currentNS().name.name) + "$" + objectClassName(obj.name()) + "." + getMethodName();
96159630
prologueTryStartLabel = Emitter.emitFnPrologue(gen, obj, fqMethodName, extypes, argLocals);
9631+
}
96169632

96179633
Label loopLabel = gen.mark();
96189634

test/clojure/test_clojure/storm_bodies.clj

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -107,20 +107,28 @@
107107
(u/capture)) "captured traces should match.")))
108108

109109
(deftest reified-let-test
110-
(let [r (b/reified-let)]
110+
(let [r (b/reified-let)
111+
[a [b1 b2 b3 b4 b5] & rs] (u/capture)]
111112
(is (= 30 r) "function return should be right.")
112-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.bodies" "reified-let" [] 1131527981]
113-
[:fn-call "clojure.test-clojure.storm-test-code.bodies" "doit" [] 1131527981]
114-
[:bind "a" 10 "3,1,2,2"]
115-
[:bind "b" 20 "3,1,2,2"]
116-
[:expr-exec 10 "3,1,2,2,2,1"]
117-
[:expr-exec 20 "3,1,2,2,2,2"]
118-
[:expr-exec 30 "3,1,2,2,2"]
119-
[:expr-exec 30 "3,1,2,2"]
120-
[:fn-return 30 "3,1,2,0"]
121-
[:expr-exec 30 "3"]
122-
[:fn-return 30 ""]]
123-
(u/capture)) "captured traces should match.")))
113+
114+
(is (= a [:fn-call "clojure.test-clojure.storm-test-code.bodies" "reified-let" [] 1131527981]))
115+
116+
(is (= b1 :fn-call))
117+
(is (= b2 "clojure.test-clojure.storm-test-code.bodies"))
118+
(is (re-find #"reify--[0-9]+\.doit" b3))
119+
(is (= b4 []))
120+
(is (= b5 1131527981))
121+
122+
(is (= (into [] rs)
123+
[[:bind "a" 10 "3,1,2,2"]
124+
[:bind "b" 20 "3,1,2,2"]
125+
[:expr-exec 10 "3,1,2,2,2,1"]
126+
[:expr-exec 20 "3,1,2,2,2,2"]
127+
[:expr-exec 30 "3,1,2,2,2"]
128+
[:expr-exec 30 "3,1,2,2"]
129+
[:fn-return 30 "3,1,2,0"]
130+
[:expr-exec 30 "3"]
131+
[:fn-return 30 ""]]) "captured traces should match.")))
124132

125133
(deftest case-test
126134
(let [r (b/casey :first)]

test/clojure/test_clojure/storm_types.clj

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
(let [s (ts/->Square 5)
1010
r (ts/area s)]
1111
(is (= 25 r) "function return should be right.")
12-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "area" [] 1908634760]
12+
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "Square.area" [] 1908634760]
1313
[:expr-exec 5 "4,2,1"]
1414
[:expr-exec 5 "4,2,2"]
1515
[:expr-exec 25 "4,2"]
@@ -19,7 +19,7 @@
1919
(deftest deftype-test
2020
(let [r (ts/area (ts/->Circle 2))]
2121
(is (= 12.56 r) "function return should be right.")
22-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "area" [] 441667179]
22+
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "Circle.area" [] 441667179]
2323
[:expr-exec 2 "4,2,2"]
2424
[:expr-exec 2 "4,2,3"]
2525
[:expr-exec 12.56 "4,2"]
@@ -29,7 +29,7 @@
2929
(deftest extend-type-basic-test
3030
(let [r (ts/area "tha-shape")]
3131
(is (= 9 r) "function return should be right.")
32-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "area" ["tha-shape"] 1050802064]
32+
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "String.area" ["tha-shape"] 1050802064]
3333
[:bind "s" "tha-shape" ""]
3434
[:expr-exec "tha-shape" "3,2,1"]
3535
[:expr-exec 9 "3,2"]
@@ -40,7 +40,7 @@
4040
(let [tr (ts/->Triangle 2 5)
4141
r (ts/sides-count tr)]
4242
(is (= 3 r) "function return should be right.")
43-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "sides-count" [tr] -335308803]
43+
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "Triangle.sides-count" [tr] -335308803]
4444
[:expr-exec 2 "3,2,2"]
4545
[:expr-exec 3 "3,2"]
4646
[:fn-return 3 ""]]
@@ -49,7 +49,7 @@
4949
(deftest extend-proto-basic-test
5050
(let [r (ts/area 10)]
5151
(is (= 100 r) "function return should be right.")
52-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "area" [10] -1332394678]
52+
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "Long.area" [10] -1332394678]
5353
[:bind "n" 10 ""]
5454
[:expr-exec 10 "3,2,1"]
5555
[:expr-exec 10 "3,2,2"]
@@ -61,7 +61,7 @@
6161
(let [rect (ts/->Rectangle 2 4)
6262
r (ts/area rect)]
6363
(is (= 8 r) "function return should be right.")
64-
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "area" [rect] 50784036]
64+
(is (= [[:fn-call "clojure.test-clojure.storm-test-code.types" "Rectangle.area" [rect] 50784036]
6565
[:bind "r" rect ""]
6666
[:expr-exec rect "3,2,1,1"]
6767
[:bind "gclass" "clojure.test_clojure.storm_test_code.types.Rectangle" ""]

0 commit comments

Comments
 (0)