perf: prevent unnecessary allocations of EST.Out.ok (#13163)
This commit is contained in:
parent
ae19b3e248
commit
8c0bb68ee5
3 changed files with 16 additions and 0 deletions
|
|
@ -717,20 +717,25 @@ def recordSynthPendingFailure (type : Expr) : MetaM Unit := do
|
|||
modifyDiag fun { unfoldCounter, unfoldAxiomCounter, heuristicCounter, instanceCounter, synthPendingFailures } =>
|
||||
{ unfoldCounter, unfoldAxiomCounter, heuristicCounter, instanceCounter, synthPendingFailures := synthPendingFailures.insert type msg }
|
||||
|
||||
@[inline]
|
||||
def getLocalInstances : MetaM LocalInstances :=
|
||||
return (← read).localInstances
|
||||
|
||||
@[inline]
|
||||
def getConfig : MetaM Config :=
|
||||
return (← read).config
|
||||
|
||||
@[inline]
|
||||
def getConfigWithKey : MetaM ConfigWithKey :=
|
||||
return (← getConfig).toConfigWithKey
|
||||
|
||||
/-- Return the array of postponed universe level constraints. -/
|
||||
@[inline]
|
||||
def getPostponed : MetaM (PersistentArray PostponedEntry) :=
|
||||
return (← get).postponed
|
||||
|
||||
/-- Set the array of postponed universe level constraints. -/
|
||||
@[inline]
|
||||
def setPostponed (postponed : PersistentArray PostponedEntry) : MetaM Unit :=
|
||||
modify fun s => { s with postponed := postponed }
|
||||
|
||||
|
|
@ -904,12 +909,15 @@ def mkConstWithFreshMVarLevels (declName : Name) : MetaM Expr := do
|
|||
return mkConst declName (← mkFreshLevelMVarsFor info)
|
||||
|
||||
/-- Return current transparency setting/mode. -/
|
||||
@[inline]
|
||||
def getTransparency : MetaM TransparencyMode :=
|
||||
return (← getConfig).transparency
|
||||
|
||||
@[inline]
|
||||
def shouldReduceAll : MetaM Bool :=
|
||||
return (← getTransparency) == TransparencyMode.all
|
||||
|
||||
@[inline]
|
||||
def shouldReduceReducibleOnly : MetaM Bool :=
|
||||
return (← getTransparency) == TransparencyMode.reducible
|
||||
|
||||
|
|
|
|||
|
|
@ -445,27 +445,33 @@ unsafe def MethodsRef.toMethodsImpl (m : MethodsRef) : Methods :=
|
|||
@[implemented_by MethodsRef.toMethodsImpl]
|
||||
opaque MethodsRef.toMethods (m : MethodsRef) : Methods
|
||||
|
||||
@[inline]
|
||||
def getMethods : SimpM Methods :=
|
||||
return MethodsRef.toMethods (← read)
|
||||
|
||||
@[inline]
|
||||
def pre (e : Expr) : SimpM Step := do
|
||||
(← getMethods).pre e
|
||||
|
||||
@[inline]
|
||||
def post (e : Expr) : SimpM Step := do
|
||||
(← getMethods).post e
|
||||
|
||||
@[inline] def getContext : SimpM Context :=
|
||||
readThe Context
|
||||
|
||||
@[inline]
|
||||
def getConfig : SimpM Config :=
|
||||
return (← getContext).config
|
||||
|
||||
@[inline] def withParent (parent : Expr) (f : SimpM α) : SimpM α :=
|
||||
withTheReader Context (fun ctx => { ctx with parent? := parent }) f
|
||||
|
||||
@[inline]
|
||||
def getSimpTheorems : SimpM SimpTheoremsArray :=
|
||||
return (← readThe Context).simpTheorems
|
||||
|
||||
@[inline]
|
||||
def getSimpCongrTheorems : SimpM SimpCongrTheorems :=
|
||||
return (← readThe Context).congrTheorems
|
||||
|
||||
|
|
@ -473,6 +479,7 @@ def getSimpCongrTheorems : SimpM SimpCongrTheorems :=
|
|||
Returns `true` if `simp` is in `dsimp` mode.
|
||||
That is, only transformations that preserve definitional equality should be applied.
|
||||
-/
|
||||
@[inline]
|
||||
def inDSimp : SimpM Bool :=
|
||||
return (← readThe Context).inDSimp
|
||||
|
||||
|
|
|
|||
|
|
@ -114,6 +114,7 @@ where
|
|||
false
|
||||
|
||||
/-- Determine if tracing is available for a given class, checking ancestor classes if appropriate. -/
|
||||
@[inline]
|
||||
def isTracingEnabledFor (cls : Name) : m Bool := do
|
||||
return checkTraceOption (← MonadTrace.getInheritedTraceOptions) (← getOptions) cls
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue