-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Labels
documentationneeds analaysisThe issue needs analysis before it can be resolved.The issue needs analysis before it can be resolved.optionalWill cause failures / of benefit. Worth assigning resources.Will cause failures / of benefit. Worth assigning resources.
Description
The manual advises the use of a stack marker to find the cold end of the stack:
mps/manual/source/guide/lang.rst
Lines 984 to 995 in 179341b
| void *marker = ▮ | |
| mps_root_t stack_root; | |
| res = mps_root_create_thread(&stack_root, arena, thread, marker); | |
| if (res != MPS_RES_OK) error("Couldn't create stack root"); | |
| In order to scan the control stack, the MPS needs to know where the | |
| :term:`cold end` of the stack is, and that's the role of the | |
| :c:data:`marker` variable: the compiler places it on the stack, so its | |
| address is a position within the stack. As long as you don't exit from | |
| this function while the MPS is running, your program's active local | |
| variables will always be placed on the stack after :c:data:`marker`, | |
| and so will be scanned for references by the MPS. |
Is this advice reliable with current compiler optimisations on our target platforms?
We should check and record our justification for it. We should also test for it, for example, by asserting about it in our tests, so that we are warned if it ever becomes false.
Incidentally, on this topic, design.mps.stack-scan.req.stack.cold.not says:
Lines 48 to 50 in 179341b
| _`.req.stack.cold.not`: There is no requirement to locate the cold end | |
| of the stack. (The mutator supplies this as an argument to | |
| ``mps_root_create_thread()``.) |
Metadata
Metadata
Assignees
Labels
documentationneeds analaysisThe issue needs analysis before it can be resolved.The issue needs analysis before it can be resolved.optionalWill cause failures / of benefit. Worth assigning resources.Will cause failures / of benefit. Worth assigning resources.