pike.git
/
src
/
backend.cmod
version
»
Context lines:
10
20
40
80
file
none
3
pike.git/src/backend.cmod:1003:
return call_count; } static int backend_find_call_out(struct Backend_struct *me, struct svalue *fun) { size_t hval, fun_hval; struct Backend_CallOut_struct *c;
-
struct svalue *save_sp;
+
if(!me->num_pending_calls) return -1; if(TYPEOF(*fun) == T_ARRAY) { hval=PTR_TO_INT(fun->u.array); hval%=me->hash_size; for(c=me->call_hash[hval].arr;c;c=c->next_arr) { if(c->args == fun->u.array) { #ifdef PIKE_DEBUG if(CALL(c->pos) != c) Pike_fatal("Call_out->pos not correct!\n"); #endif return c->pos; } } } /* Note: is_eq() may call Pike code (which we want),
-
*
but
Pike
code
may
change
the hash
tables
.
..
+
*
however,
it
cannot
modify
the hash
_table
since
+
* we are protected by PROTECT_CALL_OUTS
.
*/ fun_hval=hash_svalue(fun); hval = fun_hval % me->hash_size;
-
save_sp = Pike_sp;
+
for(c=me->call_hash[hval].fun;c;c=c->next_fun) { if(c->fun_hval == fun_hval) { #ifdef PIKE_DEBUG if(CALL(c->pos) != c) Pike_fatal("Call_out->pos not correct!\n"); #endif
-
push
_
int
(c->
pos
)
;
-
push_svalue(ITEM(
c->
args))
;
+
if (is
_
eq
(
fun, ITEM(
c->
args
)
)) {
+
return
c->
pos
;
} }
-
-
/* Check if any of the potential hits we found is a match. */
-
while (Pike_sp > save_sp) {
-
if (is_eq(fun, Pike_sp-1)) {
-
INT_TYPE pos;
-
#ifdef PIKE_DEBUG
-
if (TYPEOF(Pike_sp[-2]) != T_INT)
-
Pike_fatal("Call_out->pos out of sync!\n");
-
#endif
-
pos = Pike_sp[-2].u.integer;
-
pop_n_elems(Pike_sp - save_sp);
-
return pos;
+
}
-
pop_n_elems(2);
-
}
+
return -1; } /*! @decl int _do_call_outs() *! *! Do all pending call_outs. *! *! This function runs all pending call_outs that should have been *! run if Pike returned to the backend. It should not be used in