aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/beam
diff options
context:
space:
mode:
authorBjörn-Egil Dahlberg <[email protected]>2012-02-07 19:19:27 +0100
committerPatrik Nyblom <[email protected]>2012-03-22 18:16:13 +0100
commit0fd4e39abeea3fc87b78eec8495109f9245b5ac8 (patch)
treee4e8de912a44e58d0f5e1d108ce3e8d9ed822558 /erts/emulator/beam
parentad6387b0242caa2b3c64d62a133752e10546211b (diff)
downloadotp-0fd4e39abeea3fc87b78eec8495109f9245b5ac8.tar.gz
otp-0fd4e39abeea3fc87b78eec8495109f9245b5ac8.tar.bz2
otp-0fd4e39abeea3fc87b78eec8495109f9245b5ac8.zip
Update dtrace for changes in R15
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r--erts/emulator/beam/beam_emu.c85
-rw-r--r--erts/emulator/beam/dist.c16
-rw-r--r--erts/emulator/beam/dtrace-wrapper.h9
-rw-r--r--erts/emulator/beam/erl_async.c10
-rw-r--r--erts/emulator/beam/erl_gc.c1
-rw-r--r--erts/emulator/beam/erl_message.c12
-rw-r--r--erts/emulator/beam/global.h69
7 files changed, 103 insertions, 99 deletions
diff --git a/erts/emulator/beam/beam_emu.c b/erts/emulator/beam/beam_emu.c
index d0beccfda2..1dbe2cad00 100644
--- a/erts/emulator/beam/beam_emu.c
+++ b/erts/emulator/beam/beam_emu.c
@@ -41,8 +41,6 @@
#include "hipe_mode_switch.h"
#include "hipe_bif1.h"
#endif
-
-#include <assert.h>
#include "dtrace-wrapper.h"
/* #define HARDDEBUG 1 */
@@ -1053,72 +1051,6 @@ init_emulator(void)
# define REG_tmp_arg2
#endif
-ERTS_INLINE void
-dtrace_proc_str(Process *process, char *process_buf)
-{
- dtrace_pid_str(process->id, process_buf);
-}
-
-ERTS_INLINE void
-dtrace_pid_str(Eterm pid, char *process_buf)
-{
- snprintf(process_buf, DTRACE_TERM_BUF_SIZE, "<%lu.%lu.%lu>",
- pid_channel_no(pid),
- pid_number(pid),
- pid_serial(pid));
-}
-
-ERTS_INLINE void
-dtrace_port_str(Port *port, char *port_buf)
-{
- snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>",
- port_channel_no(port->id),
- port_number(port->id));
-}
-
-ERTS_INLINE void
-dtrace_drvport_str(ErlDrvPort drvport, char *port_buf)
-{
- Port *port = erts_drvport2port(drvport);
-
- snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>",
- port_channel_no(port->id),
- port_number(port->id));
-}
-
-ERTS_INLINE void
-dtrace_fun_decode(Process *process,
- Eterm module, Eterm function, int arity,
- char *process_buf, char *mfa_buf)
-{
- char funbuf[DTRACE_TERM_BUF_SIZE];
- char *funptr = funbuf;
- char *p = NULL;
-
- if (process_buf) {
- dtrace_proc_str(process, process_buf);
- }
-
- erts_snprintf(funbuf, sizeof(funbuf), "%T", function);
- /*
- * I'm not quite sure how these function names are synthesized,
- * but they almost always seem to be in the form of
- * '-name/arity-fun-0-' so I'm chopping them up when it's -fun-0-
- * (which seems to be the toplevel)
- */
- if (funbuf[0] == '\'' && funbuf[1] == '-'
- && strlen(funbuf) > 3 && funbuf[strlen(funbuf) - 3] == '0') {
- p = strchr(funbuf, '/');
- if (p) {
- *p = 0;
- }
- funptr += 2;
- }
-
- erts_snprintf(mfa_buf, DTRACE_TERM_BUF_SIZE, "%T:%s/%d",
- module, funptr, arity);
-}
-
#ifdef HAVE_DTRACE
#define DTRACE_CALL(p, m, f, a) \
@@ -1190,6 +1122,16 @@ dtrace_fun_decode(Process *process,
#endif /* HAVE_DTRACE */
+void
+dtrace_drvport_str(ErlDrvPort drvport, char *port_buf)
+{
+ Port *port = erts_drvport2port(drvport);
+
+ erts_snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>",
+ port_channel_no(port->id),
+ port_number(port->id));
+}
+
/*
* process_main() is called twice:
* The first call performs some initialisation, including exporting
@@ -1376,7 +1318,8 @@ void process_main(void)
(Eterm)fptr[1], (Uint)fptr[2],
NULL, fun_buf);
} else {
- snprintf(fun_buf, sizeof(fun_buf), "<unknown/%p>", next);
+ erts_snprintf(fun_buf, sizeof(fun_buf),
+ "<unknown/%p>", next);
}
}
@@ -1970,7 +1913,9 @@ void process_main(void)
if (DTRACE_ENABLED(message_receive)) {
Eterm token2 = NIL;
DTRACE_CHARBUF(receiver_name, DTRACE_TERM_BUF_SIZE);
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
dtrace_proc_str(c_p, receiver_name);
token2 = SEQ_TRACE_TOKEN(c_p);
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c
index 6f6b04d278..ba55a1918a 100644
--- a/erts/emulator/beam/dist.c
+++ b/erts/emulator/beam/dist.c
@@ -741,8 +741,10 @@ erts_dsig_send_msg(ErtsDSigData *dsdp, Eterm remote, Eterm message)
Eterm token = NIL;
Process *sender = dsdp->proc;
int res;
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
- Uint msize = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
+ ERTS_DECLARE_DUMMY(Uint msize) = 0;
DTRACE_CHARBUF(node_name, 64);
DTRACE_CHARBUF(sender_name, 64);
DTRACE_CHARBUF(receiver_name, 64);
@@ -788,8 +790,10 @@ erts_dsig_send_reg_msg(ErtsDSigData *dsdp, Eterm remote_name, Eterm message)
Eterm token = NIL;
Process *sender = dsdp->proc;
int res;
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
- Uint32 msize = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
+ ERTS_DECLARE_DUMMY(Uint32 msize) = 0;
DTRACE_CHARBUF(node_name, 64);
DTRACE_CHARBUF(sender_name, 64);
DTRACE_CHARBUF(receiver_name, 128);
@@ -838,7 +842,9 @@ erts_dsig_send_exit_tt(ErtsDSigData *dsdp, Eterm local, Eterm remote,
DeclareTmpHeapNoproc(ctl_heap,6);
int res;
Process *sender = dsdp->proc;
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
DTRACE_CHARBUF(node_name, 64);
DTRACE_CHARBUF(sender_name, 64);
DTRACE_CHARBUF(remote_name, 128);
diff --git a/erts/emulator/beam/dtrace-wrapper.h b/erts/emulator/beam/dtrace-wrapper.h
index f93871bd25..b633058e90 100644
--- a/erts/emulator/beam/dtrace-wrapper.h
+++ b/erts/emulator/beam/dtrace-wrapper.h
@@ -23,15 +23,6 @@
#define DTRACE_TERM_BUF_SIZE 256
-#ifndef DTRACE_DRIVER_SKIP_FUNC_DECLARATIONS
-inline void dtrace_proc_str(Process *process, char *process_buf);
-inline void dtrace_pid_str(Eterm pid, char *process_buf);
-inline void dtrace_port_str(Port *port, char *port_buf);
-inline void dtrace_fun_decode(Process *process,
- Eterm module, Eterm function, int arity,
- char *process_buf, char *mfa_buf);
-#endif
-
/*
* Some varieties of SystemTap macros do not like statically-sized
* char[N] buffers. (For example, CentOS 6's macros.)
diff --git a/erts/emulator/beam/erl_async.c b/erts/emulator/beam/erl_async.c
index 72dcc99f4f..b8cb3c6cc4 100644
--- a/erts/emulator/beam/erl_async.c
+++ b/erts/emulator/beam/erl_async.c
@@ -253,8 +253,7 @@ erts_get_async_ready_queue(Uint sched_id)
static ERTS_INLINE void async_add(ErtsAsync *a, ErtsAsyncQ* q)
{
- /* DTRACE TODO: Get the queue length from erts_thr_q_enqueue() */
- int len = -1;
+ int len;
if (is_internal_port(a->port)) {
#if ERTS_USE_ASYNC_READY_Q
@@ -275,6 +274,8 @@ static ERTS_INLINE void async_add(ErtsAsync *a, ErtsAsyncQ* q)
DTRACE_CHARBUF(port_str, 16);
erts_snprintf(port_str, sizeof(port_str), "%T", a->port);
+ /* DTRACE TODO: Get the queue length from erts_thr_q_enqueue() ? */
+ len = -1;
DTRACE2(aio_pool_add, port_str, len);
}
gcc_optimizer_hack++;
@@ -288,8 +289,7 @@ static ERTS_INLINE ErtsAsync *async_get(ErtsThrQ_t *q,
int saved_fin_deq = 0;
ErtsThrQFinDeQ_t fin_deq;
#endif
- /* DTRACE TODO: Get the queue length from erts_thr_q_dequeue() somehow? */
- int len = -1;
+ int len;
while (1) {
ErtsAsync *a = (ErtsAsync *) erts_thr_q_dequeue(q);
@@ -305,6 +305,8 @@ static ERTS_INLINE ErtsAsync *async_get(ErtsThrQ_t *q,
DTRACE_CHARBUF(port_str, 16);
erts_snprintf(port_str, sizeof(port_str), "%T", a->port);
+ /* DTRACE TODO: Get the length from erts_thr_q_dequeue() ? */
+ len = -1;
DTRACE2(aio_pool_get, port_str, len);
}
return a;
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index 858ae32ad5..679a3645ba 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -2055,7 +2055,6 @@ shrink_new_heap(Process *p, Uint new_sz, Eterm *objv, int nobj)
Uint heap_size = HEAP_TOP(p) - HEAP_START(p);
Sint offs;
Uint stack_size = p->hend - p->stop;
- char pidbuf[DTRACE_TERM_BUF_SIZE];
ASSERT(new_sz < p->heap_sz);
sys_memmove(p->heap + new_sz - stack_size, p->stop, stack_size *
diff --git a/erts/emulator/beam/erl_message.c b/erts/emulator/beam/erl_message.c
index 8489353c9e..786d6ac52c 100644
--- a/erts/emulator/beam/erl_message.c
+++ b/erts/emulator/beam/erl_message.c
@@ -336,7 +336,9 @@ erts_queue_dist_message(Process *rcvr,
Eterm token)
{
ErlMessage* mp;
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
#ifdef ERTS_SMP
ErtsProcLocks need_locks;
#endif
@@ -495,7 +497,9 @@ erts_queue_message(Process* receiver,
if (DTRACE_ENABLED(message_queued)) {
DTRACE_CHARBUF(receiver_name, DTRACE_TERM_BUF_SIZE);
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
dtrace_proc_str(receiver, receiver_name);
if (seq_trace_token != NIL && is_tuple(seq_trace_token)) {
@@ -822,7 +826,9 @@ erts_send_message(Process* sender,
Eterm token = NIL;
DTRACE_CHARBUF(sender_name, 64);
DTRACE_CHARBUF(receiver_name, 64);
- Sint tok_label = 0, tok_lastcnt = 0, tok_serial = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_label) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_lastcnt) = 0;
+ ERTS_DECLARE_DUMMY(Sint tok_serial) = 0;
BM_STOP_TIMER(system);
BM_MESSAGE(message,sender,receiver);
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index 6f6263d160..7f12004b43 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -1072,13 +1072,6 @@ void process_main(void);
Eterm build_stacktrace(Process* c_p, Eterm exc);
Eterm expand_error_value(Process* c_p, Uint freason, Eterm Value);
void erts_save_stacktrace(Process* p, struct StackTrace* s, int depth);
-ERTS_INLINE void dtrace_proc_str(Process *process, char *process_buf);
-ERTS_INLINE void dtrace_pid_str(Eterm pid, char *process_buf);
-ERTS_INLINE void dtrace_port_str(Port *port, char *port_buf);
-ERTS_INLINE void dtrace_drvport_str(ErlDrvPort port, char *port_buf);
-ERTS_INLINE void dtrace_fun_decode(Process *process,
- Eterm module, Eterm function, int arity,
- char *process_buf, char *mfa_buf);
/* erl_init.c */
@@ -1981,4 +1974,66 @@ erts_alloc_message_heap(Uint size,
# define UseTmpHeapNoproc(Size) /* Nothing */
# define UnUseTmpHeapNoproc(Size) /* Nothing */
#endif /* HEAP_ON_C_STACK */
+
+#if ERTS_GLB_INLINE_INCL_FUNC_DEF
+
+#include "dtrace-wrapper.h"
+
+ERTS_GLB_INLINE void
+dtrace_pid_str(Eterm pid, char *process_buf)
+{
+ erts_snprintf(process_buf, DTRACE_TERM_BUF_SIZE, "<%lu.%lu.%lu>",
+ pid_channel_no(pid),
+ pid_number(pid),
+ pid_serial(pid));
+}
+
+ERTS_GLB_INLINE void
+dtrace_proc_str(Process *process, char *process_buf)
+{
+ dtrace_pid_str(process->id, process_buf);
+}
+
+ERTS_GLB_INLINE void
+dtrace_port_str(Port *port, char *port_buf)
+{
+ erts_snprintf(port_buf, DTRACE_TERM_BUF_SIZE, "#Port<%lu.%lu>",
+ port_channel_no(port->id),
+ port_number(port->id));
+}
+
+ERTS_GLB_INLINE void
+dtrace_fun_decode(Process *process,
+ Eterm module, Eterm function, int arity,
+ char *process_buf, char *mfa_buf)
+{
+ char funbuf[DTRACE_TERM_BUF_SIZE];
+ char *funptr = funbuf;
+ char *p = NULL;
+
+ if (process_buf) {
+ dtrace_proc_str(process, process_buf);
+ }
+
+ erts_snprintf(funbuf, sizeof(funbuf), "%T", function);
+ /*
+ * I'm not quite sure how these function names are synthesized,
+ * but they almost always seem to be in the form of
+ * '-name/arity-fun-0-' so I'm chopping them up when it's -fun-0-
+ * (which seems to be the toplevel)
+ */
+ if (funbuf[0] == '\'' && funbuf[1] == '-'
+ && strlen(funbuf) > 3 && funbuf[strlen(funbuf) - 3] == '0') {
+ p = strchr(funbuf, '/');
+ if (p) {
+ *p = 0;
+ }
+ funptr += 2;
+ }
+
+ erts_snprintf(mfa_buf, DTRACE_TERM_BUF_SIZE, "%T:%s/%d",
+ module, funptr, arity);
+}
+#endif /* #if ERTS_GLB_INLINE_INCL_FUNC_DEF */
+
#endif /* !__GLOBAL_H__ */