Skip to content

Commit

Permalink
make Base.donotdelete a generic function
Browse files Browse the repository at this point in the history
  • Loading branch information
LilithHafner committed Nov 4, 2024
1 parent bfa9132 commit 680ce5a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 4 additions & 4 deletions base/docs/basedocs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -3705,11 +3705,11 @@ unused and delete the entire benchmark code).
the code is semantically equivalent to `donotdelete(2).`
!!! note
This intrinsic does not affect the semantics of code that is dead because it is
This function does not affect the semantics of code that is dead because it is
*unreachable*. For example, the body of the function `f(x) = false && donotdelete(x)`
may be deleted in its entirety. The semantics of this intrinsic only guarantee that
*if* the intrinsic is semantically executed, then there is some program state at
which the value of the arguments of this intrinsic were available (in a register,
may be deleted in its entirety. The semantics of this function only guarantee that
*if* the function is semantically executed, then there is some program state at
which the value of the arguments of this function were available (in a register,
in memory, etc.).
# Examples
Expand Down
4 changes: 3 additions & 1 deletion base/essentials.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

using Core: CodeInfo, SimpleVector, donotdelete, compilerbarrier, memoryrefnew, memoryrefget, memoryrefset!
using Core: CodeInfo, SimpleVector, compilerbarrier, memoryrefnew, memoryrefget, memoryrefset!

const Callable = Union{Function,Type}

Expand Down Expand Up @@ -1261,3 +1261,5 @@ typename(typeof(function < end)).constprop_heuristic = Core.SAMETYPE_HEURISTIC
typename(typeof(function > end)).constprop_heuristic = Core.SAMETYPE_HEURISTIC
typename(typeof(function << end)).constprop_heuristic = Core.SAMETYPE_HEURISTIC
typename(typeof(function >> end)).constprop_heuristic = Core.SAMETYPE_HEURISTIC

donotdelete(args...) = Core.donotdelete(args...)

0 comments on commit 680ce5a

Please sign in to comment.