Import Debian changes 20180207-1
[hcoop/debian/mlton.git] / runtime / gc / frame.c
1 /* Copyright (C) 1999-2006 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
4 *
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
7 */
8
9 GC_frameIndex getFrameIndexFromReturnAddress (GC_state s, GC_returnAddress ra) {
10 GC_frameIndex res;
11
12 res = s->returnAddressToFrameIndex (ra);
13 if (DEBUG_DETAILED)
14 fprintf (stderr, FMTFI" = getFrameIndexFromReturnAddress ("FMTRA")\n",
15 res, ra);
16 return res;
17 }
18
19 GC_frameLayout getFrameLayoutFromFrameIndex (GC_state s, GC_frameIndex findex) {
20 GC_frameLayout layout;
21
22 if (DEBUG_DETAILED)
23 fprintf (stderr, "findex = "FMTFI" frameLayoutsLength = %"PRIu32"\n",
24 findex, s->frameLayoutsLength);
25 assert (findex < s->frameLayoutsLength);
26 layout = &(s->frameLayouts[findex]);
27 assert (layout->size > 0);
28 return layout;
29 }
30
31 GC_frameLayout getFrameLayoutFromReturnAddress (GC_state s, GC_returnAddress ra) {
32 GC_frameLayout layout;
33 GC_frameIndex findex;
34
35 findex = getFrameIndexFromReturnAddress (s, ra);
36 layout = getFrameLayoutFromFrameIndex(s, findex);
37 return layout;
38 }