Skip to content

Commit bcb6f63

Browse files
authored
update to JuliaInterpreter 0.10 (#127)
* update to JuliaInterpreter 0.10 This commit implements the migration to the new JuliaInterpreter interface proposed in JuliaDebug/JuliaInterpreter.jl#683. It purely performs the migration to the new interface and does not include any refactoring based on it. `selective_eval!` could now be rewritten as follows using the new interface, that change is not made in this commit for minimizing the diff: ```diff diff --git a/src/codeedges.jl b/src/codeedges.jl index 3cf2a17..5eba604 100644 --- a/src/codeedges.jl +++ b/src/codeedges.jl @@ -1021,6 +1021,33 @@ function add_inplace!(isrequired, src, edges, norequire) return changed end +struct SelectiveInterpreter{S<:Interpreter,T<:AbstractVector{Bool}} <: Interpreter + inner::S + isrequired::T +end +function JuliaInterpreter.step_expr!(interp::SelectiveInterpreter, frame::Frame, istoplevel::Bool) + pc = frame.pc + if interp.isrequired[pc] + step_expr!(interp.inner, frame::Frame, istoplevel::Bool) + else + next_or_nothing!(interp, frame) + end +end +function JuliaInterpreter.get_return(interp::SelectiveInterpreter, frame::Frame) + pc = frame.pc + node = pc_expr(frame, pc) + if is_return(node) + if interp.isrequired[pc] + return lookup_return(frame, node) + end + else + if isassigned(frame.framedata.ssavalues, pc) + return frame.framedata.ssavalues[pcexec] + end + end + return nothing +end + """ selective_eval!([interp::Interpreter=RecursiveInterpreter()], frame::Frame, isrequired::AbstractVector{Bool}, istoplevel=false) @@ -1037,27 +1064,10 @@ This will return either a `BreakpointRef`, the value obtained from the last exec Typically, assignment to a variable binding does not result in an ssa store by JuliaInterpreter. """ function selective_eval!(interp::Interpreter, frame::Frame, isrequired::AbstractVector{Bool}, istoplevel::Bool=false) - pc = pcexec = pclast = frame.pc - while isa(pc, Int) - frame.pc = pc - pclast = pcexec::Int - if isrequired[pc] - pcexec = pc = step_expr!(interp, frame, istoplevel) - else - pc = next_or_nothing!(interp, frame) - end - end - isa(pc, BreakpointRef) && return pc - pcexec = (pcexec === nothing ? pclast : pcexec)::Int - frame.pc = pcexec - node = pc_expr(frame) - is_return(node) && return isrequired[pcexec] ? lookup_return(frame, node) : nothing - isassigned(frame.framedata.ssavalues, pcexec) && return frame.framedata.ssavalues[pcexec] - return nothing + return JuliaInterpreter.finish_and_return!(SelectiveInterpreter(interp, isrequired), frame, istoplevel) end -function selective_eval!(frame::Frame, isrequired::AbstractVector{Bool}, istoplevel::Bool=false) +selective_eval!(frame::Frame, isrequired::AbstractVector{Bool}, istoplevel::Bool=false) = selective_eval!(RecursiveInterpreter(), frame, isrequired, istoplevel) -end """ selective_eval_fromstart!([interp::Interpreter=RecursiveInterpreter()], frame, isrequired, istoplevel=false) ``` * a bit better `selective_eval` * rm no longer used `finish_and_return!` import * propagate `interp` context to `lookup` * fix docs
1 parent 498e2fb commit bcb6f63

File tree

8 files changed

+451
-114
lines changed

8 files changed

+451
-114
lines changed

Project.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
name = "LoweredCodeUtils"
22
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
3-
version = "3.2.2"
3+
version = "3.3.0"
44
authors = ["Tim Holy <tim.holy@gmail.com>"]
55

66
[deps]
77
JuliaInterpreter = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
88

99
[compat]
10-
JuliaInterpreter = "0.9.46"
10+
JuliaInterpreter = "0.10"
1111
julia = "1.10"
1212

1313
[extras]

docs/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
build/
22
site/
3+
!Manifest.toml

docs/Manifest.toml

Lines changed: 307 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,307 @@
1+
# This file is machine-generated - editing it directly is not advised
2+
3+
julia_version = "1.12.0-beta1"
4+
manifest_format = "2.0"
5+
project_hash = "9333156eea8af2fffc3b9e8bb1bfc75d6bb99ef7"
6+
7+
[[deps.ANSIColoredPrinters]]
8+
git-tree-sha1 = "574baf8110975760d391c710b6341da1afa48d8c"
9+
uuid = "a4c015fc-c6ff-483c-b24f-f7ea428134e9"
10+
version = "0.0.1"
11+
12+
[[deps.AbstractTrees]]
13+
git-tree-sha1 = "2d9c9a55f9c93e8887ad391fbae72f8ef55e1177"
14+
uuid = "1520ce14-60c1-5f80-bbc7-55ef81b5835c"
15+
version = "0.4.5"
16+
17+
[[deps.ArgTools]]
18+
uuid = "0dad84c5-d112-42e6-8d28-ef12dabb789f"
19+
version = "1.1.2"
20+
21+
[[deps.Artifacts]]
22+
uuid = "56f22d72-fd6d-98f1-02f0-08ddc0907c33"
23+
version = "1.11.0"
24+
25+
[[deps.Base64]]
26+
uuid = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
27+
version = "1.11.0"
28+
29+
[[deps.CodeTracking]]
30+
deps = ["InteractiveUtils", "UUIDs"]
31+
git-tree-sha1 = "062c5e1a5bf6ada13db96a4ae4749a4c2234f521"
32+
uuid = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
33+
version = "1.3.9"
34+
35+
[[deps.CodecZlib]]
36+
deps = ["TranscodingStreams", "Zlib_jll"]
37+
git-tree-sha1 = "962834c22b66e32aa10f7611c08c8ca4e20749a9"
38+
uuid = "944b1d66-785c-5afd-91f1-9de20f533193"
39+
version = "0.7.8"
40+
41+
[[deps.Dates]]
42+
deps = ["Printf"]
43+
uuid = "ade2ca70-3891-5945-98fb-dc099432e06a"
44+
version = "1.11.0"
45+
46+
[[deps.DocStringExtensions]]
47+
git-tree-sha1 = "e7b7e6f178525d17c720ab9c081e4ef04429f860"
48+
uuid = "ffbed154-4ef7-542d-bbb7-c09d3a79fcae"
49+
version = "0.9.4"
50+
51+
[[deps.Documenter]]
52+
deps = ["ANSIColoredPrinters", "AbstractTrees", "Base64", "CodecZlib", "Dates", "DocStringExtensions", "Downloads", "Git", "IOCapture", "InteractiveUtils", "JSON", "LibGit2", "Logging", "Markdown", "MarkdownAST", "Pkg", "PrecompileTools", "REPL", "RegistryInstances", "SHA", "TOML", "Test", "Unicode"]
53+
git-tree-sha1 = "9d733459cea04dcf1c41522ec25c31576387be8a"
54+
uuid = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
55+
version = "1.10.1"
56+
57+
[[deps.Downloads]]
58+
deps = ["ArgTools", "FileWatching", "LibCURL", "NetworkOptions"]
59+
uuid = "f43a241f-c20a-4ad4-852c-f6b1247861c6"
60+
version = "1.6.0"
61+
62+
[[deps.Expat_jll]]
63+
deps = ["Artifacts", "JLLWrappers", "Libdl"]
64+
git-tree-sha1 = "d55dffd9ae73ff72f1c0482454dcf2ec6c6c4a63"
65+
uuid = "2e619515-83b5-522b-bb60-26c02a35a201"
66+
version = "2.6.5+0"
67+
68+
[[deps.FileWatching]]
69+
uuid = "7b1f6079-737a-58dc-b8bc-7a2ca5c1b5ee"
70+
version = "1.11.0"
71+
72+
[[deps.Git]]
73+
deps = ["Git_jll"]
74+
git-tree-sha1 = "04eff47b1354d702c3a85e8ab23d539bb7d5957e"
75+
uuid = "d7ba0133-e1db-5d97-8f8c-041e4b3a1eb2"
76+
version = "1.3.1"
77+
78+
[[deps.Git_jll]]
79+
deps = ["Artifacts", "Expat_jll", "JLLWrappers", "LibCURL_jll", "Libdl", "Libiconv_jll", "OpenSSL_jll", "PCRE2_jll", "Zlib_jll"]
80+
git-tree-sha1 = "2f6d6f7e6d6de361865d4394b802c02fc944fc7c"
81+
uuid = "f8c6e375-362e-5223-8a59-34ff63f689eb"
82+
version = "2.49.0+0"
83+
84+
[[deps.IOCapture]]
85+
deps = ["Logging", "Random"]
86+
git-tree-sha1 = "b6d6bfdd7ce25b0f9b2f6b3dd56b2673a66c8770"
87+
uuid = "b5f81e59-6552-4d32-b1f0-c071b021bf89"
88+
version = "0.2.5"
89+
90+
[[deps.InteractiveUtils]]
91+
deps = ["Markdown"]
92+
uuid = "b77e0a4c-d291-57a0-90e8-8db25a27a240"
93+
version = "1.11.0"
94+
95+
[[deps.JLLWrappers]]
96+
deps = ["Artifacts", "Preferences"]
97+
git-tree-sha1 = "a007feb38b422fbdab534406aeca1b86823cb4d6"
98+
uuid = "692b3bcd-3c85-4b1f-b108-f13ce0eb3210"
99+
version = "1.7.0"
100+
101+
[[deps.JSON]]
102+
deps = ["Dates", "Mmap", "Parsers", "Unicode"]
103+
git-tree-sha1 = "31e996f0a15c7b280ba9f76636b3ff9e2ae58c9a"
104+
uuid = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
105+
version = "0.21.4"
106+
107+
[[deps.JuliaInterpreter]]
108+
deps = ["CodeTracking", "InteractiveUtils", "Random", "UUIDs"]
109+
git-tree-sha1 = "40237fa9a763c6e9e2465191bb09f7dab4b17593"
110+
uuid = "aa1ae85d-cabe-5617-a682-6adf51b2e16a"
111+
version = "0.10.0"
112+
113+
[[deps.JuliaSyntaxHighlighting]]
114+
deps = ["StyledStrings"]
115+
uuid = "ac6e5ff7-fb65-4e79-a425-ec3bc9c03011"
116+
version = "1.12.0"
117+
118+
[[deps.LazilyInitializedFields]]
119+
git-tree-sha1 = "0f2da712350b020bc3957f269c9caad516383ee0"
120+
uuid = "0e77f7df-68c5-4e49-93ce-4cd80f5598bf"
121+
version = "1.3.0"
122+
123+
[[deps.LibCURL]]
124+
deps = ["LibCURL_jll", "MozillaCACerts_jll"]
125+
uuid = "b27032c2-a3e7-50c8-80cd-2d36dbcbfd21"
126+
version = "0.6.4"
127+
128+
[[deps.LibCURL_jll]]
129+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll", "Zlib_jll", "nghttp2_jll"]
130+
uuid = "deac9b47-8bc7-5906-a0fe-35ac56dc84c0"
131+
version = "8.11.1+1"
132+
133+
[[deps.LibGit2]]
134+
deps = ["LibGit2_jll", "NetworkOptions", "Printf", "SHA"]
135+
uuid = "76f85450-5226-5b5a-8eaa-529ad045b433"
136+
version = "1.11.0"
137+
138+
[[deps.LibGit2_jll]]
139+
deps = ["Artifacts", "LibSSH2_jll", "Libdl", "OpenSSL_jll"]
140+
uuid = "e37daf67-58a4-590a-8e99-b0245dd2ffc5"
141+
version = "1.9.0+0"
142+
143+
[[deps.LibSSH2_jll]]
144+
deps = ["Artifacts", "Libdl", "OpenSSL_jll"]
145+
uuid = "29816b5a-b9ab-546f-933c-edad1886dfa8"
146+
version = "1.11.3+1"
147+
148+
[[deps.Libdl]]
149+
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
150+
version = "1.11.0"
151+
152+
[[deps.Libiconv_jll]]
153+
deps = ["Artifacts", "JLLWrappers", "Libdl"]
154+
git-tree-sha1 = "be484f5c92fad0bd8acfef35fe017900b0b73809"
155+
uuid = "94ce4f54-9a6c-5748-9c1c-f9c7231a4531"
156+
version = "1.18.0+0"
157+
158+
[[deps.Logging]]
159+
uuid = "56ddb016-857b-54e1-b83d-db4d58db5568"
160+
version = "1.11.0"
161+
162+
[[deps.LoweredCodeUtils]]
163+
deps = ["JuliaInterpreter"]
164+
path = ".."
165+
uuid = "6f1432cf-f94c-5a45-995e-cdbf5db27b0b"
166+
version = "3.3.0"
167+
168+
[[deps.Markdown]]
169+
deps = ["Base64", "JuliaSyntaxHighlighting", "StyledStrings"]
170+
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
171+
version = "1.11.0"
172+
173+
[[deps.MarkdownAST]]
174+
deps = ["AbstractTrees", "Markdown"]
175+
git-tree-sha1 = "465a70f0fc7d443a00dcdc3267a497397b8a3899"
176+
uuid = "d0879d2d-cac2-40c8-9cee-1863dc0c7391"
177+
version = "0.1.2"
178+
179+
[[deps.Mmap]]
180+
uuid = "a63ad114-7e13-5084-954f-fe012c677804"
181+
version = "1.11.0"
182+
183+
[[deps.MozillaCACerts_jll]]
184+
uuid = "14a3606d-f60d-562e-9121-12d972cd8159"
185+
version = "2024.12.31"
186+
187+
[[deps.NetworkOptions]]
188+
uuid = "ca575930-c2e3-43a9-ace4-1e988b2c1908"
189+
version = "1.3.0"
190+
191+
[[deps.OpenSSL_jll]]
192+
deps = ["Artifacts", "Libdl"]
193+
uuid = "458c3c95-2e84-50aa-8efc-19380b2a3a95"
194+
version = "3.0.16+0"
195+
196+
[[deps.PCRE2_jll]]
197+
deps = ["Artifacts", "Libdl"]
198+
uuid = "efcefdf7-47ab-520b-bdef-62a2eaa19f15"
199+
version = "10.44.0+1"
200+
201+
[[deps.Parsers]]
202+
deps = ["Dates", "PrecompileTools", "UUIDs"]
203+
git-tree-sha1 = "44f6c1f38f77cafef9450ff93946c53bd9ca16ff"
204+
uuid = "69de0a69-1ddd-5017-9359-2bf0b02dc9f0"
205+
version = "2.8.2"
206+
207+
[[deps.Pkg]]
208+
deps = ["Artifacts", "Dates", "Downloads", "FileWatching", "LibGit2", "Libdl", "Logging", "Markdown", "Printf", "Random", "SHA", "TOML", "Tar", "UUIDs", "p7zip_jll"]
209+
uuid = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
210+
version = "1.12.0"
211+
weakdeps = ["REPL"]
212+
213+
[deps.Pkg.extensions]
214+
REPLExt = "REPL"
215+
216+
[[deps.PrecompileTools]]
217+
deps = ["Preferences"]
218+
git-tree-sha1 = "516f18f048a195409d6e072acf879a9f017d3900"
219+
uuid = "aea7be01-6a6a-4083-8856-8a6e6704d82a"
220+
version = "1.3.2"
221+
222+
[[deps.Preferences]]
223+
deps = ["TOML"]
224+
git-tree-sha1 = "9306f6085165d270f7e3db02af26a400d580f5c6"
225+
uuid = "21216c6a-2e73-6563-6e65-726566657250"
226+
version = "1.4.3"
227+
228+
[[deps.Printf]]
229+
deps = ["Unicode"]
230+
uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
231+
version = "1.11.0"
232+
233+
[[deps.REPL]]
234+
deps = ["InteractiveUtils", "JuliaSyntaxHighlighting", "Markdown", "Sockets", "StyledStrings", "Unicode"]
235+
uuid = "3fa0cd96-eef1-5676-8a61-b3b8758bbffb"
236+
version = "1.11.0"
237+
238+
[[deps.Random]]
239+
deps = ["SHA"]
240+
uuid = "9a3f8284-a2c9-5f02-9a11-845980a1fd5c"
241+
version = "1.11.0"
242+
243+
[[deps.RegistryInstances]]
244+
deps = ["LazilyInitializedFields", "Pkg", "TOML", "Tar"]
245+
git-tree-sha1 = "ffd19052caf598b8653b99404058fce14828be51"
246+
uuid = "2792f1a3-b283-48e8-9a74-f99dce5104f3"
247+
version = "0.1.0"
248+
249+
[[deps.SHA]]
250+
uuid = "ea8e919c-243c-51af-8825-aaa63cd721ce"
251+
version = "0.7.0"
252+
253+
[[deps.Serialization]]
254+
uuid = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
255+
version = "1.11.0"
256+
257+
[[deps.Sockets]]
258+
uuid = "6462fe0b-24de-5631-8697-dd941f90decc"
259+
version = "1.11.0"
260+
261+
[[deps.StyledStrings]]
262+
uuid = "f489334b-da3d-4c2e-b8f0-e476e12c162b"
263+
version = "1.11.0"
264+
265+
[[deps.TOML]]
266+
deps = ["Dates"]
267+
uuid = "fa267f1f-6049-4f14-aa54-33bafae1ed76"
268+
version = "1.0.3"
269+
270+
[[deps.Tar]]
271+
deps = ["ArgTools", "SHA"]
272+
uuid = "a4e569a6-e804-4fa4-b0f3-eef7a1d5b13e"
273+
version = "1.10.0"
274+
275+
[[deps.Test]]
276+
deps = ["InteractiveUtils", "Logging", "Random", "Serialization"]
277+
uuid = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
278+
version = "1.11.0"
279+
280+
[[deps.TranscodingStreams]]
281+
git-tree-sha1 = "0c45878dcfdcfa8480052b6ab162cdd138781742"
282+
uuid = "3bb67fe8-82b1-5028-8e26-92a6c54297fa"
283+
version = "0.11.3"
284+
285+
[[deps.UUIDs]]
286+
deps = ["Random", "SHA"]
287+
uuid = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
288+
version = "1.11.0"
289+
290+
[[deps.Unicode]]
291+
uuid = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
292+
version = "1.11.0"
293+
294+
[[deps.Zlib_jll]]
295+
deps = ["Libdl"]
296+
uuid = "83775a58-1f1d-513f-b197-d71354ab007a"
297+
version = "1.3.1+2"
298+
299+
[[deps.nghttp2_jll]]
300+
deps = ["Artifacts", "Libdl"]
301+
uuid = "8e850ede-7688-5339-a07c-302acd2aaf8d"
302+
version = "1.64.0+1"
303+
304+
[[deps.p7zip_jll]]
305+
deps = ["Artifacts", "Libdl"]
306+
uuid = "3f19e933-33d8-53b3-aaab-bd5110c3b7a0"
307+
version = "17.5.0+2"

docs/src/api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ selective_eval!
1919
selective_eval_fromstart!
2020
```
2121

22+
## Interpreter
23+
24+
```@docs
25+
LoweredCodeUtils.SelectiveInterpreter
26+
```
27+
2228
## Internal utilities
2329

2430
```@docs

src/LoweredCodeUtils.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ module LoweredCodeUtils
1010
# the VS Code extension integration.
1111

1212
using JuliaInterpreter
13-
using JuliaInterpreter: SSAValue, SlotNumber, Frame
13+
using JuliaInterpreter: SSAValue, SlotNumber, Frame, Interpreter, RecursiveInterpreter
1414
using JuliaInterpreter: codelocation, is_global_ref, is_global_ref_egal, is_quotenode_egal, is_return,
1515
lookup, lookup_return, linetable, moduleof, next_until!, nstatements, pc_expr,
16-
step_expr!, whichtt, finish_and_return!
16+
step_expr!, whichtt
1717

1818
include("packagedef.jl")
1919

0 commit comments

Comments
 (0)