ARC: cycle detector (#12823)
* first implementation of the =trace and =dispose hooks for the cycle collector * a cycle collector for ARC: progress * manual: the .acyclic pragma is a thing once again * gcbench: adaptations for --gc:arc * enable valgrind tests for the strutils tests * testament: better valgrind support * ARC refactoring: growable jumpstacks * ARC cycle detector: non-recursive algorithm * moved and renamed core/ files back to system/ * refactoring: --gc:arc vs --gc:orc since 'orc' is even more experimental and we want to ship --gc:arc soonish
This commit is contained in:
parent
5848f0042c
commit
83a736a34a
45 changed files with 939 additions and 229 deletions
|
|
@ -6017,8 +6017,32 @@ The ``noreturn`` pragma is used to mark a proc that never returns.
|
|||
|
||||
acyclic pragma
|
||||
--------------
|
||||
The ``acyclic`` pragma applies to type declarations. It is deprecated and
|
||||
ignored.
|
||||
The ``acyclic`` pragma can be used for object types to mark them as acyclic
|
||||
even though they seem to be cyclic. This is an **optimization** for the garbage
|
||||
collector to not consider objects of this type as part of a cycle:
|
||||
|
||||
.. code-block:: nim
|
||||
type
|
||||
Node = ref NodeObj
|
||||
NodeObj {.acyclic.} = object
|
||||
left, right: Node
|
||||
data: string
|
||||
|
||||
Or if we directly use a ref object:
|
||||
|
||||
.. code-block:: nim
|
||||
type
|
||||
Node {.acyclic.} = ref object
|
||||
left, right: Node
|
||||
data: string
|
||||
|
||||
In the example a tree structure is declared with the ``Node`` type. Note that
|
||||
the type definition is recursive and the GC has to assume that objects of
|
||||
this type may form a cyclic graph. The ``acyclic`` pragma passes the
|
||||
information that this cannot happen to the GC. If the programmer uses the
|
||||
``acyclic`` pragma for data types that are in reality cyclic, the memory leaks
|
||||
can be the result, but memory safety is preserved.
|
||||
|
||||
|
||||
|
||||
final pragma
|
||||
|
|
|
|||
|
|
@ -237,8 +237,8 @@ This uses the configuration defined in ``config\nim.cfg`` for ``lvm_gcc``.
|
|||
If nimcache already contains compiled code from a different compiler for the same project,
|
||||
add the ``-f`` flag to force all files to be recompiled.
|
||||
|
||||
The default compiler is defined at the top of ``config\nim.cfg``. Changing this setting
|
||||
affects the compiler used by ``koch`` to (re)build Nim.
|
||||
The default compiler is defined at the top of ``config\nim.cfg``.
|
||||
Changing this setting affects the compiler used by ``koch`` to (re)build Nim.
|
||||
|
||||
|
||||
Cross compilation
|
||||
|
|
@ -557,9 +557,9 @@ For example, to generate code for an `AVR`:idx: processor use this command::
|
|||
For the ``standalone`` target one needs to provide
|
||||
a file ``panicoverride.nim``.
|
||||
See ``tests/manyloc/standalone/panicoverride.nim`` for an example
|
||||
implementation. Additionally, users should specify the
|
||||
implementation. Additionally, users should specify the
|
||||
amount of heap space to use with the ``-d:StandaloneHeapSize=<size>``
|
||||
command line switch. Note that the total heap size will be
|
||||
command line switch. Note that the total heap size will be
|
||||
``<size> * sizeof(float64)``.
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue