diff options
author | Kaz Kylheku <kaz@kylheku.com> | 2019-04-20 19:32:26 -0700 |
---|---|---|
committer | Kaz Kylheku <kaz@kylheku.com> | 2019-04-20 19:32:26 -0700 |
commit | 5ae1f55200741dd0089f603d07777a1b9faf4690 (patch) | |
tree | f9d89c4501c3a6dd5936baa361ab70bbd01c7fc9 | |
parent | ab1059ae34e48d37d0c5702c3bd5e3bf2afb1a20 (diff) | |
download | txr-5ae1f55200741dd0089f603d07777a1b9faf4690.tar.gz txr-5ae1f55200741dd0089f603d07777a1b9faf4690.tar.bz2 txr-5ae1f55200741dd0089f603d07777a1b9faf4690.zip |
unwind: use allocate-struct in frame reification.
* struct.c (allocate_struct): Changed from internal to
external linkage.
* struct.h (allocate_struct): Declared.
* unwind.c (uw_get_frames, uw_find_frames_by_mask): Use
allocate_struct instead of make_struct.
-rw-r--r-- | struct.c | 3 | ||||
-rw-r--r-- | struct.h | 1 | ||||
-rw-r--r-- | unwind.c | 16 |
3 files changed, 8 insertions, 12 deletions
@@ -114,7 +114,6 @@ static val make_struct_type_compat(val name, val super, val slots, val initfun, val boactor); static val call_super_method(val inst, val sym, struct args *); static val call_super_fun(val type, val sym, struct args *); -static val allocate_struct(val type); void struct_init(void) { @@ -516,7 +515,7 @@ static void call_postinitfun_chain(struct struct_type *st, val strct) } } -static val allocate_struct(val type) +val allocate_struct(val type) { val self = lit("allocate-struct"); struct struct_type *st = stype_handle(&type, self); @@ -44,6 +44,7 @@ val struct_from_plist(val type, struct args *plist); val struct_from_args(val type, struct args *boa); val make_lazy_struct(val type, val argfun); val make_struct_lit(val type, val plist); +val allocate_struct(val type); val copy_struct(val strct); val clear_struct(val strct, val value); val replace_struct(val target, val source); @@ -314,8 +314,7 @@ val uw_get_frames(void) switch (ex->uw.type) { case UW_CATCH: if (ex->ca.matches && ex->ca.visible) { - args_decl(args, ARGS_MIN); - val cf = make_struct(catch_frame_type, nil, args); + val cf = allocate_struct(catch_frame_type); slotset(cf, types_s, ex->ca.matches); slotset(cf, jump_s, cptr(coerce(mem_t *, ex))); ptail = list_collect(ptail, cf); @@ -323,8 +322,7 @@ val uw_get_frames(void) break; case UW_HANDLE: if (ex->ha.visible) { - args_decl(args, ARGS_MIN); - val hf = make_struct(handle_frame_type, nil, args); + val hf = allocate_struct(handle_frame_type); slotset(hf, types_s, ex->ha.matches); slotset(hf, fun_s, ex->ha.fun); ptail = list_collect(ptail, hf); @@ -369,8 +367,7 @@ static val uw_find_frames_impl(val extype, val frtype, val just_one) if (uw_exception_subtype_p(extype, car(match))) break; if (match) { - args_decl(args, ARGS_MIN); - val fr = make_struct(frtype, nil, args); + val fr = allocate_struct(frtype); slotset(fr, types_s, ex->ca.matches); if (et == UW_CATCH) { slotset(fr, desc_s, ex->ca.desc); @@ -410,11 +407,10 @@ val uw_find_frames_by_mask(val mask_in) uw_frtype_t type = fr->uw.type; if (((1U << type) & mask) != 0) { val frame = nil; - args_decl(args, ARGS_MIN); switch (type) { case UW_CATCH: { - frame = make_struct(catch_frame_type, nil, args); + frame = allocate_struct(catch_frame_type); slotset(frame, types_s, fr->ca.matches); slotset(frame, desc_s, fr->ca.desc); slotset(frame, jump_s, cptr(coerce(mem_t *, fr))); @@ -422,7 +418,7 @@ val uw_find_frames_by_mask(val mask_in) } case UW_HANDLE: { - frame = make_struct(handle_frame_type, nil, args); + frame = allocate_struct(handle_frame_type); slotset(frame, types_s, fr->ha.matches); slotset(frame, fun_s, fr->ha.fun); break; @@ -432,7 +428,7 @@ val uw_find_frames_by_mask(val mask_in) struct args *frargs = fr->fc.args; args_decl(acopy, frargs->argc); args_copy(acopy, frargs); - frame = make_struct(fcall_frame_type, nil, args); + frame = allocate_struct(fcall_frame_type); slotset(frame, fun_s, fr->fc.fun); slotset(frame, args_s, args_get_list(acopy)); break; |