Skip to content

Commit 24b3d4b

Browse files
KDr2yebai
andauthored
workaround for code coverage (#146)
* workaround for code coverage * remove CodeInfoTools * add comments * Update Project.toml Co-authored-by: Hong Ge <[email protected]>
1 parent 330fb82 commit 24b3d4b

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

Diff for: .github/workflows/Testing.yaml

-2
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,3 @@ jobs:
4242
${{ runner.os }}-
4343
- uses: julia-actions/julia-buildpkg@latest
4444
- uses: julia-actions/julia-runtest@latest
45-
with:
46-
coverage: false

Diff for: Project.toml

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,16 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
33
license = "MIT"
44
desc = "Tape based task copying in Turing"
55
repo = "https://github.com/TuringLang/Libtask.jl.git"
6-
version = "0.7.2"
6+
version = "0.7.3"
77

88
[deps]
9-
CodeInfoTools = "bc773b8a-8374-437a-b9f2-0e9785855863"
109
FunctionWrappers = "069b7b12-0de2-55c6-9aab-29f3d0a68a2e"
1110
LRUCache = "8ac3fa9e-de4c-5943-b1dc-09c6b5f20637"
1211
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
1312
Statistics = "10745b16-79ce-11e8-11f9-7d13ad32a3b2"
1413

1514
[compat]
1615
FunctionWrappers = "1.1"
17-
CodeInfoTools = "0.3.4"
1816
LRUCache = "1.3"
1917
julia = "1.7"
2018

Diff for: src/Libtask.jl

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
module Libtask
22

3-
using CodeInfoTools
43
using FunctionWrappers: FunctionWrapper
54
using LRUCache
65

Diff for: src/tapedfunction.jl

+9-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,14 @@
33
abstract type AbstractInstruction end
44
const RawTape = Vector{AbstractInstruction}
55

6+
function _infer(f, args_type)
7+
# `code_typed` returns a vector: [Pair{Core.CodeInfo, DataType}]
8+
ir0 = code_typed(f, Tuple{args_type...}, optimize=false)[1][1]
9+
# ir1 = CodeInfoTools.code_inferred(f, args_type...)
10+
# ir1.ssavaluetypes = ir0.ssavaluetypes
11+
return ir0
12+
end
13+
614
mutable struct TapedFunction{F, TapeType}
715
func::F # maybe a function, a constructor, or a callable object
816
arity::Int
@@ -22,8 +30,7 @@ mutable struct TapedFunction{F, TapeType}
2230
tf.counter = 1
2331
return tf
2432
end
25-
26-
ir = CodeInfoTools.code_inferred(f, args_type...)
33+
ir = _infer(f, args_type)
2734
bindings, tape = translate!(RawTape(), ir)
2835

2936
tf = new{F, T}(f, length(args), ir, tape, 1, bindings, :none)

0 commit comments

Comments
 (0)