diff options
author | Rickard Green <[email protected]> | 2018-04-13 13:36:29 +0200 |
---|---|---|
committer | Rickard Green <[email protected]> | 2018-04-13 13:36:29 +0200 |
commit | fa26cb5a3f7550d5779dce7de748bf91a4bc405e (patch) | |
tree | 75d1aa05f03495479348d5f957e4931118b69b2a /erts/emulator/beam/binary.c | |
parent | 30fd5b9e98268305762b9647d1bf40df665ae54d (diff) | |
parent | 9f8a402cc3e49313089bb9e22bc625f07beea4ca (diff) | |
download | otp-fa26cb5a3f7550d5779dce7de748bf91a4bc405e.tar.gz otp-fa26cb5a3f7550d5779dce7de748bf91a4bc405e.tar.bz2 otp-fa26cb5a3f7550d5779dce7de748bf91a4bc405e.zip |
Merge branch 'rickard/process_info/OTP-14966'
* rickard/process_info/OTP-14966:
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... */ |