Skip to content

Commit 8713519

Browse files
committed
Change enter/exit marker with arrows
1 parent 76dd5d5 commit 8713519

34 files changed

+303
-297
lines changed

plutus-core/executables/traceToStacks/Common.hs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@ parseProfileEvent valIx (LogRow str vals) =
6565
in case words str of
6666
[transition,var] ->
6767
case transition of
68-
"entering" -> MkProfileEvent val Enter (T.pack var)
69-
"exiting" -> MkProfileEvent val Exit (T.pack var)
68+
"->" -> MkProfileEvent val Enter (T.pack var)
69+
"<-" -> MkProfileEvent val Exit (T.pack var)
7070
badLog -> error $
7171
"parseProfileEvent: expecting \"entering\" or \"exiting\" but got "
7272
<> show badLog
@@ -105,4 +105,3 @@ getStacks = go []
105105
go [] [] = []
106106
go stacks [] = error $
107107
"getStacks; go: stack " <> show stacks <> " isn't empty but the log is."
108-

plutus-core/untyped-plutus-core/src/UntypedPlutusCore/Evaluation/Machine/Cek/EmitterMode.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,8 @@ logWithBudgetEmitter = EmitterMode $ \getBudget -> do
7575
7676
This requires script to be compiled with `PlutusTx.Plugin:profile-all` turned on because this relies
7777
on compiler-generated trace calls that notifies entrance and exit of a function call. These traces
78-
that mark entrance and exit are ordinary traces like "entering rob:Example.hs:3:1-3:15" and "exiting
79-
bob:Example.hs:1:1-1:13" with "entering" and "exiting" prefixies, where "bob" and "rob" is the name
78+
that mark entrance and exit are ordinary traces like "-> rob:Example.hs:3:1-3:15" and "<-
79+
bob:Example.hs:1:1-1:13" with "->" and "<-" prefixies, where "bob" and "rob" is the name
8080
of the function with source span. If regular script with no entrance/exit marker is given, this
8181
emitter will behave identically to 'logEmitter'.
8282
@@ -97,8 +97,8 @@ logWithCallTraceEmitter = EmitterMode $ \_ -> do
9797
go [] l = l
9898
go (x:xs) l =
9999
case (T.words (last l), T.words x) of
100-
("entering":enterRest, "exiting":exitRest) | enterRest == exitRest -> go xs (init l)
101-
_ -> go xs (l <> [x])
100+
("->":enterRest, "<-":exitRest) | enterRest == exitRest -> go xs (init l)
101+
_ -> go xs (l <> [x])
102102

103103
emitter logs = CekM $ modifySTRef logsRef (addTrace logs)
104104
pure $ CekEmitterInfo emitter (DList.toList <$> readSTRef logsRef)

plutus-tx-plugin/plutus-tx-plugin.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,9 +136,9 @@ test-suite plutus-tx-plugin-tests
136136
BuiltinList.Budget.Spec
137137
ByteStringLiterals.Lib
138138
ByteStringLiterals.Spec
139+
CallTrace.Lib
139140
CallTrace.OtherModule
140141
CallTrace.Spec
141-
CallTrace.Utils
142142
DataList.Budget.Spec
143143
Inline.Spec
144144
IntegerLiterals.NoStrict.NegativeLiterals.Spec

plutus-tx-plugin/src/PlutusTx/Compiler/Expr.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -791,9 +791,9 @@ entryExitTracing lamName displayName e ty =
791791
annMayInline
792792
( mkTrace
793793
(PLC.TyFun annMayInline defaultUnitTy ty) -- ()-> ty
794-
("entering " <> displayName)
794+
("-> " <> displayName)
795795
-- \() -> trace @c "exiting f" e
796-
(LamAbs annMayInline lamName defaultUnitTy (mkTrace ty ("exiting " <> displayName) e))
796+
(LamAbs annMayInline lamName defaultUnitTy (mkTrace ty ("<- " <> displayName) e))
797797
)
798798
defaultUnit
799799

plutus-tx-plugin/test/CallTrace/9.6/func01.eval.golden

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ The machine terminated because of an error, either from a built-in function or f
33
Caused by: error
44

55
Trace:
6-
entering func:test/CallTrace/Spec.hs:69:1-69:4
6+
-> func:test/CallTrace/Spec.hs:78:1-78:4
77
func 1
8-
entering nestedLinear:test/CallTrace/Spec.hs:62:1-62:12
9-
entering nestedLinear2:test/CallTrace/Spec.hs:63:1-63:13
10-
entering nestedLinear3:test/CallTrace/Spec.hs:64:1-64:13
11-
entering nestedLinear4:test/CallTrace/Spec.hs:65:1-65:13
12-
entering error
8+
-> nestedLinear:test/CallTrace/Spec.hs:71:1-71:12
9+
-> nestedLinear2:test/CallTrace/Spec.hs:72:1-72:13
10+
-> nestedLinear3:test/CallTrace/Spec.hs:73:1-73:13
11+
-> nestedLinear4:test/CallTrace/Spec.hs:74:1-74:13
12+
-> error

plutus-tx-plugin/test/CallTrace/9.6/func02.eval.golden

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ The machine terminated because of an error, either from a built-in function or f
33
Caused by: error
44

55
Trace:
6-
entering func:test/CallTrace/Spec.hs:69:1-69:4
7-
entering nestedLinear2:test/CallTrace/Spec.hs:63:1-63:13
8-
entering nestedLinear3:test/CallTrace/Spec.hs:64:1-64:13
9-
entering nestedLinear4:test/CallTrace/Spec.hs:65:1-65:13
10-
entering error
6+
-> func:test/CallTrace/Spec.hs:78:1-78:4
7+
-> nestedLinear2:test/CallTrace/Spec.hs:72:1-72:13
8+
-> nestedLinear3:test/CallTrace/Spec.hs:73:1-73:13
9+
-> nestedLinear4:test/CallTrace/Spec.hs:74:1-74:13
10+
-> error

plutus-tx-plugin/test/CallTrace/9.6/func03.eval.golden

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ The machine terminated because of an error, either from a built-in function or f
33
Caused by: error
44

55
Trace:
6-
entering func:test/CallTrace/Spec.hs:69:1-69:4
7-
entering functionFromOtherModule:test/CallTrace/Spec.hs:84:1-84:23
8-
entering errorWhenTrue:test/CallTrace/OtherModule.hs:9:1-9:13
6+
-> func:test/CallTrace/Spec.hs:78:1-78:4
7+
-> functionFromOtherModule:test/CallTrace/Spec.hs:93:1-93:23
8+
-> $
9+
-> errorWhenTrue:test/CallTrace/OtherModule.hs:9:1-9:13

plutus-tx-plugin/test/CallTrace/9.6/func04.eval.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ The machine terminated because of an error, either from a built-in function or f
33
Caused by: error
44

55
Trace:
6-
entering func:test/CallTrace/Spec.hs:69:1-69:4
7-
entering $cmyClassFunc:test/CallTrace/Spec.hs:90:3-90:13
8-
entering error
6+
-> func:test/CallTrace/Spec.hs:78:1-78:4
7+
-> $cmyClassFunc:test/CallTrace/Spec.hs:99:3-99:13
8+
-> error

plutus-tx-plugin/test/CallTrace/9.6/func05.eval.golden

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ The machine terminated because of an error, either from a built-in function or f
33
Caused by: error
44

55
Trace:
6-
entering func:test/CallTrace/Spec.hs:69:1-69:4
7-
entering $cmyClassFunc:test/CallTrace/Spec.hs:90:3-90:13
8-
entering functionFromOtherModule:test/CallTrace/Spec.hs:84:1-84:23
9-
entering errorWhenTrue:test/CallTrace/OtherModule.hs:9:1-9:13
6+
-> func:test/CallTrace/Spec.hs:78:1-78:4
7+
-> $cmyClassFunc:test/CallTrace/Spec.hs:99:3-99:13
8+
-> functionFromOtherModule:test/CallTrace/Spec.hs:93:1-93:23
9+
-> $
10+
-> errorWhenTrue:test/CallTrace/OtherModule.hs:9:1-9:13

plutus-tx-plugin/test/CallTrace/9.6/func06.eval.golden

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ The machine terminated because of an error, either from a built-in function or f
33
Caused by: error
44

55
Trace:
6-
entering func:test/CallTrace/Spec.hs:69:1-69:4
7-
entering $cmyClassFunc:test/CallTrace/Spec.hs:94:3-94:13
8-
entering error
6+
-> func:test/CallTrace/Spec.hs:78:1-78:4
7+
-> $cmyClassFunc:test/CallTrace/Spec.hs:103:3-103:13
8+
-> error

0 commit comments

Comments
 (0)