Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
pmc2c_orig: optimize 6model pmcs for the new pmc2c
Annotate several PMC methods for unneeded or manual GC write barriers.
This requires the new pmc2c from parrot 6.5.0

This is 2-4% faster for the nqp testsuite.
$ perf stat -r2 prove -r --exec "./nqp-p --vmlibs=nqp_dyncall_ops" t/nqp t/hll t/qregex t/p5regex t/qast t/serialization
  • Loading branch information
Reini Urban committed Jun 17, 2014
1 parent a5894d2 commit 898c35f
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 92 deletions.
28 changes: 14 additions & 14 deletions src/vm/parrot/pmc/nqplexpad.pmc
Expand Up @@ -240,7 +240,7 @@ Return the LexInfo PMC, if any or a Null PMC.
return CTX_REG_PMC(interp, ctx, reg);
}

VTABLE INTVAL get_integer_keyed_str(STRING *name) {
VTABLE INTVAL get_integer_keyed_str(STRING *name) :no_wb {
Hash *hash;
INTVAL reg;
PMC *ctx;
Expand All @@ -253,7 +253,7 @@ Return the LexInfo PMC, if any or a Null PMC.
return CTX_REG_INT(interp, ctx, reg);
}

VTABLE FLOATVAL get_number_keyed_str(STRING *name) {
VTABLE FLOATVAL get_number_keyed_str(STRING *name) :no_wb {
Hash *hash;
INTVAL reg;
PMC *ctx;
Expand All @@ -266,7 +266,7 @@ Return the LexInfo PMC, if any or a Null PMC.
return CTX_REG_NUM(interp, ctx, reg);
}

VTABLE STRING *get_string_keyed_str(STRING *name) {
VTABLE STRING *get_string_keyed_str(STRING *name) :no_wb {
Hash *hash;
INTVAL reg;
PMC *ctx;
Expand All @@ -279,22 +279,22 @@ Return the LexInfo PMC, if any or a Null PMC.
return CTX_REG_STR(interp, ctx, reg);
}

VTABLE PMC *get_pmc_keyed(PMC *name) {
VTABLE PMC *get_pmc_keyed(PMC *name) :no_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
return SELF.get_pmc_keyed_str(s);
}

VTABLE INTVAL get_integer_keyed(PMC *name) {
VTABLE INTVAL get_integer_keyed(PMC *name) :no_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
return SELF.get_integer_keyed_str(s);
}

VTABLE FLOATVAL get_number_keyed(PMC *name) {
VTABLE FLOATVAL get_number_keyed(PMC *name) :no_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
return SELF.get_number_keyed_str(s);
}

VTABLE STRING *get_string_keyed(PMC *name) {
VTABLE STRING *get_string_keyed(PMC *name) :no_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
return SELF.get_string_keyed_str(s);
}
Expand Down Expand Up @@ -345,33 +345,33 @@ Return the LexInfo PMC, if any or a Null PMC.
PARROT_GC_WRITE_BARRIER(INTERP, ctx);
}

VTABLE void set_pmc_keyed(PMC *name, PMC *value) {
VTABLE void set_pmc_keyed(PMC *name, PMC *value) :manual_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
SELF.set_pmc_keyed_str(s, value);
}

VTABLE void set_integer_keyed(PMC *name, INTVAL value) {
VTABLE void set_integer_keyed(PMC *name, INTVAL value) :manual_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
SELF.set_integer_keyed_str(s, value);
}

VTABLE void set_number_keyed(PMC *name, FLOATVAL value) {
VTABLE void set_number_keyed(PMC *name, FLOATVAL value) :manual_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
SELF.set_number_keyed_str(s, value);
}

VTABLE void set_string_keyed(PMC *name, STRING *value) {
VTABLE void set_string_keyed(PMC *name, STRING *value) :manual_wb {
STRING * const s = VTABLE_get_string(INTERP, name);
SELF.set_string_keyed_str(s, value);
}

METHOD get_lexinfo() {
METHOD get_lexinfo() :no_wb {
PMC *lexinfo;
GET_ATTR_lexinfo(INTERP, SELF, lexinfo);
RETURN(PMC *lexinfo);
}

METHOD get_lex_type(STRING *name) {
METHOD get_lex_type(STRING *name) :no_wb {
Hash *hash;
HashBucket *b;
INTVAL spec;
Expand All @@ -398,7 +398,7 @@ Get iterator for declared lexicals.
=cut

*/
VTABLE PMC *get_iter() {
VTABLE PMC *get_iter() :no_wb {
PMC *lexinfo;
GET_ATTR_lexinfo(INTERP, SELF, lexinfo);
return VTABLE_get_iter(INTERP, lexinfo);
Expand Down
26 changes: 13 additions & 13 deletions src/vm/parrot/pmc/ownedhash.pmc
Expand Up @@ -7,95 +7,95 @@ pmclass OwnedHash extends Hash provides hash auto_attrs dynpmc group nqp {
/* The object that owns this hash. */
ATTR PMC *owner;

VTABLE void set_integer_keyed(PMC* key, INTVAL value) {
VTABLE void set_integer_keyed(PMC* key, INTVAL value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) {
VTABLE void set_integer_keyed_int(INTVAL key, INTVAL value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_integer_keyed_str(STRING* key, INTVAL value) {
VTABLE void set_integer_keyed_str(STRING* key, INTVAL value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}

VTABLE void set_number_keyed(PMC* key, FLOATVAL value) {
VTABLE void set_number_keyed(PMC* key, FLOATVAL value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) {
VTABLE void set_number_keyed_int(INTVAL key, FLOATVAL value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_number_keyed_str(STRING* key, FLOATVAL value) {
VTABLE void set_number_keyed_str(STRING* key, FLOATVAL value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}

VTABLE void set_string_keyed(PMC* key, STRING* value) {
VTABLE void set_string_keyed(PMC* key, STRING* value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_string_keyed_int(INTVAL key, STRING* value) {
VTABLE void set_string_keyed_int(INTVAL key, STRING* value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_string_keyed_str(STRING* key, STRING* value) {
VTABLE void set_string_keyed_str(STRING* key, STRING* value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}

VTABLE void set_pmc_keyed(PMC* key, PMC* value) {
VTABLE void set_pmc_keyed(PMC* key, PMC* value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_pmc_keyed_int(INTVAL key, PMC* value) {
VTABLE void set_pmc_keyed_int(INTVAL key, PMC* value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}
VTABLE void set_pmc_keyed_str(STRING* key, PMC* value) {
VTABLE void set_pmc_keyed_str(STRING* key, PMC* value) :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
if (!PMC_IS_NULL(owner))
OBJ_SC_WRITE_BARRIER(owner);
SUPER(key, value);
}

VTABLE void mark() {
VTABLE void mark() :manual_wb {
PMC *owner;
GET_ATTR_owner(interp, SELF, owner);
Parrot_gc_mark_PMC_alive(INTERP, owner);
Expand Down

0 comments on commit 898c35f

Please sign in to comment.