export some CallContext methods #1083

Closed
rurban opened this Issue Jul 16, 2014 · 1 comment

Projects

None yet

2 participants

@rurban
Member
rurban commented Jul 16, 2014

Calling CallContext methods internally via the indirect PMC vtable route might be too slow. See http://wknight8111.blogspot.com/2009/10/optimizing-parrot.html

Benchmark this:

  • export the internally needed CallContext vtable methods (not static) and use them in our PCC (src/call/*.c only)
  • add a lib/Parrot/Pmc2c/PMC/CallContext.pm to special case it (if worthwile)
  • inline the CallContext ATTR accessors to omit the obj check, because there cannot be an override for it, or fix the definition in the header itself

i.e.

/* Generated macro accessors for 'arg_flags' attribute of CallContext PMC. */
#define GETATTR_CallContext_arg_flags(interp, pmc, dest) \
    do { \
        if (!PObj_is_object_TEST(pmc)) { \
            (dest) = ((Parrot_CallContext_attributes *)PMC_data(pmc))->arg_flags; \
        } \
        else { \
            (dest) = VTABLE_get_attr_str(interp, \
                              pmc, Parrot_str_new_constant(interp, "arg_flags")); \
        } \
    } while (0)

=>

#define GETATTR_CallContext_arg_flags(interp, pmc, dest) \
            (dest) = PARROT_CALLCONTEXT(pmc)->arg_flags;

to get benchmark numbers just fix include/pmc/pmc_callcontext.h and src/pmc/callcontext.c manually

@ZYROz ZYROz self-assigned this Jul 16, 2014
@rurban rurban added a commit that referenced this issue Jul 22, 2014
@rurban rurban [pcc] actually use now the direct methods GH #1083
and do not use the CallContext vtable methods anymore.
also inline one Continuation_set_pointer call.

all tests still passing, 2.98% faster.
970c54b
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Jul 28, 2014
@ZYROz ZYROz [pcc] More Direct Methods GH #1083 993d089
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Jul 28, 2014
@ZYROz ZYROz [pmc2c] WIP - Automate CallContext ATTR accessors to omit the obj che…
…ck for GH #1083
55ce822
@rurban rurban added a commit that referenced this issue Jul 29, 2014
@rurban rurban [pmc2c] WIP - More special-case CallContext, c vs h, GH #1083
put CallContext decl into .h as they are not static.
TODO: one remaining syntax error and missing Parrot_CallContext_class_init
db71836
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Jul 29, 2014
@ZYROz ZYROz [pmc2c] WIP - rurban's patch to correct headers. GH #1083 a036b40
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Aug 2, 2014
@ZYROz ZYROz [pmc2c] WIP - Correcting Syntax Error in PMC.pm - GH #1083 39eb5b3
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Aug 5, 2014
@ZYROz ZYROz [pcc] Debugged build failure due to args.c [GH #1083] c67168b
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Aug 5, 2014
@ZYROz ZYROz [pcc] Optimizing args.c using exported VTABLE calls [GH #1083] e12024a
@ZYROz ZYROz added a commit to ZYROz/parrot that referenced this issue Aug 5, 2014
@ZYROz ZYROz [pcc] Optimizing args.c using exported VTABLE calls [GH #1083] 50e57d8
@ZYROz ZYROz added a commit that referenced this issue Aug 5, 2014
@ZYROz @rurban ZYROz + rurban [pmc2c] Faster CallContext ATTR accessors + non-static for GH #1083
Omit the obj check in the CallContext ATTR accessors.

Put CallContext non-static decl into .h as they are not static anymore,
so that we can call them now directly internally in src/call/*.c
to avoid VTABLE redirection for those.

work together with Reini Urban
476dd48
@rurban rurban added a commit that referenced this issue Aug 5, 2014
@rurban rurban [pcc] use the direct CallContext methods GH #1083
and do not use the CallContext vtable methods anymore.
also inline one Continuation_set_pointer call.

all tests still passing, 2.98% faster.
844ffaa
@rurban rurban added a commit that referenced this issue Aug 5, 2014
@rurban rurban [pcc] use the direct CallContext methods GH #1083
and do not use the CallContext vtable methods anymore.
also inline one Continuation_set_pointer call.

in fill_params() it is safe to use CallContext directly, as
it assumes either NULL or CallContext, but never PMCNULL.

all tests still passing, 1.63% faster.
d815693
@ZYROz ZYROz added a commit that referenced this issue Aug 12, 2014
@ZYROz @rurban ZYROz + rurban [pcc] use the direct CallContext methods GH #1083
and do not use the CallContext vtable methods anymore.
also inline one Continuation_set_pointer call.

in fill_params() it is safe to use CallContext directly, as
it assumes either NULL or CallContext, but never PMCNULL.

all tests still passing, 1.63% faster.

Signed-off-by: Reini Urban <rurban@cpanel.net>
27690c7
@rurban rurban added a commit that referenced this issue Aug 14, 2014
@rurban rurban ChangeLog for GH #1083 87039a3
@rurban rurban added a commit that referenced this issue Aug 19, 2014
@rurban rurban Release 6.7.0 - Grey-headed Lovebird
This release is still very stable. It adds two code changes:
- find_codepoint: added more name aliases for perl6 (LF,FF,CR and NEL)
- Optimize internal pcc CallContext calls from VTABLE to direct calls
  and inline CallContext ATTR accessors to omit the obj check. [GH #1083]
63a417e
@rurban
Member
rurban commented Sep 6, 2014

Merged with Release 6.7.0

@rurban rurban closed this Sep 6, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment