1 /* Copyright (C) 1999-2005 Henry Cejtin, Matthew Fluet, Suresh
2 * Jagannathan, and Stephen Weeks.
3 * Copyright (C) 1997-2000 NEC Research Institute.
5 * MLton is released under a BSD-style license.
6 * See the file MLton-LICENSE for details.
9 void numStackFramesAux (GC_state s
,
10 __attribute__ ((unused
)) GC_frameIndex i
) {
11 s
->callStackState
.numStackFrames
++;
14 uint32_t GC_numStackFrames (GC_state s
) {
15 s
->callStackState
.numStackFrames
= 0;
16 foreachStackFrame (s
, numStackFramesAux
);
18 fprintf (stderr
, "%"PRIu32
" = GC_numStackFrames\n",
19 s
->callStackState
.numStackFrames
);
20 return s
->callStackState
.numStackFrames
;
23 void callStackAux (GC_state s
, GC_frameIndex i
) {
25 fprintf (stderr
, "callStackAux ("FMTFI
")\n", i
);
26 s
->callStackState
.callStack
[s
->callStackState
.numStackFrames
] = i
;
27 s
->callStackState
.numStackFrames
++;
30 void GC_callStack (GC_state s
, pointer p
) {
32 fprintf (stderr
, "GC_callStack\n");
33 s
->callStackState
.numStackFrames
= 0;
34 s
->callStackState
.callStack
= (uint32_t*)p
;
35 foreachStackFrame (s
, callStackAux
);
38 uint32_t* GC_frameIndexSourceSeq (GC_state s
, GC_frameIndex frameIndex
) {
41 res
= s
->sourceMaps
.sourceSeqs
[s
->sourceMaps
.frameSources
[frameIndex
]];
43 fprintf (stderr
, FMTPTR
" = GC_frameIndexSourceSeq ("FMTFI
")\n",
44 (uintptr_t)res
, frameIndex
);