quipu mercurial repository
Revision | eaedbafecbae8ec7461544cd3a3cb592f0579c20 (tree) |
---|---|
Time | 2018-02-22 03:34:47 |
Author | Agustina Arzille <avarzille@rise...> |
Commiter | Agustina Arzille |
Fix valref interface
@@ -2875,8 +2875,7 @@ | ||
2875 | 2875 | if (!symbol_p (h)) |
2876 | 2876 | qp_return (expr); |
2877 | 2877 | else if ((x = lookup_ctv (env, h)) == h) |
2878 | - { | |
2879 | - // XXX: Rewrite once packages are working. | |
2878 | + { // XXX: Rewrite once packages are working. | |
2880 | 2879 | if (!(as_varobj(h)->flags & symbol::ctv_flag) || |
2881 | 2880 | !fct_p (interp->retval = symval (h))) |
2882 | 2881 | qp_return (expr); |
@@ -13,14 +13,14 @@ | ||
13 | 13 | |
14 | 14 | QP_DECLS_BEGIN |
15 | 15 | |
16 | -valref::valref (interpreter *interp, object val) | |
16 | +valref_base::valref_base (valref_base *headp, object val) | |
17 | 17 | { |
18 | - this->next = interp->values.next; | |
19 | - this->prev = &interp->values; | |
20 | - interp->values.next->prev = this; | |
18 | + this->next = headp->next; | |
19 | + this->prev = headp; | |
20 | + headp->next->prev = this; | |
21 | + this->value = val; | |
21 | 22 | atomic_mfence_rel (); |
22 | - interp->values.prev->next = this; | |
23 | - this->value = val; | |
23 | + this->prev->next = this; | |
24 | 24 | } |
25 | 25 | |
26 | 26 | void interpreter::init () |
@@ -452,7 +452,7 @@ | ||
452 | 452 | { |
453 | 453 | object fn = get_sighandler (interp, sig); |
454 | 454 | if (fn != UNBOUND) |
455 | - call_fct (interp, intobj (sig)); | |
455 | + call_fct (interp, fn, intobj (sig)); | |
456 | 456 | } |
457 | 457 | |
458 | 458 | void interpreter::handle_intrs () |
@@ -23,19 +23,16 @@ | ||
23 | 23 | INTERP_SUSPENDED |
24 | 24 | }; |
25 | 25 | |
26 | -class interpreter; | |
27 | - | |
28 | -// Reference to a GC-visible value. | |
29 | -class valref | |
26 | +class valref_base | |
30 | 27 | { |
31 | 28 | public: |
32 | - valref *prev; | |
33 | - valref *next; | |
29 | + valref_base *prev; | |
30 | + valref_base *next; | |
34 | 31 | object value; |
35 | 32 | |
36 | - valref () : prev (nullptr), next (nullptr), value (UNBOUND) {} | |
37 | - | |
38 | - valref (interpreter *__interp, object __value); | |
33 | + valref_base () : prev (nullptr), next (nullptr), value (UNBOUND) {} | |
34 | + | |
35 | + valref_base (valref_base *__headp, object __value); | |
39 | 36 | |
40 | 37 | object& operator* () |
41 | 38 | { |
@@ -47,7 +44,7 @@ | ||
47 | 44 | return (this->value); |
48 | 45 | } |
49 | 46 | |
50 | - ~valref () | |
47 | + ~valref_base () | |
51 | 48 | { |
52 | 49 | this->prev->next = this->prev; |
53 | 50 | this->next->prev = this->next; |
@@ -84,7 +81,7 @@ | ||
84 | 81 | intptr_t sigpend_mask[QP_NSIG / (sizeof (intptr_t) * 8) + |
85 | 82 | (QP_NSIG % (sizeof (intptr_t) * 8) != 0)]; |
86 | 83 | intptr_t nsigpend; |
87 | - valref values; | |
84 | + valref_base values; | |
88 | 85 | |
89 | 86 | // Internal constants. |
90 | 87 | enum |
@@ -224,6 +221,16 @@ | ||
224 | 221 | # define QP_TALLOC(interp, size) (interp)->talloc (size) |
225 | 222 | #endif |
226 | 223 | |
224 | +// Reference to a GC-visible value. | |
225 | +class valref : public valref_base | |
226 | +{ | |
227 | +public: | |
228 | + valref () = delete; | |
229 | + | |
230 | + valref (interpreter *__interp, object __value) : | |
231 | + valref_base (&__interp->values, __value) {} | |
232 | +}; | |
233 | + | |
227 | 234 | // Main thread's interpreter. |
228 | 235 | QP_EXPORT interpreter *main_interp; |
229 | 236 |
@@ -854,7 +854,8 @@ | ||
854 | 854 | for (dlist::iterator lk (&thrp->locks); lk.valid (); lk.adv ()) |
855 | 855 | ((varobj *)lk.getp ())->flags |= mask; |
856 | 856 | |
857 | - for (valref *vp = ip2->values.next; vp != &ip2->values; vp = vp->next) | |
857 | + for (valref_base *vp = ip2->values.next; | |
858 | + vp != &ip2->values; vp = vp->next) | |
858 | 859 | gc_mark (vp->value, mask); |
859 | 860 | } |
860 | 861 |