diff options
author | Rickard Green <[email protected]> | 2018-03-27 11:26:39 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2018-04-12 11:36:41 +0200 |
commit | 9f8a402cc3e49313089bb9e22bc625f07beea4ca (patch) | |
tree | 861abcfbce7fa415d8f0c755dc9eb0de3f767348 /erts/emulator/beam/binary.c | |
parent | 4137ef162e23307d40616f70206dd2195c453576 (diff) | |
download | otp-9f8a402cc3e49313089bb9e22bc625f07beea4ca.tar.gz otp-9f8a402cc3e49313089bb9e22bc625f07beea4ca.tar.bz2 otp-9f8a402cc3e49313089bb9e22bc625f07beea4ca.zip |
New process_info() implementation using signals
Diffstat (limited to 'erts/emulator/beam/binary.c')
-rw-r--r-- | erts/emulator/beam/binary.c | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/erts/emulator/beam/binary.c b/erts/emulator/beam/binary.c index 95d324d2c1..d53f75c279 100644 --- a/erts/emulator/beam/binary.c +++ b/erts/emulator/beam/binary.c @@ -113,6 +113,40 @@ new_binary(Process *p, byte *buf, Uint len) return build_proc_bin(&MSO(p), HAlloc(p, PROC_BIN_SIZE), bptr); } +Eterm +erts_heap_factory_new_binary(ErtsHeapFactory *hfact, byte *buf, Uint len, + Uint reserve_size) +{ + Eterm *hp; + Binary* bptr; + + if (len <= ERL_ONHEAP_BIN_LIMIT) { + ErlHeapBin* hb; + hp = erts_produce_heap(hfact, heap_bin_size(len), reserve_size); + hb = (ErlHeapBin *) hp; + hb->thing_word = header_heap_bin(len); + hb->size = len; + if (buf != NULL) { + sys_memcpy(hb->data, buf, len); + } + return make_binary(hb); + } + + /* + * Allocate the binary struct itself. + */ + bptr = erts_bin_nrml_alloc(len); + if (buf != NULL) { + sys_memcpy(bptr->orig_bytes, buf, len); + } + + hp = erts_produce_heap(hfact, PROC_BIN_SIZE, reserve_size); + + return build_proc_bin(hfact->off_heap, hp, bptr); +} + + + /* * When heap binary is not desired... */ |