@eagleoutice/flowr 1.3.14 → 1.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (309) hide show
  1. package/README.md +3 -3
  2. package/abstract-interpretation/domain.d.ts +27 -0
  3. package/abstract-interpretation/domain.js +146 -0
  4. package/abstract-interpretation/handler/binop/binop.d.ts +16 -0
  5. package/abstract-interpretation/handler/binop/binop.js +40 -0
  6. package/abstract-interpretation/handler/binop/operators.d.ts +2 -0
  7. package/abstract-interpretation/handler/binop/operators.js +42 -0
  8. package/abstract-interpretation/handler/handler.d.ts +6 -0
  9. package/abstract-interpretation/handler/handler.js +3 -0
  10. package/abstract-interpretation/processor.d.ts +10 -0
  11. package/abstract-interpretation/processor.js +84 -0
  12. package/benchmark/slicer.d.ts +6 -8
  13. package/benchmark/slicer.js +5 -15
  14. package/benchmark/stats/print.d.ts +1 -1
  15. package/benchmark/stats/print.js +0 -2
  16. package/benchmark/stats/stats.d.ts +3 -4
  17. package/benchmark/stats/stats.js +1 -1
  18. package/cli/benchmark-app.d.ts +1 -0
  19. package/cli/benchmark-app.js +21 -6
  20. package/cli/benchmark-helper-app.d.ts +2 -0
  21. package/cli/benchmark-helper-app.js +15 -6
  22. package/cli/common/features.d.ts +1 -1
  23. package/cli/common/options.d.ts +1 -1
  24. package/cli/common/options.js +4 -1
  25. package/cli/common/script.d.ts +1 -1
  26. package/cli/common/scripts-info.d.ts +3 -2
  27. package/cli/common/scripts-info.js +15 -1
  28. package/cli/export-quads-app.js +1 -5
  29. package/cli/repl/commands/cfg.d.ts +1 -1
  30. package/cli/repl/commands/cfg.js +3 -3
  31. package/cli/repl/commands/commands.d.ts +4 -2
  32. package/cli/repl/commands/commands.js +67 -28
  33. package/cli/repl/commands/dataflow.d.ts +1 -1
  34. package/cli/repl/commands/dataflow.js +2 -2
  35. package/cli/repl/commands/execute.d.ts +2 -2
  36. package/cli/repl/commands/main.d.ts +2 -2
  37. package/cli/repl/commands/normalize.d.ts +1 -1
  38. package/cli/repl/commands/normalize.js +2 -2
  39. package/cli/repl/commands/parse.d.ts +1 -1
  40. package/cli/repl/commands/parse.js +12 -12
  41. package/cli/repl/commands/quit.d.ts +1 -1
  42. package/cli/repl/commands/quit.js +4 -1
  43. package/cli/repl/commands/version.d.ts +1 -1
  44. package/cli/repl/core.d.ts +5 -3
  45. package/cli/repl/core.js +63 -7
  46. package/cli/repl/execute.d.ts +1 -1
  47. package/cli/repl/execute.js +3 -3
  48. package/cli/repl/server/connection.d.ts +2 -2
  49. package/cli/repl/server/connection.js +4 -8
  50. package/cli/repl/server/messages/analysis.d.ts +3 -3
  51. package/cli/repl/server/messages/analysis.js +12 -32
  52. package/cli/repl/server/messages/error.d.ts +1 -1
  53. package/cli/repl/server/messages/hello.d.ts +2 -2
  54. package/cli/repl/server/messages/messages.d.ts +5 -5
  55. package/cli/repl/server/messages/repl.d.ts +1 -1
  56. package/cli/repl/server/messages/slice.d.ts +3 -3
  57. package/cli/repl/server/net.d.ts +16 -0
  58. package/cli/repl/server/net.js +42 -3
  59. package/cli/repl/server/send.d.ts +2 -2
  60. package/cli/repl/server/server.d.ts +2 -2
  61. package/cli/repl/server/validate.d.ts +3 -3
  62. package/cli/statistics-helper-app.js +2 -3
  63. package/cli/summarizer-app.js +1 -2
  64. package/config.d.ts +16 -0
  65. package/config.js +75 -0
  66. package/core/input.d.ts +5 -5
  67. package/core/output.d.ts +1 -1
  68. package/core/print/dataflow-printer.d.ts +3 -3
  69. package/core/print/normalize-printer.d.ts +2 -2
  70. package/core/print/parse-printer.d.ts +2 -3
  71. package/core/print/parse-printer.js +6 -4
  72. package/core/print/print.d.ts +1 -1
  73. package/core/print/slice-diff-ansi.d.ts +1 -1
  74. package/core/slicer.d.ts +5 -4
  75. package/core/slicer.js +2 -2
  76. package/core/steps.d.ts +10 -9
  77. package/core/steps.js +5 -4
  78. package/dataflow/environments/append.d.ts +1 -1
  79. package/dataflow/environments/environment.d.ts +4 -4
  80. package/dataflow/environments/environment.js +8 -0
  81. package/dataflow/environments/overwrite.d.ts +1 -1
  82. package/dataflow/environments/register.d.ts +2 -2
  83. package/dataflow/environments/register.js +1 -0
  84. package/dataflow/environments/resolve-by-name.d.ts +2 -2
  85. package/dataflow/environments/scoping.d.ts +1 -1
  86. package/dataflow/extractor.d.ts +5 -5
  87. package/dataflow/extractor.js +10 -2
  88. package/dataflow/graph/diff.d.ts +3 -3
  89. package/dataflow/graph/graph.d.ts +8 -7
  90. package/dataflow/graph/quads.d.ts +2 -2
  91. package/dataflow/graph/vertex.d.ts +5 -5
  92. package/dataflow/internal/info.d.ts +2 -2
  93. package/dataflow/internal/linker.d.ts +3 -3
  94. package/dataflow/internal/process/access.d.ts +3 -3
  95. package/dataflow/internal/process/expression-list.d.ts +3 -3
  96. package/dataflow/internal/process/expression-list.js +0 -4
  97. package/dataflow/internal/process/functions/argument.d.ts +4 -4
  98. package/dataflow/internal/process/functions/exit-points.d.ts +1 -1
  99. package/dataflow/internal/process/functions/function-call.d.ts +3 -3
  100. package/dataflow/internal/process/functions/function-call.js +7 -1
  101. package/dataflow/internal/process/functions/function-definition.d.ts +3 -3
  102. package/dataflow/internal/process/functions/parameter.d.ts +3 -3
  103. package/dataflow/internal/process/functions/source.d.ts +8 -0
  104. package/dataflow/internal/process/functions/source.js +81 -0
  105. package/dataflow/internal/process/if-then-else.d.ts +3 -3
  106. package/dataflow/internal/process/loops/for-loop.d.ts +3 -3
  107. package/dataflow/internal/process/loops/repeat-loop.d.ts +3 -3
  108. package/dataflow/internal/process/loops/while-loop.d.ts +3 -3
  109. package/dataflow/internal/process/operators/assignment.d.ts +3 -3
  110. package/dataflow/internal/process/operators/non-assignment-binary-op.d.ts +3 -3
  111. package/dataflow/internal/process/operators/pipe.d.ts +3 -3
  112. package/dataflow/internal/process/operators/unary-op.d.ts +3 -3
  113. package/dataflow/internal/process/symbol.d.ts +3 -3
  114. package/dataflow/internal/process/uninteresting-leaf.d.ts +2 -2
  115. package/dataflow/processor.d.ts +12 -3
  116. package/flowr.d.ts +5 -2
  117. package/flowr.js +19 -12
  118. package/package.json +50 -18
  119. package/r-bridge/lang-4.x/ast/index.d.ts +1 -0
  120. package/r-bridge/lang-4.x/ast/index.js +3 -0
  121. package/r-bridge/lang-4.x/ast/model/collect.d.ts +2 -2
  122. package/r-bridge/lang-4.x/ast/model/model.d.ts +6 -6
  123. package/r-bridge/lang-4.x/ast/model/nodes/info/index.d.ts +2 -2
  124. package/r-bridge/lang-4.x/ast/model/nodes/info/r-delimiter.d.ts +3 -3
  125. package/r-bridge/lang-4.x/ast/model/nodes/r-access.d.ts +3 -3
  126. package/r-bridge/lang-4.x/ast/model/nodes/r-argument.d.ts +3 -3
  127. package/r-bridge/lang-4.x/ast/model/nodes/r-binary-op.d.ts +3 -3
  128. package/r-bridge/lang-4.x/ast/model/nodes/r-break.d.ts +2 -2
  129. package/r-bridge/lang-4.x/ast/model/nodes/r-comment.d.ts +2 -2
  130. package/r-bridge/lang-4.x/ast/model/nodes/r-expression-list.d.ts +2 -2
  131. package/r-bridge/lang-4.x/ast/model/nodes/r-for-loop.d.ts +4 -4
  132. package/r-bridge/lang-4.x/ast/model/nodes/r-function-call.d.ts +4 -4
  133. package/r-bridge/lang-4.x/ast/model/nodes/r-function-definition.d.ts +4 -4
  134. package/r-bridge/lang-4.x/ast/model/nodes/r-if-then-else.d.ts +3 -3
  135. package/r-bridge/lang-4.x/ast/model/nodes/r-line-directive.d.ts +2 -2
  136. package/r-bridge/lang-4.x/ast/model/nodes/r-logical.d.ts +2 -2
  137. package/r-bridge/lang-4.x/ast/model/nodes/r-next.d.ts +2 -2
  138. package/r-bridge/lang-4.x/ast/model/nodes/r-number.d.ts +3 -3
  139. package/r-bridge/lang-4.x/ast/model/nodes/r-parameter.d.ts +3 -3
  140. package/r-bridge/lang-4.x/ast/model/nodes/r-pipe.d.ts +2 -2
  141. package/r-bridge/lang-4.x/ast/model/nodes/r-repeat-loop.d.ts +3 -3
  142. package/r-bridge/lang-4.x/ast/model/nodes/r-string.d.ts +3 -3
  143. package/r-bridge/lang-4.x/ast/model/nodes/r-symbol.d.ts +2 -2
  144. package/r-bridge/lang-4.x/ast/model/nodes/r-unary-op.d.ts +3 -3
  145. package/r-bridge/lang-4.x/ast/model/nodes/r-while-loop.d.ts +3 -3
  146. package/r-bridge/lang-4.x/ast/model/operators.d.ts +1 -1
  147. package/r-bridge/lang-4.x/ast/model/processing/decorate.d.ts +4 -2
  148. package/r-bridge/lang-4.x/ast/model/processing/decorate.js +6 -1
  149. package/r-bridge/lang-4.x/ast/model/processing/fold.d.ts +3 -3
  150. package/r-bridge/lang-4.x/ast/model/processing/role.d.ts +1 -1
  151. package/r-bridge/lang-4.x/ast/model/processing/stateful-fold.d.ts +3 -3
  152. package/r-bridge/lang-4.x/ast/model/processing/visitor.d.ts +1 -1
  153. package/r-bridge/lang-4.x/ast/parser/json/format.d.ts +14 -0
  154. package/r-bridge/lang-4.x/ast/parser/json/format.js +26 -0
  155. package/r-bridge/lang-4.x/ast/parser/json/parser.d.ts +7 -0
  156. package/r-bridge/lang-4.x/ast/parser/json/parser.js +57 -0
  157. package/r-bridge/lang-4.x/ast/parser/xml/data.d.ts +4 -7
  158. package/r-bridge/lang-4.x/ast/parser/xml/hooks.d.ts +5 -5
  159. package/r-bridge/lang-4.x/ast/parser/xml/index.d.ts +0 -2
  160. package/r-bridge/lang-4.x/ast/parser/xml/index.js +0 -2
  161. package/r-bridge/lang-4.x/ast/parser/xml/input-format.d.ts +6 -2
  162. package/r-bridge/lang-4.x/ast/parser/xml/input-format.js +7 -10
  163. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.d.ts +3 -3
  164. package/r-bridge/lang-4.x/ast/parser/xml/internal/access.js +2 -2
  165. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.d.ts +3 -3
  166. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then-else.js +1 -1
  167. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.d.ts +3 -3
  168. package/r-bridge/lang-4.x/ast/parser/xml/internal/control/if-then.js +2 -2
  169. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.d.ts +3 -3
  170. package/r-bridge/lang-4.x/ast/parser/xml/internal/expression/expression.js +4 -4
  171. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.d.ts +3 -3
  172. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/argument.js +2 -2
  173. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.d.ts +3 -3
  174. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/call.js +4 -4
  175. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.d.ts +3 -3
  176. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/definition.js +2 -2
  177. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.d.ts +3 -3
  178. package/r-bridge/lang-4.x/ast/parser/xml/internal/functions/parameter.js +2 -2
  179. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.d.ts +0 -1
  180. package/r-bridge/lang-4.x/ast/parser/xml/internal/index.js +0 -1
  181. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.d.ts +3 -3
  182. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/break.js +2 -2
  183. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.d.ts +3 -3
  184. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/for.js +3 -6
  185. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.d.ts +3 -3
  186. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/next.js +2 -2
  187. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.d.ts +3 -3
  188. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/repeat.js +2 -2
  189. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.d.ts +3 -3
  190. package/r-bridge/lang-4.x/ast/parser/xml/internal/loops/while.js +2 -2
  191. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.d.ts +9 -14
  192. package/r-bridge/lang-4.x/ast/parser/xml/internal/meta.js +15 -23
  193. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.d.ts +3 -3
  194. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/binary.js +6 -6
  195. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/special.d.ts +1 -1
  196. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.d.ts +3 -3
  197. package/r-bridge/lang-4.x/ast/parser/xml/internal/operators/unary.js +3 -3
  198. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.d.ts +3 -3
  199. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/comment.js +2 -2
  200. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.d.ts +3 -3
  201. package/r-bridge/lang-4.x/ast/parser/xml/internal/other/line-directive.js +2 -2
  202. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.d.ts +4 -4
  203. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/elements.js +3 -3
  204. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.d.ts +3 -3
  205. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/root.js +3 -4
  206. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.d.ts +4 -4
  207. package/r-bridge/lang-4.x/ast/parser/xml/internal/structure/single-element.js +2 -2
  208. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.d.ts +4 -4
  209. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/number.js +2 -2
  210. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.d.ts +3 -3
  211. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/string.js +2 -2
  212. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.d.ts +3 -3
  213. package/r-bridge/lang-4.x/ast/parser/xml/internal/values/symbol.js +4 -4
  214. package/r-bridge/lang-4.x/values.d.ts +0 -1
  215. package/r-bridge/lang-4.x/values.js +14 -6
  216. package/r-bridge/retriever.d.ts +26 -22
  217. package/r-bridge/retriever.js +73 -23
  218. package/r-bridge/shell-executor.d.ts +11 -0
  219. package/r-bridge/shell-executor.js +50 -0
  220. package/r-bridge/shell.d.ts +12 -31
  221. package/r-bridge/shell.js +36 -94
  222. package/reconstruct/reconstruct.d.ts +1 -1
  223. package/slicing/criterion/collect-all.d.ts +3 -3
  224. package/slicing/criterion/filters/all-variables.d.ts +1 -1
  225. package/slicing/criterion/parse.d.ts +1 -1
  226. package/slicing/static/static-slicer.d.ts +3 -3
  227. package/statistics/features/common-syntax-probability.d.ts +3 -2
  228. package/statistics/features/common-syntax-probability.js +0 -3
  229. package/statistics/features/feature.d.ts +6 -6
  230. package/statistics/features/post-processing.d.ts +2 -2
  231. package/statistics/features/supported/assignments/assignments.d.ts +2 -2
  232. package/statistics/features/supported/assignments/post-process.d.ts +2 -2
  233. package/statistics/features/supported/assignments/post-process.js +6 -6
  234. package/statistics/features/supported/comments/comments.d.ts +2 -2
  235. package/statistics/features/supported/comments/post-process.d.ts +2 -2
  236. package/statistics/features/supported/comments/post-process.js +2 -2
  237. package/statistics/features/supported/control-flow/control-flow.d.ts +2 -2
  238. package/statistics/features/supported/control-flow/post-process.d.ts +2 -2
  239. package/statistics/features/supported/data-access/data-access.d.ts +3 -3
  240. package/statistics/features/supported/data-access/post-process.d.ts +2 -2
  241. package/statistics/features/supported/data-access/post-process.js +4 -4
  242. package/statistics/features/supported/defined-functions/defined-functions.d.ts +4 -4
  243. package/statistics/features/supported/defined-functions/post-process.d.ts +2 -2
  244. package/statistics/features/supported/defined-functions/post-process.js +4 -4
  245. package/statistics/features/supported/expression-list/expression-list.d.ts +2 -2
  246. package/statistics/features/supported/expression-list/post-process.d.ts +2 -2
  247. package/statistics/features/supported/expression-list/post-process.js +3 -3
  248. package/statistics/features/supported/loops/loops.d.ts +2 -2
  249. package/statistics/features/supported/loops/post-process.d.ts +2 -2
  250. package/statistics/features/supported/loops/post-process.js +3 -3
  251. package/statistics/features/supported/used-functions/post-process.d.ts +2 -2
  252. package/statistics/features/supported/used-functions/post-process.js +5 -5
  253. package/statistics/features/supported/used-functions/used-functions.d.ts +3 -3
  254. package/statistics/features/supported/used-packages/post-process.d.ts +2 -2
  255. package/statistics/features/supported/used-packages/post-process.js +5 -5
  256. package/statistics/features/supported/used-packages/used-packages.d.ts +2 -2
  257. package/statistics/features/supported/values/post-process.d.ts +2 -2
  258. package/statistics/features/supported/values/post-process.js +3 -3
  259. package/statistics/features/supported/values/values.d.ts +2 -2
  260. package/statistics/features/supported/variables/post-process.d.ts +3 -3
  261. package/statistics/features/supported/variables/post-process.js +3 -3
  262. package/statistics/features/supported/variables/variables.d.ts +2 -2
  263. package/statistics/meta-statistics.d.ts +1 -1
  264. package/statistics/output/ansi.js +1 -1
  265. package/statistics/output/print-stats.d.ts +2 -2
  266. package/statistics/output/statistics-file.d.ts +1 -1
  267. package/statistics/statistics.d.ts +4 -4
  268. package/statistics/statistics.js +7 -8
  269. package/util/args.d.ts +8 -4
  270. package/util/args.js +11 -4
  271. package/util/{cfg.d.ts → cfg/cfg.d.ts} +18 -6
  272. package/util/{cfg.js → cfg/cfg.js} +42 -37
  273. package/util/cfg/visitor.d.ts +14 -0
  274. package/util/cfg/visitor.js +64 -0
  275. package/util/diff.d.ts +1 -1
  276. package/util/files.d.ts +7 -1
  277. package/util/files.js +11 -1
  278. package/util/log.js +3 -0
  279. package/util/mermaid/ast.d.ts +1 -1
  280. package/util/mermaid/cfg.d.ts +2 -2
  281. package/util/mermaid/dfg.d.ts +3 -3
  282. package/util/objects.d.ts +1 -1
  283. package/util/quads.d.ts +2 -2
  284. package/util/summarizer/benchmark/data.d.ts +1 -1
  285. package/util/summarizer/benchmark/first-phase/input.d.ts +2 -1
  286. package/util/summarizer/benchmark/first-phase/input.js +20 -4
  287. package/util/summarizer/benchmark/first-phase/process.d.ts +4 -3
  288. package/util/summarizer/benchmark/first-phase/process.js +14 -5
  289. package/util/summarizer/benchmark/second-phase/graph.d.ts +1 -1
  290. package/util/summarizer/benchmark/second-phase/graph.js +1 -1
  291. package/util/summarizer/benchmark/second-phase/process.d.ts +3 -1
  292. package/util/summarizer/benchmark/second-phase/process.js +48 -11
  293. package/util/summarizer/benchmark/summarizer.d.ts +3 -6
  294. package/util/summarizer/benchmark/summarizer.js +16 -11
  295. package/util/summarizer/statistics/first-phase/process.js +8 -8
  296. package/util/summarizer/statistics/post-process/clusterer.d.ts +2 -2
  297. package/util/summarizer/statistics/post-process/file-based-count.d.ts +1 -1
  298. package/util/summarizer/statistics/post-process/histogram.d.ts +2 -2
  299. package/util/summarizer/statistics/post-process/post-process-output.d.ts +2 -2
  300. package/util/summarizer/statistics/post-process/post-process-output.js +4 -5
  301. package/util/summarizer/statistics/second-phase/process.d.ts +2 -2
  302. package/util/summarizer/statistics/summarizer.d.ts +3 -2
  303. package/util/summarizer/summarizer.d.ts +1 -1
  304. package/r-bridge/lang-4.x/ast/parser/xml/config.d.ts +0 -25
  305. package/r-bridge/lang-4.x/ast/parser/xml/config.js +0 -16
  306. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.d.ts +0 -9
  307. package/r-bridge/lang-4.x/ast/parser/xml/internal/xml-to-json.js +0 -51
  308. package/r-bridge/lang-4.x/ast/parser/xml/parser.d.ts +0 -17
  309. package/r-bridge/lang-4.x/ast/parser/xml/parser.js +0 -30
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.visitCfg = void 0;
4
+ const assert_1 = require("../assert");
5
+ class ControlFlowGraphExecutionTraceVisitor {
6
+ onEnter;
7
+ constructor(onEnter) {
8
+ this.onEnter = onEnter;
9
+ }
10
+ visitSingle(node, context) {
11
+ if (context.visited.has(node.id)) {
12
+ return;
13
+ }
14
+ // only visit a node if we have visited all of its successors
15
+ const successorEdges = context.cfg.graph.edges().get(node.id);
16
+ if (successorEdges) {
17
+ for (const [target,] of successorEdges) {
18
+ if (!context.visited.has(target)) {
19
+ return;
20
+ }
21
+ }
22
+ }
23
+ context.visited.add(node.id);
24
+ this.onEnter(node, context);
25
+ // find all ingoing edges
26
+ const predecessors = this.retrieveAllPredecessors(context, node);
27
+ const siblings = predecessors.map(p => p.source);
28
+ for (const predecessor of predecessors) {
29
+ const { source, edge } = predecessor;
30
+ const sourceVertex = context.cfg.graph.vertices().get(source);
31
+ (0, assert_1.guard)(sourceVertex !== undefined, () => `Source vertex with id ${source} not found`);
32
+ this.visitSingle(sourceVertex, {
33
+ parent: { vertex: node.id, edge },
34
+ cfg: context.cfg,
35
+ visited: context.visited,
36
+ siblings
37
+ });
38
+ }
39
+ }
40
+ retrieveAllPredecessors(context, node) {
41
+ const predecessors = [];
42
+ for (const entry of context.cfg.graph.edges().entries()) {
43
+ const [source, targets] = entry;
44
+ const target = targets.get(node.id);
45
+ if (target) {
46
+ predecessors.push({ source, edge: target });
47
+ }
48
+ }
49
+ return predecessors;
50
+ }
51
+ visit(cfg) {
52
+ const visited = new Set();
53
+ for (const id of cfg.entryPoints) {
54
+ const node = cfg.graph.vertices().get(id);
55
+ (0, assert_1.guard)(node !== undefined, `Node with id ${id} not present`);
56
+ this.visitSingle(node, { parent: 'root', cfg, siblings: [...cfg.entryPoints], visited });
57
+ }
58
+ }
59
+ }
60
+ function visitCfg(cfg, onVisit) {
61
+ return new ControlFlowGraphExecutionTraceVisitor(onVisit).visit(cfg);
62
+ }
63
+ exports.visitCfg = visitCfg;
64
+ //# sourceMappingURL=visitor.js.map
package/util/diff.d.ts CHANGED
@@ -4,7 +4,7 @@
4
4
  *
5
5
  * @module
6
6
  */
7
- import { MergeableRecord } from './objects';
7
+ import type { MergeableRecord } from './objects';
8
8
  /**
9
9
  * Unifies the shape of all difference reports.
10
10
  * They should have an array of comments on the potential differences/equality of
package/util/files.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { RParseRequestFromFile } from '../r-bridge';
2
+ import type { RParseRequestFromFile } from '../r-bridge';
3
3
  /**
4
4
  * Represents a table, identified by a header and a list of rows.
5
5
  */
@@ -52,3 +52,9 @@ export declare function readLineByLine(filePath: string, onLine: (line: Buffer,
52
52
  * See {@link readLineByLine} for an asynchronous version.
53
53
  */
54
54
  export declare function readLineByLineSync(filePath: string, onLine: (line: Buffer, lineNumber: number) => void): void;
55
+ /**
56
+ * Chops off the last part of the given directory path after a path separator, essentially returning the path's parent directory.
57
+ * If an absolute path is passed, the returned path is also absolute.
58
+ * @param directory - The directory whose parent to return
59
+ */
60
+ export declare function getParentDirectory(directory: string): string;
package/util/files.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.readLineByLineSync = exports.readLineByLine = exports.writeTableAsCsv = exports.allRFilesFrom = exports.allRFiles = exports.getAllFiles = void 0;
29
+ exports.getParentDirectory = exports.readLineByLineSync = exports.readLineByLine = exports.writeTableAsCsv = exports.allRFilesFrom = exports.allRFiles = exports.getAllFiles = void 0;
30
30
  const fs_1 = __importStar(require("fs"));
31
31
  const path_1 = __importDefault(require("path"));
32
32
  const log_1 = require("./log");
@@ -141,4 +141,14 @@ function readLineByLineSync(filePath, onLine) {
141
141
  }
142
142
  }
143
143
  exports.readLineByLineSync = readLineByLineSync;
144
+ /**
145
+ * Chops off the last part of the given directory path after a path separator, essentially returning the path's parent directory.
146
+ * If an absolute path is passed, the returned path is also absolute.
147
+ * @param directory - The directory whose parent to return
148
+ */
149
+ function getParentDirectory(directory) {
150
+ // apparently this is somehow the best way to do it in node, what
151
+ return directory.split(path_1.default.sep).slice(0, -1).join(path_1.default.sep);
152
+ }
153
+ exports.getParentDirectory = getParentDirectory;
144
154
  //# sourceMappingURL=files.js.map
package/util/log.js CHANGED
@@ -34,6 +34,9 @@ class FlowrLogger extends tslog_1.Logger {
34
34
  exports.FlowrLogger = FlowrLogger;
35
35
  function getActiveLog() {
36
36
  return new FlowrLogger({
37
+ // set the default minimum level as Warn, and let all apps
38
+ // (like the REPL) update it to whatever they want it to be
39
+ minLevel: 4 /* LogLevel.Warn */,
37
40
  type: 'pretty',
38
41
  name: 'main',
39
42
  stylePrettyLogs: true,
@@ -1,4 +1,4 @@
1
- import { RNodeWithParent } from '../../r-bridge';
1
+ import type { RNodeWithParent } from '../../r-bridge';
2
2
  export declare function normalizedAstToMermaid(ast: RNodeWithParent, prefix?: string): string;
3
3
  /**
4
4
  * Use mermaid to visualize the normalized AST.
@@ -1,5 +1,5 @@
1
- import { NormalizedAst } from '../../r-bridge';
2
- import { ControlFlowInformation } from '../cfg';
1
+ import type { NormalizedAst } from '../../r-bridge';
2
+ import type { ControlFlowInformation } from '../cfg/cfg';
3
3
  export declare function cfgToMermaid(cfg: ControlFlowInformation, normalizedAst: NormalizedAst, prefix?: string): string;
4
4
  /**
5
5
  * Use mermaid to visualize the normalized AST.
@@ -1,6 +1,6 @@
1
- import { NodeId } from '../../r-bridge';
2
- import { SourceRange } from '../range';
3
- import { DataflowGraph, DataflowMap } from '../../dataflow';
1
+ import type { NodeId } from '../../r-bridge';
2
+ import type { SourceRange } from '../range';
3
+ import type { DataflowGraph, DataflowMap } from '../../dataflow';
4
4
  export declare function formatRange(range: SourceRange | undefined): string;
5
5
  export declare function graphToMermaid(graph: DataflowGraph, dataflowIdMap: DataflowMap | undefined, prefix?: string | null, idPrefix?: string, includeEnvironments?: boolean, mark?: Set<NodeId>, rootGraph?: DataflowGraph): string;
6
6
  /**
package/util/objects.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { DeepPartial, DeepRequired } from 'ts-essentials';
1
+ import type { DeepPartial, DeepRequired } from 'ts-essentials';
2
2
  /**
3
3
  * checks if `item` is an object (it may be an array, ...)
4
4
  */
package/util/quads.d.ts CHANGED
@@ -7,8 +7,8 @@
7
7
  *
8
8
  * @module
9
9
  */
10
- import { MergeableRecord } from './objects';
11
- import { NodeId } from '../r-bridge';
10
+ import type { MergeableRecord } from './objects';
11
+ import type { NodeId } from '../r-bridge';
12
12
  type RecordForQuad = Record<string, unknown>;
13
13
  type DataForQuad = Record<string, unknown> | ArrayLike<unknown>;
14
14
  type ContextForQuad = string;
@@ -1,4 +1,4 @@
1
- import { CommonSlicerMeasurements, PerSliceMeasurements, SlicerStats, SlicerStatsDataflow, SlicerStatsInput } from '../../../benchmark';
1
+ import type { CommonSlicerMeasurements, PerSliceMeasurements, SlicerStats, SlicerStatsDataflow, SlicerStatsInput } from '../../../benchmark';
2
2
  export interface SummarizedMeasurement<T = number> {
3
3
  min: T;
4
4
  max: T;
@@ -1,2 +1,3 @@
1
1
  /// <reference types="node" />
2
- export declare function processNestMeasurement(line: Buffer, counter: number, summarizedText: string, outputPath: string): Promise<void>;
2
+ export declare function processRunMeasurement(line: Buffer, fileNum: number, lineNum: number, summarizedText: string, outputPath: string): Promise<void>;
3
+ export declare function processSummarizedFileMeasurement(file: string, summariesFile: string, outputPath: string): void;
@@ -3,18 +3,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.processNestMeasurement = void 0;
6
+ exports.processSummarizedFileMeasurement = exports.processRunMeasurement = void 0;
7
7
  const benchmark_1 = require("../../../../benchmark");
8
8
  const assert_1 = require("../../../assert");
9
9
  const statistics_1 = require("../../../../statistics");
10
10
  const fs_1 = __importDefault(require("fs"));
11
11
  const json_1 = require("../../../json");
12
- async function processNestMeasurement(line, counter, summarizedText, outputPath) {
12
+ const files_1 = require("../../../files");
13
+ const process_1 = require("../second-phase/process");
14
+ async function processRunMeasurement(line, fileNum, lineNum, summarizedText, outputPath) {
13
15
  let got = JSON.parse(line.toString());
14
- console.log(`[${counter}] Summarize for ${got.filename}`);
16
+ console.log(`[file ${fileNum}, line ${lineNum}] Summarize for ${got.filename}`);
15
17
  // now we have to recover the maps and bigints :C
16
18
  got = {
17
19
  filename: got.filename,
20
+ 'file-id': got['file-id'],
21
+ 'run-num': got['run-num'],
18
22
  stats: {
19
23
  input: got.stats.input,
20
24
  request: got.stats.request,
@@ -37,12 +41,24 @@ async function processNestMeasurement(line, counter, summarizedText, outputPath)
37
41
  console.log(` - Append raw summary to ${outputPath}`);
38
42
  fs_1.default.appendFileSync(outputPath, `${JSON.stringify({
39
43
  filename: got.filename,
44
+ 'file-id': got['file-id'],
45
+ 'run-num': got['run-num'],
40
46
  summarize: summarized
41
47
  }, json_1.jsonReplacer)}\n`);
42
48
  console.log(` - Append textual summary to ${summarizedText}`);
43
49
  fs_1.default.appendFileSync(summarizedText, `${(0, benchmark_1.stats2string)(summarized)}\n`);
44
50
  }
45
- exports.processNestMeasurement = processNestMeasurement;
51
+ exports.processRunMeasurement = processRunMeasurement;
52
+ function processSummarizedFileMeasurement(file, summariesFile, outputPath) {
53
+ console.log(`Summarize all runs for ${file}`);
54
+ const summaries = [];
55
+ (0, files_1.readLineByLineSync)(summariesFile, l => (0, process_1.processNextSummary)(l, summaries));
56
+ fs_1.default.appendFileSync(outputPath, `${JSON.stringify({
57
+ filename: file,
58
+ summarize: (0, process_1.summarizeAllSummarizedStats)(summaries)
59
+ }, json_1.jsonReplacer)}\n`);
60
+ }
61
+ exports.processSummarizedFileMeasurement = processSummarizedFileMeasurement;
46
62
  function mapPerSliceStats(k, v) {
47
63
  return [k, {
48
64
  reconstructedCode: v.reconstructedCode,
@@ -1,6 +1,6 @@
1
- import { SummarizedMeasurement, SummarizedSlicerStats } from '../data';
2
- import { PerSliceStats, SlicerStats } from '../../../../benchmark';
3
- import { SlicingCriteria } from '../../../../slicing';
1
+ import type { Reduction, SummarizedMeasurement, SummarizedSlicerStats } from '../data';
2
+ import type { PerSliceStats, SlicerStats } from '../../../../benchmark';
3
+ import type { SlicingCriteria } from '../../../../slicing';
4
4
  /**
5
5
  * Summarizes the given stats by calculating the min, max, median, mean, and the standard deviation for each measurement.
6
6
  * @see Slicer
@@ -8,3 +8,4 @@ import { SlicingCriteria } from '../../../../slicing';
8
8
  export declare function summarizeSlicerStats(stats: SlicerStats, report?: (criteria: SlicingCriteria, stats: PerSliceStats) => void): Promise<Readonly<SummarizedSlicerStats>>;
9
9
  export declare function summarizeMeasurement(data: number[], totalNumberOfDataPoints?: number): SummarizedMeasurement;
10
10
  export declare function summarizeSummarizedMeasurement(data: SummarizedMeasurement[]): SummarizedMeasurement;
11
+ export declare function summarizeReductions(reductions: Reduction<SummarizedMeasurement>[]): Reduction<SummarizedMeasurement>;
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.summarizeSummarizedMeasurement = exports.summarizeMeasurement = exports.summarizeSlicerStats = void 0;
29
+ exports.summarizeReductions = exports.summarizeSummarizedMeasurement = exports.summarizeMeasurement = exports.summarizeSlicerStats = void 0;
30
30
  const tmp = __importStar(require("tmp"));
31
31
  const assert_1 = require("../../../assert");
32
32
  const log_1 = require("../../../log");
@@ -84,7 +84,6 @@ async function summarizeSlicerStats(stats, report = () => {
84
84
  const collect = new defaultmap_1.DefaultMap(() => []);
85
85
  const sizeOfSliceCriteria = [];
86
86
  const reParseShellSession = new r_bridge_1.RShell();
87
- reParseShellSession.tryToInjectHomeLibPath();
88
87
  const reductions = [];
89
88
  let failedOutputs = 0;
90
89
  const sliceSize = {
@@ -96,7 +95,6 @@ async function summarizeSlicerStats(stats, report = () => {
96
95
  normalizedTokens: [],
97
96
  dataflowNodes: []
98
97
  };
99
- let first = true;
100
98
  let timesHitThreshold = 0;
101
99
  for (const [criteria, perSliceStat] of perSliceStats) {
102
100
  report(criteria, perSliceStat);
@@ -116,8 +114,7 @@ async function summarizeSlicerStats(stats, report = () => {
116
114
  try {
117
115
  // there seem to be encoding issues, therefore, we dump to a temp file
118
116
  fs_1.default.writeFileSync(tempfile().name, output);
119
- const reParsed = await (0, r_bridge_1.retrieveNormalizedAstFromRCode)({ request: 'file', content: tempfile().name, ensurePackageInstalled: first }, reParseShellSession);
120
- first = false;
117
+ const reParsed = await (0, r_bridge_1.retrieveNormalizedAstFromRCode)({ request: 'file', content: tempfile().name }, reParseShellSession);
121
118
  let numberOfNormalizedTokens = 0;
122
119
  (0, r_bridge_1.visitAst)(reParsed.ast, _ => {
123
120
  numberOfNormalizedTokens++;
@@ -205,4 +202,16 @@ function summarizeSummarizedMeasurement(data) {
205
202
  return { min, max, median, mean, std, total };
206
203
  }
207
204
  exports.summarizeSummarizedMeasurement = summarizeSummarizedMeasurement;
205
+ function summarizeReductions(reductions) {
206
+ return {
207
+ numberOfDataflowNodes: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfDataflowNodes)),
208
+ numberOfLines: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfLines)),
209
+ numberOfCharacters: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfCharacters)),
210
+ numberOfNonWhitespaceCharacters: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfNonWhitespaceCharacters)),
211
+ numberOfLinesNoAutoSelection: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfLinesNoAutoSelection)),
212
+ numberOfNormalizedTokens: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfNormalizedTokens)),
213
+ numberOfRTokens: summarizeSummarizedMeasurement(reductions.map(r => r.numberOfRTokens))
214
+ };
215
+ }
216
+ exports.summarizeReductions = summarizeReductions;
208
217
  //# sourceMappingURL=process.js.map
@@ -1,2 +1,2 @@
1
- import { UltimateSlicerStats } from '../data';
1
+ import type { UltimateSlicerStats } from '../data';
2
2
  export declare function writeGraphOutput(ultimate: UltimateSlicerStats, outputGraphPath: string): void;
@@ -11,7 +11,7 @@ function writeGraphOutput(ultimate, outputGraphPath) {
11
11
  const data = [];
12
12
  for (const { name, measurements } of [{ name: 'per-file', measurements: ultimate.commonMeasurements }, { name: 'per-slice', measurements: ultimate.perSliceMeasurements }]) {
13
13
  for (const [point, measurement] of measurements) {
14
- if (point === 'close R session' || point === 'initialize R session' || point === 'inject home path' || point === 'ensure installation of xmlparsedata' || point === 'retrieve token map') {
14
+ if (point === 'close R session' || point === 'initialize R session') {
15
15
  continue;
16
16
  }
17
17
  const pointName = point === 'total' ? `total ${name}` : point;
@@ -1,4 +1,6 @@
1
1
  /// <reference types="node" />
2
- import { SummarizedSlicerStats, UltimateSlicerStats } from '../data';
2
+ import type { SummarizedSlicerStats, UltimateSlicerStats } from '../data';
3
3
  export declare function summarizeAllSummarizedStats(stats: SummarizedSlicerStats[]): UltimateSlicerStats;
4
+ export declare function summarizeAllUltimateStats(stats: UltimateSlicerStats[]): UltimateSlicerStats;
4
5
  export declare function processNextSummary(line: Buffer, allSummarized: SummarizedSlicerStats[]): void;
6
+ export declare function processNextUltimateSummary(line: Buffer, allSummarized: UltimateSlicerStats[]): void;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.processNextSummary = exports.summarizeAllSummarizedStats = void 0;
3
+ exports.processNextUltimateSummary = exports.processNextSummary = exports.summarizeAllUltimateStats = exports.summarizeAllSummarizedStats = void 0;
4
4
  const defaultmap_1 = require("../../../defaultmap");
5
5
  const benchmark_1 = require("../../../../benchmark");
6
6
  const assert_1 = require("../../../assert");
7
+ const process_1 = require("../first-phase/process");
7
8
  function summarizeAllSummarizedStats(stats) {
8
9
  const commonMeasurements = new defaultmap_1.DefaultMap(() => []);
9
10
  const perSliceMeasurements = new defaultmap_1.DefaultMap(() => []);
@@ -34,15 +35,7 @@ function summarizeAllSummarizedStats(stats) {
34
35
  perSliceMeasurements: new Map([...perSliceMeasurements.entries()].map(([k, v]) => [k, (0, benchmark_1.summarizeSummarizedMeasurement)(v)])),
35
36
  failedToRepParse,
36
37
  timesHitThreshold,
37
- reduction: {
38
- numberOfDataflowNodes: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfDataflowNodes)),
39
- numberOfLines: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfLines)),
40
- numberOfCharacters: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfCharacters)),
41
- numberOfNonWhitespaceCharacters: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfNonWhitespaceCharacters)),
42
- numberOfLinesNoAutoSelection: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfLinesNoAutoSelection)),
43
- numberOfNormalizedTokens: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfNormalizedTokens)),
44
- numberOfRTokens: (0, benchmark_1.summarizeSummarizedMeasurement)(reductions.map(r => r.numberOfRTokens))
45
- },
38
+ reduction: (0, process_1.summarizeReductions)(reductions),
46
39
  input: {
47
40
  numberOfLines: (0, benchmark_1.summarizeMeasurement)(inputs.map(i => i.numberOfLines)),
48
41
  numberOfCharacters: (0, benchmark_1.summarizeMeasurement)(inputs.map(i => i.numberOfCharacters)),
@@ -59,10 +52,36 @@ function summarizeAllSummarizedStats(stats) {
59
52
  };
60
53
  }
61
54
  exports.summarizeAllSummarizedStats = summarizeAllSummarizedStats;
55
+ function summarizeAllUltimateStats(stats) {
56
+ return {
57
+ // these should be deterministic, so we don't technically need to use max, but we do just in case something unexpected happens :)
58
+ totalRequests: Math.max(...stats.map(s => s.totalRequests)),
59
+ totalSlices: Math.max(...stats.map(s => s.totalSlices)),
60
+ failedToRepParse: Math.max(...stats.map(s => s.failedToRepParse)),
61
+ timesHitThreshold: Math.max(...stats.map(s => s.timesHitThreshold)),
62
+ // average out / summarize other measurements
63
+ commonMeasurements: new Map(benchmark_1.CommonSlicerMeasurements.map(m => [m, (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.commonMeasurements.get(m)))])),
64
+ perSliceMeasurements: new Map(benchmark_1.PerSliceMeasurements.map(m => [m, (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.perSliceMeasurements.get(m)))])),
65
+ reduction: (0, process_1.summarizeReductions)(stats.map(s => s.reduction)),
66
+ input: {
67
+ numberOfLines: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.input.numberOfLines)),
68
+ numberOfCharacters: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.input.numberOfCharacters)),
69
+ numberOfNonWhitespaceCharacters: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.input.numberOfNonWhitespaceCharacters)),
70
+ numberOfRTokens: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.input.numberOfRTokens)),
71
+ numberOfNormalizedTokens: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.input.numberOfNormalizedTokens))
72
+ },
73
+ dataflow: {
74
+ numberOfNodes: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfNodes)),
75
+ numberOfFunctionDefinitions: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfFunctionDefinitions)),
76
+ numberOfCalls: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfCalls)),
77
+ numberOfEdges: (0, benchmark_1.summarizeSummarizedMeasurement)(stats.map(s => s.dataflow.numberOfEdges))
78
+ }
79
+ };
80
+ }
81
+ exports.summarizeAllUltimateStats = summarizeAllUltimateStats;
62
82
  function processNextSummary(line, allSummarized) {
63
83
  let got = JSON.parse(line.toString());
64
84
  got = {
65
- filename: got.filename,
66
85
  summarize: {
67
86
  input: got.summarize.input,
68
87
  request: got.summarize.request,
@@ -86,4 +105,22 @@ function processNextSummary(line, allSummarized) {
86
105
  allSummarized.push(got.summarize);
87
106
  }
88
107
  exports.processNextSummary = processNextSummary;
108
+ function processNextUltimateSummary(line, allSummarized) {
109
+ let got = JSON.parse(line.toString());
110
+ got = {
111
+ summarize: {
112
+ totalRequests: got.summarize.totalRequests,
113
+ totalSlices: got.summarize.totalSlices,
114
+ commonMeasurements: new Map(got.summarize.commonMeasurements),
115
+ perSliceMeasurements: new Map(got.summarize.perSliceMeasurements),
116
+ failedToRepParse: got.summarize.failedToRepParse,
117
+ timesHitThreshold: got.summarize.timesHitThreshold,
118
+ reduction: got.summarize.reduction,
119
+ input: got.summarize.input,
120
+ dataflow: got.summarize.dataflow,
121
+ }
122
+ };
123
+ allSummarized.push(got.summarize);
124
+ }
125
+ exports.processNextUltimateSummary = processNextUltimateSummary;
89
126
  //# sourceMappingURL=process.js.map
@@ -2,8 +2,9 @@
2
2
  * This module is tasked with processing the results of the benchmarking (see {@link SlicerStats}).
3
3
  * @module
4
4
  */
5
- import { CommonSummarizerConfiguration, Summarizer } from '../summarizer';
6
- import { UltimateSlicerStats } from './data';
5
+ import type { CommonSummarizerConfiguration } from '../summarizer';
6
+ import { Summarizer } from '../summarizer';
7
+ import type { UltimateSlicerStats } from './data';
7
8
  export interface BenchmarkSummarizerConfiguration extends CommonSummarizerConfiguration {
8
9
  /**
9
10
  * If given, produce graph data output (e.g. for the benchmark visualization) to the given path
@@ -17,10 +18,6 @@ export interface BenchmarkSummarizerConfiguration extends CommonSummarizerConfig
17
18
  * Path for the intermediate results of the preparation phase
18
19
  */
19
20
  intermediateOutputPath: string;
20
- /**
21
- * Path for the final results of the summarization phase
22
- */
23
- outputLogPath?: string;
24
21
  /**
25
22
  * Path for the final results of the summarization phase
26
23
  */
@@ -4,10 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.BenchmarkSummarizer = void 0;
7
- /**
8
- * This module is tasked with processing the results of the benchmarking (see {@link SlicerStats}).
9
- * @module
10
- */
11
7
  const summarizer_1 = require("../summarizer");
12
8
  const fs_1 = __importDefault(require("fs"));
13
9
  const input_1 = require("./first-phase/input");
@@ -16,24 +12,33 @@ const benchmark_1 = require("../../../benchmark");
16
12
  const process_1 = require("./second-phase/process");
17
13
  const graph_1 = require("./second-phase/graph");
18
14
  const files_1 = require("../../files");
15
+ const path_1 = __importDefault(require("path"));
19
16
  class BenchmarkSummarizer extends summarizer_1.Summarizer {
20
17
  constructor(config) {
21
18
  super(config);
22
19
  }
23
20
  async preparationPhase() {
21
+ this.removeIfExists(`${this.config.intermediateOutputPath}.json`);
24
22
  this.removeIfExists(this.config.intermediateOutputPath);
25
- this.removeIfExists(this.config.outputLogPath);
26
- await (0, files_1.readLineByLine)(this.config.inputPath, (line, lineNumber) => (0, input_1.processNestMeasurement)(line, lineNumber, `${this.config.intermediateOutputPath}.log`, this.config.intermediateOutputPath));
23
+ fs_1.default.mkdirSync(this.config.intermediateOutputPath);
24
+ const dirContent = fs_1.default.readdirSync(this.config.inputPath);
25
+ for (let i = 0; i < dirContent.length; i++) {
26
+ const filePath = path_1.default.join(this.config.inputPath, dirContent[i]);
27
+ const outputPath = path_1.default.join(this.config.intermediateOutputPath, dirContent[i]);
28
+ // generate measurements for each run
29
+ await (0, files_1.readLineByLine)(filePath, (line, lineNumber) => (0, input_1.processRunMeasurement)(line, i, lineNumber, `${outputPath}.log`, outputPath));
30
+ // generate combined measurements for the file
31
+ (0, input_1.processSummarizedFileMeasurement)(filePath, outputPath, `${this.config.intermediateOutputPath}.json`);
32
+ }
27
33
  this.log('Done summarizing');
28
34
  }
29
35
  // eslint-disable-next-line @typescript-eslint/require-await -- just to obey the structure
30
36
  async summarizePhase() {
31
37
  this.log(`Summarizing all summaries from ${this.config.inputPath}...`);
32
38
  this.removeIfExists(this.config.outputPath);
33
- const allSummarized = [];
34
- (0, files_1.readLineByLineSync)(this.config.intermediateOutputPath, line => (0, process_1.processNextSummary)(line, allSummarized));
35
- // summarizedRaw
36
- const ultimate = (0, process_1.summarizeAllSummarizedStats)(allSummarized);
39
+ const summaries = [];
40
+ (0, files_1.readLineByLineSync)(`${this.config.intermediateOutputPath}.json`, (l) => (0, process_1.processNextUltimateSummary)(l, summaries));
41
+ const ultimate = (0, process_1.summarizeAllUltimateStats)(summaries);
37
42
  this.log(`Writing ultimate summary to ${this.config.outputPath}`);
38
43
  fs_1.default.writeFileSync(this.config.outputPath, JSON.stringify(ultimate, json_1.jsonReplacer));
39
44
  console.log((0, benchmark_1.ultimateStats2String)(ultimate));
@@ -45,7 +50,7 @@ class BenchmarkSummarizer extends summarizer_1.Summarizer {
45
50
  removeIfExists(path) {
46
51
  if (path && fs_1.default.existsSync(path)) {
47
52
  this.log(`Removing existing ${path}`);
48
- fs_1.default.unlinkSync(path);
53
+ fs_1.default.rmSync(path, { recursive: true });
49
54
  }
50
55
  }
51
56
  }
@@ -4,26 +4,26 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.FileMigrator = void 0;
7
- const node_fs_1 = __importDefault(require("node:fs"));
8
- const node_path_1 = __importDefault(require("node:path"));
7
+ const fs_1 = __importDefault(require("fs"));
8
+ const path_1 = __importDefault(require("path"));
9
9
  const assert_1 = require("../../../assert");
10
10
  class FileMigrator {
11
11
  writeHandles = new Map();
12
12
  finished = false;
13
13
  async migrate(sourceFolderContent, targetFolder, originalFile) {
14
14
  (0, assert_1.guard)(!this.finished, () => 'migrator is already marked as finished!');
15
- if (!node_fs_1.default.existsSync(targetFolder)) {
16
- node_fs_1.default.mkdirSync(targetFolder, { recursive: true });
15
+ if (!fs_1.default.existsSync(targetFolder)) {
16
+ fs_1.default.mkdirSync(targetFolder, { recursive: true });
17
17
  }
18
18
  const promises = [];
19
19
  for (const [filepath, content] of sourceFolderContent.entries()) {
20
- const target = node_path_1.default.join(targetFolder, filepath);
20
+ const target = path_1.default.join(targetFolder, filepath);
21
21
  let targetStream = this.writeHandles.get(target);
22
22
  if (targetStream === undefined) {
23
- if (!node_fs_1.default.existsSync(node_path_1.default.dirname(target))) {
24
- node_fs_1.default.mkdirSync(node_path_1.default.dirname(target), { recursive: true });
23
+ if (!fs_1.default.existsSync(path_1.default.dirname(target))) {
24
+ fs_1.default.mkdirSync(path_1.default.dirname(target), { recursive: true });
25
25
  }
26
- targetStream = node_fs_1.default.createWriteStream(target, { flags: 'a' });
26
+ targetStream = fs_1.default.createWriteStream(target, { flags: 'a' });
27
27
  this.writeHandles.set(target, targetStream);
28
28
  }
29
29
  // before we write said content we have to group {value: string, context: string} by context (while we can safely assume that there is only one context per file,
@@ -1,6 +1,6 @@
1
1
  import { DefaultMap } from '../../../defaultmap';
2
- import { NodeId } from '../../../../r-bridge';
3
- import { MergeableRecord } from '../../../objects';
2
+ import type { NodeId } from '../../../../r-bridge';
3
+ import type { MergeableRecord } from '../../../objects';
4
4
  export type ContextsWithCount = DefaultMap<NodeId, number>;
5
5
  export type ClusterContextIdMap = DefaultMap<string | undefined, NodeId>;
6
6
  export type ClusterValueInfoMap = DefaultMap<string, ContextsWithCount>;
@@ -1,4 +1,4 @@
1
- import { ClusterReport } from './clusterer';
1
+ import type { ClusterReport } from './clusterer';
2
2
  export interface FileBasedTable {
3
3
  header: string[];
4
4
  rows: string[][];
@@ -1,5 +1,5 @@
1
- import { ClusterReport } from './clusterer';
2
- import { Table } from '../../../files';
1
+ import type { ClusterReport } from './clusterer';
2
+ import type { Table } from '../../../files';
3
3
  /**
4
4
  * A conventional histogram (e.g., created by {@link histogramFromNumbers}).
5
5
  * Can be converted to a {@link Table} by {@link histograms2table}.
@@ -1,5 +1,5 @@
1
- import { FeatureSelection } from '../../../../statistics';
2
- import { ClusterReport } from './clusterer';
1
+ import type { FeatureSelection } from '../../../../statistics';
2
+ import type { ClusterReport } from './clusterer';
3
3
  /**
4
4
  * Post process the collections in a given folder, reducing them in a memory preserving way.
5
5
  *
@@ -9,7 +9,6 @@ const path_1 = __importDefault(require("path"));
9
9
  const log_1 = require("../../../log");
10
10
  const fs_1 = __importDefault(require("fs"));
11
11
  const clusterer_1 = require("./clusterer");
12
- const statistics_2 = require("../../../../statistics");
13
12
  const r_bridge_1 = require("../../../../r-bridge");
14
13
  const defaultmap_1 = require("../../../defaultmap");
15
14
  /**
@@ -61,7 +60,7 @@ function processFeatureFolder(filepath, feature) {
61
60
  return reports;
62
61
  }
63
62
  function processFeatureSubKey(featurePath, subKey, contextIdMap) {
64
- const targetPath = path_1.default.join(featurePath, `${subKey}${statistics_2.defaultStatisticsFileSuffix}`);
63
+ const targetPath = path_1.default.join(featurePath, `${subKey}${statistics_1.defaultStatisticsFileSuffix}`);
65
64
  if (!fs_1.default.existsSync(targetPath)) {
66
65
  log_1.log.warn(`Folder for ${subKey} does not exist at ${targetPath} skipping post processing of this key`);
67
66
  return undefined;
@@ -93,9 +92,9 @@ function printClusterReport(report, limit = 1000) {
93
92
  const strId = `${name}`.padEnd(longestName, ' ');
94
93
  const strCount = count.toLocaleString().padStart(longestCount, ' ');
95
94
  const strUnique = unique.toLocaleString().padStart(longestUnique, ' ');
96
- const uniqueSuffix = `\t (${strUnique} ${statistics_2.formatter.format('unique', { color: 7 /* Colors.White */, effect: statistics_2.ColorEffect.Foreground })})`;
97
- console.log(`\t${statistics_2.formatter.format(strId, { style: 1 /* FontStyles.Bold */ })}\t ${strCount} ` +
98
- `${statistics_2.formatter.format('total', { color: 7 /* Colors.White */, effect: statistics_2.ColorEffect.Foreground })}`
95
+ const uniqueSuffix = `\t (${strUnique} ${statistics_1.formatter.format('unique', { color: 7 /* Colors.White */, effect: statistics_1.ColorEffect.Foreground })})`;
96
+ console.log(`\t${statistics_1.formatter.format(strId, { style: 1 /* FontStyles.Bold */ })}\t ${strCount} ` +
97
+ `${statistics_1.formatter.format('total', { color: 7 /* Colors.White */, effect: statistics_1.ColorEffect.Foreground })}`
99
98
  + (count !== unique ? uniqueSuffix : ''));
100
99
  }
101
100
  return shortStats.map(({ name }) => name);
@@ -1,5 +1,5 @@
1
- import { CommonSummarizerConfiguration } from '../../summarizer';
2
- import { StatisticsSummarizerConfiguration } from '../summarizer';
1
+ import type { CommonSummarizerConfiguration } from '../../summarizer';
2
+ import type { StatisticsSummarizerConfiguration } from '../summarizer';
3
3
  /**
4
4
  * Post process the collections in a given folder, retrieving the final summaries.
5
5
  *
@@ -1,5 +1,6 @@
1
- import { CommonSummarizerConfiguration, Summarizer } from '../summarizer';
2
- import { FeatureSelection } from '../../../statistics';
1
+ import type { CommonSummarizerConfiguration } from '../summarizer';
2
+ import { Summarizer } from '../summarizer';
3
+ import type { FeatureSelection } from '../../../statistics';
3
4
  export interface StatisticsSummarizerConfiguration extends CommonSummarizerConfiguration {
4
5
  /**
5
6
  * The input path to read all zips from