ARC related bugfixes and refactorings (#12781)
This commit is contained in:
parent
9b0e874687
commit
3fbb3bfd3f
11 changed files with 381 additions and 367 deletions
|
|
@ -3218,6 +3218,9 @@ proc `<`*[T: tuple](x, y: T): bool =
|
|||
const
|
||||
usesDestructors = defined(gcDestructors) or defined(gcHooks)
|
||||
|
||||
when not usesDestructors:
|
||||
{.pragma: nodestroy.}
|
||||
|
||||
when not defined(nimscript) and hasAlloc:
|
||||
type
|
||||
GC_Strategy* = enum ## The strategy the GC should use for the application.
|
||||
|
|
@ -3671,8 +3674,6 @@ when not defined(JS): #and not defined(nimscript):
|
|||
prev: PSafePoint # points to next safe point ON THE STACK
|
||||
status: int
|
||||
context: C_JmpBuf
|
||||
hasRaiseAction: bool
|
||||
raiseAction: proc (e: ref Exception): bool {.closure.}
|
||||
SafePoint = TSafePoint
|
||||
|
||||
when declared(initAllocator):
|
||||
|
|
@ -3776,11 +3777,15 @@ when not defined(JS): #and not defined(nimscript):
|
|||
## Retrieves the current exception; if there is none, `nil` is returned.
|
||||
result = currException
|
||||
|
||||
proc nimBorrowCurrentException(): ref Exception {.compilerRtl, inl, benign, nodestroy.} =
|
||||
# .nodestroy here so that we do not produce a write barrier as the
|
||||
# C codegen only uses it in a borrowed way:
|
||||
result = currException
|
||||
|
||||
proc getCurrentExceptionMsg*(): string {.inline, benign.} =
|
||||
## Retrieves the error message that was attached to the current
|
||||
## exception; if there is none, `""` is returned.
|
||||
var e = getCurrentException()
|
||||
return if e == nil: "" else: e.msg
|
||||
return if currException == nil: "" else: currException.msg
|
||||
|
||||
proc setCurrentException*(exc: ref Exception) {.inline, benign.} =
|
||||
## Sets the current exception.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue