Skip to content

Commit

Permalink
Mark regex fns as nofree (EnzymeAD#1654)
Browse files Browse the repository at this point in the history
* Mark regex fns as nofree

* more pcre
  • Loading branch information
wsmoses authored Jul 21, 2024
1 parent 87338e4 commit 1e15769
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/compiler.jl
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,13 @@ end
end

const nofreefns = Set{String}((
"pcre2_match_8",
"julia.gcroot_flush",
"pcre2_jit_stack_assign_8",
"pcre2_match_context_create_8",
"pcre2_jit_stack_create_8",
"ijl_gc_enable_finalizers_internal", "jl_gc_enable_finalizers_internal",
"pcre2_match_data_create_from_pattern_8",
"ijl_gc_run_pending_finalizers", "jl_gc_run_pending_finalizers",
"ijl_typeassert", "jl_typeassert",
"ijl_f_isdefined", "jl_f_isdefined",
Expand Down Expand Up @@ -239,6 +246,7 @@ const nofreefns = Set{String}((
))

const inactivefns = Set{String}((
"pcre2_match_data_create_from_pattern_8",
"ijl_typeassert", "jl_typeassert",
"ijl_f_isdefined", "jl_f_isdefined",
"ijl_field_index", "jl_field_index",
Expand Down
3 changes: 3 additions & 0 deletions src/internal_rules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,9 @@ end
function EnzymeRules.inactive_noinl(::typeof(Base.hasproperty), args...)
return nothing
end
function EnzymeRules.inactive(::typeof(Base.startswith), ::AbstractString, args...)
return nothing
end

if VERSION >= v"1.9"
Enzyme.EnzymeRules.inactive_noinl(::typeof(Core._compute_sparams), args...) = nothing
Expand Down
2 changes: 1 addition & 1 deletion src/rules/typeunstablerules.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1423,7 +1423,7 @@ function common_finalizer_fwd(offset, B, orig, gutils, normalR, shadowR)
return false
end

function common_finalizer_augfwd(offset, B, orig, gutils, normalR, shadowR)
function common_finalizer_augfwd(offset, B, orig, gutils, normalR, shadowR, tapeR)
if is_constant_value(gutils, orig) && is_constant_inst(gutils, orig)
return true
end
Expand Down

0 comments on commit 1e15769

Please sign in to comment.