diff --git a/mps/manual/source/glossary/i.rst b/mps/manual/source/glossary/i.rst index cbead73fa0c..8e1fc7928de 100644 --- a/mps/manual/source/glossary/i.rst +++ b/mps/manual/source/glossary/i.rst @@ -231,7 +231,8 @@ Memory Management Glossary: I .. mps:specific:: - This is achieved by the :term:`allocation point protocol`. + This is achieved by the + :ref:`topic-allocation-point-protocol`. inline allocation (2) diff --git a/mps/manual/source/guide/lang.rst b/mps/manual/source/guide/lang.rst index e4153a9f9c0..cf99be5a32b 100644 --- a/mps/manual/source/guide/lang.rst +++ b/mps/manual/source/guide/lang.rst @@ -1035,9 +1035,10 @@ MPS attempts to scan ``obj`` at the indicated point, the object's ``type`` field will be uninitialized, and so the :term:`scan method` may abort. -The MPS solves this problem via the :term:`allocation point protocol`. -This needs an additional structure, an :term:`allocation point`, to be -attached to the pool by calling :c:func:`mps_ap_create`:: +The MPS solves this problem via the +:ref:`topic-allocation-point-protocol`. This needs an additional +structure, an :term:`allocation point`, to be attached to the pool by +calling :c:func:`mps_ap_create`:: static mps_ap_t obj_ap; @@ -1091,8 +1092,8 @@ we have to initialize the object again (most conveniently done via a .. note:: - 1. When using the allocation point protocol it is up to you to - ensure that the requested size is aligned, because + 1. When using the :ref:`topic-allocation-point-protocol` it is up + to you to ensure that the requested size is aligned, because :c:func:`mps_reserve` is on the MPS's :term:`critical path`, and so it is highly optimized: in nearly all cases it is just an increment to a pointer. diff --git a/mps/manual/source/topic/allocation.rst b/mps/manual/source/topic/allocation.rst index 2919472c1ab..3d979d48e5c 100644 --- a/mps/manual/source/topic/allocation.rst +++ b/mps/manual/source/topic/allocation.rst @@ -86,8 +86,7 @@ Allocation points free>` allocation. They allow code to allocate without calling an allocation function: this is vital for performance in languages or programs that allocate many small objects. They must be used according -to the :ref:`allocation point protocol -`. +to the :ref:`topic-allocation-point-protocol`. .. c:type:: mps_ap_t @@ -143,8 +142,8 @@ to the :ref:`allocation point protocol .. _topic-allocation-point-protocol: -The allocation point protocol ------------------------------ +Allocation point protocol +------------------------- This protocol is designed to work with :term:`incremental garbage collection` and multiple :term:`threads `, where between any @@ -267,7 +266,7 @@ It is not necessary to worry about going around this loop many times: .. note:: :c:func:`mps_reserve` must only be called according to the - :term:`allocation point protocol`. + :ref:`topic-allocation-point-protocol`. :c:func:`mps_reserve` is implemented as a macro for speed. It may evaluate its arguments multiple times. @@ -326,7 +325,7 @@ It is not necessary to worry about going around this loop many times: .. note:: :c:func:`mps_commit` must only be called according to the - :term:`allocation point protocol`. + :ref:`topic-allocation-point-protocol`. :c:func:`mps_commit` is implemented as a macro for speed. It may evaluate its arguments multiple times. @@ -571,21 +570,21 @@ branch prediction should work well since the test almost never fails). .. c:type:: mps_ap_s - The type of the structure used to represent :term:`allocation - points `:: + The type of the structure used to represent :term:`allocation + points `:: - typedef struct mps_ap_s { - mps_addr_t init; - mps_addr_t alloc; - mps_addr_t limit; - /* ... private fields ... */ - } mps_ap_s; + typedef struct mps_ap_s { + mps_addr_t init; + mps_addr_t alloc; + mps_addr_t limit; + /* ... private fields ... */ + } mps_ap_s; - ``init`` is the limit of initialized memory. + ``init`` is the limit of initialized memory. - ``alloc`` is the limit of allocated memory. + ``alloc`` is the limit of allocated memory. - ``limit`` is the limit of available memory. + ``limit`` is the limit of available memory. An allocation point is an interface to a :term:`pool` which provides very fast allocation, and defers the need for @@ -605,7 +604,7 @@ branch prediction should work well since the test almost never fails). .. note:: :c:func:`mps_ap_fill` must only be called according to the - :term:`allocation point protocol`. + :ref:`topic-allocation-point-protocol`. .. c:function:: mps_bool_t mps_ap_trip(mps_ap_t ap, mps_addr_t p, size_t size) @@ -618,4 +617,4 @@ branch prediction should work well since the test almost never fails). .. note:: :c:func:`mps_ap_trip` must only be called according to the - :term:`allocation point protocol`. + :ref:`topic-allocation-point-protocol`.