blob: d881682e7dab002b58d10826c831f5f70de68c31 (
plain)
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
72
73
74
75
76
77
78
79
80
81
|
/* -----------------------------------------------------------------------------
*
* (c) The GHC Team, 1998-2000
*
* Support for mapping info table pointers to source locations
*
* ---------------------------------------------------------------------------*/
#include "PosixSource.h"
#include "Rts.h"
#include "RtsUtils.h"
#include "Profiling.h"
#include "Arena.h"
#include "IPE.h"
#include "Printer.h"
#include "Capability.h"
#include <fs_rts.h>
#include <string.h>
#if defined(TRACING)
#include "Trace.h"
#endif
InfoProvEnt *IPE_LIST = NULL;
void dumpIPEToEventLog(void)
{
#if defined(TRACING)
InfoProvEnt *ip, *next;
for (ip = IPE_LIST; ip != NULL; ip = next) {
next = ip->link;
traceIPE(ip->info, ip->prov.table_name, ip->prov.closure_desc, ip->prov.ty_desc
, ip->prov.label, ip->prov.module, ip->prov.srcloc);
}
#endif
return;
}
/* -----------------------------------------------------------------------------
Registering IPEs
Registering a IPE consists of linking it onto the list of registered IPEs
IPEs are registered at startup by a C constructor function
generated by the compiler (ProfInit.hs) in the _stub.c file for each module.
-------------------------------------------------------------------------- */
static void
registerInfoProvEnt(InfoProvEnt *ipe)
{
ASSERT(ipe->link == NULL);
ipe->link = IPE_LIST;
IPE_LIST = ipe;
}
void registerInfoProvList(InfoProvEnt **ent_list)
{
for (InfoProvEnt **i = ent_list; *i != NULL; i++) {
registerInfoProvEnt(*i);
}
}
// MP: TODO: This should not be a linear search, need to improve
// the IPE_LIST structure
InfoProvEnt * lookupIPE(StgInfoTable *info)
{
InfoProvEnt *ip, *next;
for (ip = IPE_LIST; ip != NULL; ip = next) {
if (ip->info == info) {
return ip;
}
next = ip->link;
}
return NULL;
}
|