forked from ocaml/ocaml
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathframe_descriptors.h
71 lines (54 loc) · 2.68 KB
/
frame_descriptors.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**************************************************************************/
/* */
/* OCaml */
/* */
/* KC Sivaramakrishnan, Indian Institute of Technology, Madras */
/* Tom Kelly, OCaml Labs Consultancy */
/* Stephen Dolan, University of Cambridge */
/* */
/* Copyright 2019 Indian Institute of Technology, Madras */
/* Copyright 2021 OCaml Labs Consultancy Ltd */
/* Copyright 2019 University of Cambridge */
/* */
/* All rights reserved. This file is distributed under the terms of */
/* the GNU Lesser General Public License version 2.1, with the */
/* special exception on linking described in the file LICENSE. */
/* */
/**************************************************************************/
#ifndef CAML_FRAME_DESCRIPTORS_H
#define CAML_FRAME_DESCRIPTORS_H
#ifdef CAML_INTERNALS
#include "config.h"
#define Hash_retaddr(addr, mask) \
(((uintnat)(addr) >> 3) & (mask))
/* Structure of frame descriptors */
typedef struct {
uintnat retaddr;
unsigned short frame_size;
unsigned short num_live;
unsigned short live_ofs[1 /* num_live */];
/*
If frame_size & 1, then debug info follows:
uint32_t debug_info_offset;
Debug info is stored as a relative offset to a debuginfo structure. */
} frame_descr;
/* Allocation lengths are encoded as 0-255, giving sizes 1-256 */
#define Wosize_encoded_alloc_len(n) ((uintnat)(n) + 1)
/* Used to compute offsets in frame tables.
ty must have power-of-2 size */
#define Align_to(p, ty) \
(void*)(((uintnat)(p) + sizeof(ty) - 1) & -sizeof(ty))
void caml_init_frame_descriptors(void);
void caml_register_frametable(intnat *table);
typedef struct {
frame_descr** descriptors;
int mask;
} caml_frame_descrs;
caml_frame_descrs caml_get_frame_descrs(void);
/* Find the current table of frame descriptors.
The resulting structure is only valid until the next GC */
frame_descr* caml_find_frame_descr(caml_frame_descrs fds, uintnat pc);
frame_descr * caml_next_frame_descriptor
(caml_frame_descrs fds, uintnat * pc, char ** sp, struct stack_info* stack);
#endif /* CAML_INTERNALS */
#endif /* CAML_FRAME_DESCRIPTORS_H */