aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolaos S. Papaspyrou <[email protected]>2012-06-09 00:19:28 +0300
committerBjörn-Egil Dahlberg <[email protected]>2015-11-17 14:33:12 +0100
commitcfe998988c942bed0fbf026c00a2531fdf5aba7c (patch)
treeef4692fdb491b8aac4ff1da8d01291cc5da3a816
parentd5711cb70be9ad2e5c78839e8a368900ba248a4a (diff)
downloadotp-cfe998988c942bed0fbf026c00a2531fdf5aba7c.tar.gz
otp-cfe998988c942bed0fbf026c00a2531fdf5aba7c.tar.bz2
otp-cfe998988c942bed0fbf026c00a2531fdf5aba7c.zip
Add the BIF size_shared/1 and debug cleanup
-rw-r--r--erts/emulator/beam/beam_debug.c14
-rw-r--r--erts/emulator/beam/bif.tab12
-rw-r--r--erts/emulator/beam/erl_gc.c2
-rw-r--r--erts/emulator/beam/global.h4
-rw-r--r--lib/kernel/src/erts_debug.erl9
5 files changed, 33 insertions, 8 deletions
diff --git a/erts/emulator/beam/beam_debug.c b/erts/emulator/beam/beam_debug.c
index e989310789..40e3f4db4e 100644
--- a/erts/emulator/beam/beam_debug.c
+++ b/erts/emulator/beam/beam_debug.c
@@ -73,6 +73,20 @@ erts_debug_flat_size_1(BIF_ALIST_1)
}
}
+BIF_RETTYPE
+erts_debug_size_shared_1(BIF_ALIST_1)
+{
+ Process* p = BIF_P;
+ Eterm term = BIF_ARG_1;
+ Uint size = size_shared(term);
+
+ if (IS_USMALL(0, size)) {
+ BIF_RET(make_small(size));
+ } else {
+ Eterm* hp = HAlloc(p, BIG_UINT_HEAP_SIZE);
+ BIF_RET(uint_to_big(size, hp));
+ }
+}
BIF_RETTYPE
erts_debug_breakpoint_2(BIF_ALIST_2)
diff --git a/erts/emulator/beam/bif.tab b/erts/emulator/beam/bif.tab
index 65f8d6f1f5..f45f886395 100644
--- a/erts/emulator/beam/bif.tab
+++ b/erts/emulator/beam/bif.tab
@@ -639,14 +639,16 @@ bif ets:update_counter/4
bif erts_debug:map_info/1
#
-# Obsolete
+# New in 19.0
#
-bif erlang:hash/2
+bif binary:split/2
+bif binary:split/3
+bif erts_debug:size_shared/1
+bif 'erl.system.debug':size_shared/1 ebif_erts_debug_size_shared_1
#
-# New in 19.0
+# Obsolete
#
-bif binary:split/2
-bif binary:split/3
+bif erlang:hash/2
diff --git a/erts/emulator/beam/erl_gc.c b/erts/emulator/beam/erl_gc.c
index ec96a7563a..1cf6509012 100644
--- a/erts/emulator/beam/erl_gc.c
+++ b/erts/emulator/beam/erl_gc.c
@@ -42,8 +42,6 @@
#include "dtrace-wrapper.h"
#include "erl_bif_unique.h"
-#undef SHCOPY_DEBUG
-
#define ERTS_INACT_WR_PB_LEAVE_MUCH_LIMIT 1
#define ERTS_INACT_WR_PB_LEAVE_MUCH_PERCENTAGE 20
#define ERTS_INACT_WR_PB_LEAVE_LIMIT 10
diff --git a/erts/emulator/beam/global.h b/erts/emulator/beam/global.h
index d99f6548f9..c2056dafaa 100644
--- a/erts/emulator/beam/global.h
+++ b/erts/emulator/beam/global.h
@@ -1048,9 +1048,13 @@ void erl_error(char*, va_list);
#undef SHCOPY_DEBUG
#endif
+#ifdef SHCOPY_DEBUG
#define VERBOSE_DEBUG(...) do { \
erts_fprintf(stderr, __VA_ARGS__); \
} while(0)
+#else
+#define VERBOSE_DEBUG(...)
+#endif
#define ERTS_SHCOPY_FLG_MASK (((unsigned) 3) << 0)
#define ERTS_SHCOPY_FLG_NONE (((unsigned) 1) << 0)
diff --git a/lib/kernel/src/erts_debug.erl b/lib/kernel/src/erts_debug.erl
index 39308c0043..5e1cc09e7d 100644
--- a/lib/kernel/src/erts_debug.erl
+++ b/lib/kernel/src/erts_debug.erl
@@ -34,7 +34,8 @@
-export([breakpoint/2, disassemble/1, display/1, dist_ext_to_term/2,
dump_monitors/1, dump_links/1, flat_size/1,
get_internal_state/1, instructions/0, lock_counters/1,
- map_info/1, same/2, set_internal_state/2]).
+ map_info/1, same/2, set_internal_state/2,
+ size_shared/1]).
-spec breakpoint(MFA, Flag) -> non_neg_integer() when
MFA :: {Module :: module(),
@@ -86,6 +87,12 @@ dump_links(_) ->
flat_size(_) ->
erlang:nif_error(undef).
+-spec size_shared(Term) -> non_neg_integer() when
+ Term :: term().
+
+size_shared(_) ->
+ erlang:nif_error(undef).
+
-spec get_internal_state(W) -> term() when
W :: reds_left | node_and_dist_references | monitoring_nodes
| next_pid | 'DbTable_words' | check_io_debug