diff options
-rw-r--r-- | erts/emulator/beam/dist.c | 2 | ||||
-rw-r--r-- | erts/emulator/beam/io.c | 63 | ||||
-rw-r--r-- | erts/etc/unix/etp-commands.in | 60 | ||||
-rw-r--r-- | lib/stdlib/doc/src/queue.xml | 2 |
4 files changed, 62 insertions, 65 deletions
diff --git a/erts/emulator/beam/dist.c b/erts/emulator/beam/dist.c index 27599f38e0..d15db760a2 100644 --- a/erts/emulator/beam/dist.c +++ b/erts/emulator/beam/dist.c @@ -3455,6 +3455,8 @@ dist_ctrl_get_data_1(BIF_ALIST_1) obufsize -= size_obuf(obuf); if (reds < 0) { erts_de_runlock(dep); + if (obufsize) + erts_atomic_add_nob(&dep->qsize, (erts_aint_t) -obufsize); ERTS_BIF_YIELD1(bif_export[BIF_dist_ctrl_get_data_1], BIF_P, BIF_ARG_1); } diff --git a/erts/emulator/beam/io.c b/erts/emulator/beam/io.c index 31c941337f..45fef0c0e5 100644 --- a/erts/emulator/beam/io.c +++ b/erts/emulator/beam/io.c @@ -5298,44 +5298,31 @@ erts_get_port_names(Eterm id, ErlDrvPort drv_port) pnp->driver_name = NULL; } else { - int do_realloc = 1; - int len = -1; - size_t pnp_len = sizeof(ErtsPortNames); -#ifndef DEBUG - pnp_len += 100; /* In most cases 100 characters will be enough... */ - ASSERT(prt->common.id == id); -#endif - pnp = erts_alloc(ERTS_ALC_T_PORT_NAMES, pnp_len); - do { - int nlen; - char *name, *driver_name; - if (len > 0) { - erts_free(ERTS_ALC_T_PORT_NAMES, pnp); - pnp_len = sizeof(ErtsPortNames) + len; - pnp = erts_alloc(ERTS_ALC_T_PORT_NAMES, pnp_len); - } - name = prt->name; - len = nlen = name ? sys_strlen(name) + 1 : 0; - driver_name = (prt->drv_ptr ? prt->drv_ptr->name : NULL); - len += driver_name ? sys_strlen(driver_name) + 1 : 0; - if (len <= pnp_len - sizeof(ErtsPortNames)) { - if (!name) - pnp->name = NULL; - else { - pnp->name = ((char *) pnp) + sizeof(ErtsPortNames); - sys_strcpy(pnp->name, name); - } - if (!driver_name) - pnp->driver_name = NULL; - else { - pnp->driver_name = (((char *) pnp) - + sizeof(ErtsPortNames) - + nlen); - sys_strcpy(pnp->driver_name, driver_name); - } - do_realloc = 0; - } - } while (do_realloc); + int len; + int nlen; + char *driver_name; + + len = nlen = prt->name ? sys_strlen(prt->name) + 1 : 0; + driver_name = (prt->drv_ptr ? prt->drv_ptr->name : NULL); + len += driver_name ? sys_strlen(driver_name) + 1 : 0; + + pnp = erts_alloc(ERTS_ALC_T_PORT_NAMES, + sizeof(ErtsPortNames) + len); + + if (!prt->name) + pnp->name = NULL; + else { + pnp->name = ((char *) pnp) + sizeof(ErtsPortNames); + sys_strcpy(pnp->name, prt->name); + } + if (!driver_name) + pnp->driver_name = NULL; + else { + pnp->driver_name = (((char *) pnp) + + sizeof(ErtsPortNames) + + nlen); + sys_strcpy(pnp->driver_name, driver_name); + } } return pnp; } diff --git a/erts/etc/unix/etp-commands.in b/erts/etc/unix/etp-commands.in index f2b2ab1d9a..66d6d20c4e 100644 --- a/erts/etc/unix/etp-commands.in +++ b/erts/etc/unix/etp-commands.in @@ -4124,14 +4124,6 @@ define etp-block-size-1 set $etp_blk_sz = ($arg0)->bhdr & ~7 else # Allocated block - if !$etp_MBC_ABLK_SZ_MASK - if etp_arch_bits == 64 - set $etp_MBC_ABLK_OFFSET_SHIFT = (64 - 24) - else - set $etp_MBC_ABLK_OFFSET_SHIFT = (32 - 9) - end - set $etp_MBC_ABLK_SZ_MASK = ((UWord)1 << $etp_MBC_ABLK_OFFSET_SHIFT) - 1 - 7 - end set $etp_blk_sz = ($arg0)->bhdr & $etp_MBC_ABLK_SZ_MASK end end @@ -4146,14 +4138,7 @@ define etp-block2mbc-1 set $etp_mbc = ($arg0)->u.carrier else # Allocated block - if !$etp_MBC_ABLK_OFFSET_SHIFT - if etp_arch_bits == 64 - set $etp_MBC_ABLK_OFFSET_SHIFT = (64 - 24) - else - set $etp_MBC_ABLK_OFFSET_SHIFT = (32 - 9) - end - end - set $etp_mbc = (Carrier_t*) ((((UWord)($arg0) >> 18) - (($arg0)->bhdr >> $etp_MBC_ABLK_OFFSET_SHIFT)) << 18) + set $etp_mbc = (Carrier_t*) ((((UWord)($arg0) >> 18) - ((($arg0)->bhdr & $etp_MBC_ABLK_OFFSET_MASK) >> $etp_MBC_ABLK_OFFSET_SHIFT)) << 18) end end @@ -4197,7 +4182,7 @@ document etp-smp-atomic %--------------------------------------------------------------------------- end -define etp-carrier-blocks +define etp-carrier-blocks-1 set $etp_crr = (Carrier_t*) $arg0 etp-smp-atomic $etp_crr->allctr $etp_alc set $etp_alc = (Allctr_t*)($etp_alc & ~7) @@ -4209,12 +4194,6 @@ define etp-carrier-blocks set $etp_fblk_cnt = 0 set $etp_aborted = 0 - if $argc == 2 - set $etp_be_silent = $arg1 - else - set $etp_be_silent = 0 - end - while 1 if !$etp_be_silent etp-block $etp_blk @@ -4237,6 +4216,12 @@ define etp-carrier-blocks printf "ERROR: Missing PREV_FREE_BLK_HDR_FLG (2) in block at %#lx\n", $etp_blk set $etp_error_cnt = $etp_error_cnt + 1 end + else + # Prev is ALLOCATED + if ($etp_blk->bhdr & 2) + printf "ERROR: Invalid PREV_FREE_BLK_HDR_FLG (2) set in block at %#lx\n", $etp_blk + set $etp_error_cnt = $etp_error_cnt + 1 + end end end if $etp_blk->bhdr & 1 @@ -4274,13 +4259,31 @@ define etp-carrier-blocks end end -document etp-carrier-blocks +define etp-carrier-print + set $etp_be_silent = 0 + etp-carrier-blocks-1 $arg0 +end + +document etp-carrier-print +%--------------------------------------------------------------------------- +% Print all memory blocks in carrier +% Args: (Carrier_t*) +%--------------------------------------------------------------------------- +end + +define etp-carrier-check + set $etp_be_silent = 1 + etp-carrier-blocks-1 $arg0 +end + +document etp-carrier-check %--------------------------------------------------------------------------- -% Check and (maybe) print all memory blocks in carrier -% Args: (Carrier_t*) [1=be_silent] +% Check all memory blocks in carrier +% Args: (Carrier_t*) %--------------------------------------------------------------------------- end + define etp-address-to-beam-opcode set $etp_i = 0 set $etp_min_diff = ((UWord)1 << (sizeof(UWord)*8 - 1)) @@ -4412,9 +4415,14 @@ define etp-init set $etp_arch64 = (sizeof(void *) == 8) if $etp_arch64 set $etp_nil = 0xfffffffffffffffb + set $etp_MBC_ABLK_OFFSET_BITS = 23 else set $etp_nil = 0xfffffffb + set $etp_MBC_ABLK_OFFSET_BITS = 8 end + set $etp_MBC_ABLK_OFFSET_SHIFT = (sizeof(UWord)*8 - 1 - $etp_MBC_ABLK_OFFSET_BITS) + set $etp_MBC_ABLK_OFFSET_MASK = ((((UWord)1 << $etp_MBC_ABLK_OFFSET_BITS) - 1) << $etp_MBC_ABLK_OFFSET_SHIFT) + set $etp_MBC_ABLK_SZ_MASK = ((UWord)1 << $etp_MBC_ABLK_OFFSET_SHIFT) - 1 - 7 set $etp_flat = 0 set $etp_chart_id = 0 set $etp_chart = 0 diff --git a/lib/stdlib/doc/src/queue.xml b/lib/stdlib/doc/src/queue.xml index 83a8afea81..89cce6d85b 100644 --- a/lib/stdlib/doc/src/queue.xml +++ b/lib/stdlib/doc/src/queue.xml @@ -168,7 +168,7 @@ <fsummary>Test if a queue is empty.</fsummary> <desc> <p>Tests if <c><anno>Q</anno></c> is empty and returns <c>true</c> if - so, otherwise otherwise.</p> + so, otherwise <c>false</c>.</p> </desc> </func> |