Skip to content

Commit

Permalink
workaround for code coverage (#146)
Browse files Browse the repository at this point in the history
* workaround for code coverage

* remove CodeInfoTools

* add comments

* Update Project.toml

Co-authored-by: Hong Ge <[email protected]>
  • Loading branch information
KDr2 and yebai authored May 23, 2022
1 parent 330fb82 commit 24b3d4b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/Testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,5 +42,3 @@ jobs:
${{ runner.os }}-
- uses: julia-actions/julia-buildpkg@latest
- uses: julia-actions/julia-runtest@latest
with:
coverage: false
4 changes: 1 addition & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@ uuid = "6f1fad26-d15e-5dc8-ae53-837a1d7b8c9f"
license = "MIT"
desc = "Tape based task copying in Turing"
repo = "https://github.com/TuringLang/Libtask.jl.git"
version = "0.7.2"
version = "0.7.3"

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

[compat]
FunctionWrappers = "1.1"
CodeInfoTools = "0.3.4"
LRUCache = "1.3"
julia = "1.7"

Expand Down
1 change: 0 additions & 1 deletion src/Libtask.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
module Libtask

using CodeInfoTools
using FunctionWrappers: FunctionWrapper
using LRUCache

Expand Down
11 changes: 9 additions & 2 deletions src/tapedfunction.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
abstract type AbstractInstruction end
const RawTape = Vector{AbstractInstruction}

function _infer(f, args_type)
# `code_typed` returns a vector: [Pair{Core.CodeInfo, DataType}]
ir0 = code_typed(f, Tuple{args_type...}, optimize=false)[1][1]
# ir1 = CodeInfoTools.code_inferred(f, args_type...)
# ir1.ssavaluetypes = ir0.ssavaluetypes
return ir0
end

mutable struct TapedFunction{F, TapeType}
func::F # maybe a function, a constructor, or a callable object
arity::Int
Expand All @@ -22,8 +30,7 @@ mutable struct TapedFunction{F, TapeType}
tf.counter = 1
return tf
end

ir = CodeInfoTools.code_inferred(f, args_type...)
ir = _infer(f, args_type)
bindings, tape = translate!(RawTape(), ir)

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

2 comments on commit 24b3d4b

@yebai
Copy link
Member

@yebai yebai commented on 24b3d4b May 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/60845

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.3 -m "<description of version>" 24b3d4b55d3d6f7687f7e40ccce4b27133183950
git push origin v0.7.3

Please sign in to comment.