1 (* Copyright (C
) 2017 Matthew Fluet
.
2 * Copyright (C
) 2004-2007 Henry Cejtin
, Matthew Fluet
, Suresh
3 * Jagannathan
, and Stephen Weeks
.
5 * MLton is released under a BSD
-style license
.
6 * See the file MLton
-LICENSE for details
.
9 structure MLtonCallStack
=
11 open Primitive
.MLton
.CallStack
13 val gcState
= Primitive
.MLton
.GCState
.gcState
14 structure Pointer
= MLtonPointer
16 val current
: unit
-> t
=
19 then T (Array
.array (0, 0wx0
))
22 val a
= Array
.alloc (Word32
.toInt (numStackFrames gcState
))
23 val () = callStack (gcState
, a
)
28 val toStrings
: t
-> string list
=
34 val skip
= Array
.length a
- 1
37 (fn (i
, frameIndex
, ac
) =>
42 val p
= frameIndexSourceSeq (gcState
, frameIndex
)
43 val max
= Int32
.toInt (Pointer
.getInt32 (p
, 0))
48 CUtil
.C_String
.toString (sourceName (gcState
, Pointer
.getWord32 (p
, j
)))