diff options
Diffstat (limited to 'erts/emulator/beam')
-rw-r--r-- | erts/emulator/beam/big.c | 12 | ||||
-rw-r--r-- | erts/emulator/beam/erl_db_catree.c | 16 |
2 files changed, 15 insertions, 13 deletions
diff --git a/erts/emulator/beam/big.c b/erts/emulator/beam/big.c index 84338769e0..dac9574fa5 100644 --- a/erts/emulator/beam/big.c +++ b/erts/emulator/beam/big.c @@ -668,27 +668,25 @@ static dsize_t I_mul(ErtsDigit* x, dsize_t xl, ErtsDigit* y, dsize_t yl, ErtsDig static dsize_t I_sqr(ErtsDigit* x, dsize_t xl, ErtsDigit* r) { - ErtsDigit d_next = *x; ErtsDigit d; ErtsDigit* r0 = r; ErtsDigit* s = r; if ((r + xl) == x) /* "Inline" operation */ *x = 0; - x++; while(xl--) { - ErtsDigit* y = x; + ErtsDigit* y; ErtsDigit y_0 = 0, y_1 = 0, y_2 = 0, y_3 = 0; ErtsDigit b0, b1; ErtsDigit z0, z1, z2; ErtsDigit t; dsize_t y_l = xl; - + + d = *x; + x++; + y = x; s = r; - d = d_next; - d_next = *x; - x++; DMUL(d, d, b1, b0); DSUMc(*s, b0, y_3, t); diff --git a/erts/emulator/beam/erl_db_catree.c b/erts/emulator/beam/erl_db_catree.c index b642ae009d..75ac1c4a93 100644 --- a/erts/emulator/beam/erl_db_catree.c +++ b/erts/emulator/beam/erl_db_catree.c @@ -621,9 +621,9 @@ static TreeDbTerm* join_trees(TreeDbTerm *left_root_param, } #ifdef DEBUG -# define FORCE_RANDOM_SPLIT_JOIN +# define PROVOKE_RANDOM_SPLIT_JOIN #endif -#ifdef FORCE_RANDOM_SPLIT_JOIN +#ifdef PROVOKE_RANDOM_SPLIT_JOIN static int dbg_fastrand(void) { static int g_seed = 648835; @@ -631,8 +631,12 @@ static int dbg_fastrand(void) return (g_seed>>16)&0x7FFF; } -static void dbg_maybe_force_splitjoin(DbTableCATreeNode* base_node) +static void dbg_provoke_random_splitjoin(DbTableCATree* tb, + DbTableCATreeNode* base_node) { + if (tb->common.status & DB_CATREE_FORCE_SPLIT) + return; + switch (dbg_fastrand() % 8) { case 1: base_node->u.base.lock_statistics = 1+ERL_DB_CATREE_HIGH_CONTENTION_LIMIT; @@ -643,8 +647,8 @@ static void dbg_maybe_force_splitjoin(DbTableCATreeNode* base_node) } } #else -# define dbg_maybe_force_splitjoin(N) -#endif /* FORCE_RANDOM_SPLIT_JOIN */ +# define dbg_provoke_random_splitjoin(T,N) +#endif /* PROVOKE_RANDOM_SPLIT_JOIN */ static ERTS_INLINE int try_wlock_base_node(DbTableCATreeBaseNode *base_node) @@ -691,7 +695,7 @@ void wunlock_adapt_base_node(DbTableCATree* tb, DbTableCATreeNode* parent, int current_level) { - dbg_maybe_force_splitjoin(node); + dbg_provoke_random_splitjoin(tb,node); if ((!node->u.base.root && parent && !(tb->common.status & DB_CATREE_FORCE_SPLIT)) || node->u.base.lock_statistics < ERL_DB_CATREE_LOW_CONTENTION_LIMIT) { |