fix select eval ctx share
This commit is contained in:
parent
3ed7ef011a
commit
52d67726ec
9 changed files with 123 additions and 58 deletions
|
|
@ -497,6 +497,11 @@ void select_eval_ctx_fini(select_eval_ctx_t* ctx)
|
|||
free(ctx);
|
||||
}
|
||||
|
||||
uint32_t sel_get_node_count(void)
|
||||
{
|
||||
return atomic_load_explicit(&sel_node_next_id, memory_order_acquire);
|
||||
}
|
||||
|
||||
/* ── 2-bit bitmap helpers (EVAL_NONE=0 so memset(0) clears correctly) ── */
|
||||
|
||||
#define EVAL_NONE 0
|
||||
|
|
@ -735,48 +740,72 @@ static int eval_select_inner(const xce_select_node_t* node,
|
|||
if (l < 0) return l;
|
||||
return eval_select(node->u.binop.right, ctx);
|
||||
}
|
||||
case SEL_GT:
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
case SEL_GT: {
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return ctx_num(ctx, node->u.binop.left) >
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
case SEL_LT:
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
}
|
||||
case SEL_LT: {
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return ctx_num(ctx, node->u.binop.left) <
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
case SEL_GE:
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
}
|
||||
case SEL_GE: {
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return ctx_num(ctx, node->u.binop.left) >=
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
case SEL_LE:
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
}
|
||||
case SEL_LE: {
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return ctx_num(ctx, node->u.binop.left) <=
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
}
|
||||
case SEL_EQ:
|
||||
if (is_str_cmp(node)) {
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return xce_str_match(ctx_str(ctx, node->u.binop.left),
|
||||
ctx_str(ctx, node->u.binop.right));
|
||||
}
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
return ctx_num(ctx, node->u.binop.left) ==
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
{
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return ctx_num(ctx, node->u.binop.left) ==
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
}
|
||||
case SEL_NE:
|
||||
if (is_str_cmp(node)) {
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return !xce_str_match(ctx_str(ctx, node->u.binop.left),
|
||||
ctx_str(ctx, node->u.binop.right)) ? 1 : 0;
|
||||
}
|
||||
eval_select(node->u.binop.left, ctx);
|
||||
eval_select(node->u.binop.right, ctx);
|
||||
return ctx_num(ctx, node->u.binop.left) !=
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
{
|
||||
int lr = eval_select(node->u.binop.left, ctx);
|
||||
int rr = eval_select(node->u.binop.right, ctx);
|
||||
if (lr < 0) return lr;
|
||||
if (rr < 0) return rr;
|
||||
return ctx_num(ctx, node->u.binop.left) !=
|
||||
ctx_num(ctx, node->u.binop.right) ? 1 : 0;
|
||||
}
|
||||
}
|
||||
ERROR("eval_select_inner: unknown node type %d", (int)node->type);
|
||||
abort();
|
||||
|
|
@ -879,11 +908,6 @@ void gc_sweep_select_nodes(const xce_sched_job_t** live_jobs, size_t njobs)
|
|||
if (sel_node_table.table == NULL) {
|
||||
return;
|
||||
}
|
||||
if (atomic_load_explicit(&sel_alloc_thread_registered, memory_order_acquire)
|
||||
&& !pthread_equal(pthread_self(), sel_alloc_thread_id)) {
|
||||
ERROR("gc_sweep_select_nodes called from non-allocator thread");
|
||||
return;
|
||||
}
|
||||
|
||||
int caps = sel_node_table.nodes.caps;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue