Skip to content

Commit

Permalink
[pmc] Improved WB annotations - [j-o]*.pmc
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYROz authored and Reini Urban committed Jun 5, 2014
1 parent dba8e6b commit f5a24a8
Show file tree
Hide file tree
Showing 11 changed files with 35 additions and 39 deletions.
1 change: 0 additions & 1 deletion src/pmc/key.pmc
Expand Up @@ -189,7 +189,6 @@ Sets the value of the key to C<*value>.
*/

VTABLE void set_pmc(PMC *value) :no_wb {
UNUSED(SELF)
UNUSED(value)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_UNIMPLEMENTED,
"Key.set_pmc is broken - see GH #499");
Expand Down
9 changes: 4 additions & 5 deletions src/pmc/lexpad.pmc
Expand Up @@ -202,7 +202,6 @@ pmclass LexPad provides hash no_ro auto_attrs {
ATTR PMC *ctx;

VTABLE void init() :no_wb {
UNUSED(SELF)
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Cannot create a LexPad PMC without an initializer");
}
Expand Down Expand Up @@ -404,22 +403,22 @@ Return the LexInfo PMC, if any or a Null PMC.
CTX_REG_STR(INTERP, ctx, reg) = value;
}

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);
}
Expand Down
3 changes: 1 addition & 2 deletions src/pmc/mappedbytearray.pmc
Expand Up @@ -123,7 +123,6 @@ Free all resources used.
*/

VTABLE void init() {
UNUSED(INTERP);
#ifdef ENABLED
PObj_custom_destroy_SET(SELF);
#endif
Expand Down Expand Up @@ -153,7 +152,7 @@ Free all resources used.
#endif
}

VTABLE void destroy() {
VTABLE void destroy() :no_wb {
#ifdef ENABLED
unsigned char *buffer;
UINTVAL size;
Expand Down
6 changes: 3 additions & 3 deletions src/pmc/namespace.pmc
Expand Up @@ -809,7 +809,7 @@ an invalid type exception if C<namespace> is not a NameSpace PMC or subclass.

*/

METHOD add_namespace(STRING *name, PMC *_namespace) {
METHOD add_namespace(STRING *name, PMC *_namespace) :manual_wb {
STRING * const s_ns = CONST_STRING(INTERP, "NameSpace");

if (!VTABLE_isa(INTERP, _namespace, s_ns))
Expand All @@ -831,7 +831,7 @@ invalid type exception if C<sub> is not a Sub PMC or subclass.

*/

METHOD add_sub(STRING *name, PMC *sub) {
METHOD add_sub(STRING *name, PMC *sub) :manual_wb {
STRING * const s_sub = CONST_STRING(INTERP, "Sub");
STRING * const s_multisub = CONST_STRING(INTERP, "MultiSub");

Expand All @@ -854,7 +854,7 @@ Stores the given variable under this namespace, with the given name.

*/

METHOD add_var(STRING *name, PMC *var) {
METHOD add_var(STRING *name, PMC *var) :manual_wb {
VTABLE_set_pmc_keyed_str(INTERP, SELF, name, var);
}

Expand Down
6 changes: 3 additions & 3 deletions src/pmc/nci.pmc
Expand Up @@ -136,11 +136,11 @@ Call the equivalent C<set_pointer*> function.

*/

VTABLE void set_pmc_keyed(PMC *key, PMC *p) {
VTABLE void set_pmc_keyed(PMC *key, PMC *p) :manual_wb {
STATICSELF.set_pointer_keyed(key, VTABLE_get_pointer(INTERP, p));
}

VTABLE void set_pmc_keyed_str(STRING *key, PMC *p) {
VTABLE void set_pmc_keyed_str(STRING *key, PMC *p) :manual_wb {
STATICSELF.set_pointer_keyed_str(key, VTABLE_get_pointer(INTERP, p));
}

Expand All @@ -164,7 +164,7 @@ Sets the specified function pointer and siganture as described in the string C<k
SET_ATTR_signature(INTERP, SELF, key);
}

VTABLE void set_pointer_keyed_str(STRING *key, void *func) {
VTABLE void set_pointer_keyed_str(STRING *key, void *func) :manual_wb {
SELF.set_pointer_keyed(Parrot_nci_parse_signature(INTERP, key), func);
}

Expand Down
2 changes: 0 additions & 2 deletions src/pmc/null.pmc
Expand Up @@ -52,8 +52,6 @@ Overrides the default to do nothing.
}

VTABLE void set_pointer(void *p) {
UNUSED(INTERP)
UNUSED(SELF)
PMCNULL = (PMC *)p;
}

Expand Down
8 changes: 5 additions & 3 deletions src/pmc/object.pmc
Expand Up @@ -802,7 +802,7 @@ Invokes the object (if this vtable function is overridden).

*/

opcode_t * invoke(void *next) {
opcode_t * invoke(void *next) :no_wb {
Parrot_Object_attributes * const obj = PARROT_OBJECT(SELF);
Parrot_Class_attributes * const _class = PARROT_CLASS(obj->_class);

Expand Down Expand Up @@ -935,6 +935,8 @@ The C<info> arguments are ignored.
}

VTABLE void thaw(PMC *info) :no_wb {
UNUSED(INTERP)
UNUSED(SELF)
UNUSED(info)
}

Expand All @@ -950,7 +952,6 @@ Called after the object has been thawed.
*/

VTABLE void thawfinish(PMC *info) {
UNUSED(INTERP)
UNUSED(info)
/* Set custom GC mark and destroy on the object. */
PObj_custom_mark_SET(SELF);
Expand All @@ -972,7 +973,7 @@ Changes the PMC to a PMC of a new type

*/

VTABLE void morph(PMC* type) {
VTABLE void morph(PMC* type) :manual_wb {
PMC * const classobj = VTABLE_get_class(INTERP, SELF);
STRING * const meth_name = CONST_STRING(INTERP, "morph");
/* If there's a vtable override for 'morph' run that instead. */
Expand All @@ -981,6 +982,7 @@ Changes the PMC to a PMC of a new type

if (!PMC_IS_NULL(method))
Parrot_ext_call(INTERP, method, "PiP->", SELF, type);
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
else
SUPER(type);
}
Expand Down
2 changes: 1 addition & 1 deletion src/pmc/opcode.pmc
Expand Up @@ -38,7 +38,7 @@ Throws an exception. Opcode PMCs are not to be created directly.

*/

VTABLE void init() {
VTABLE void init() :no_wb {
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Opcode must be created from OpLib.");
}
Expand Down
2 changes: 1 addition & 1 deletion src/pmc/oplib.pmc
Expand Up @@ -37,7 +37,7 @@ Throws an error. OpLib requires an argument to init. See C<init_pmc>.

*/

VTABLE void init() {
VTABLE void init() :no_wb {
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"OpLib must be initialized with an oplib name");
}
Expand Down
31 changes: 15 additions & 16 deletions src/pmc/orderedhash.pmc
Expand Up @@ -385,17 +385,17 @@ Sets the PMC value of the element at index C<key> to C<val>.

*/

VTABLE void set_integer_keyed(PMC *key, INTVAL value) {
VTABLE void set_integer_keyed(PMC *key, INTVAL value) :manual_wb {
PMC * const v = box_integer(INTERP, value);
SELF.set_pmc_keyed(key, v);
}

VTABLE void set_number_keyed(PMC *key, FLOATVAL value) {
VTABLE void set_number_keyed(PMC *key, FLOATVAL value) :manual_wb {
PMC * const v = box_number(INTERP, value);
SELF.set_pmc_keyed(key, v);
}

VTABLE void set_string_keyed(PMC *key, STRING *value) {
VTABLE void set_string_keyed(PMC *key, STRING *value) :manual_wb {
PMC * const v = Parrot_pmc_box_string(INTERP, value);
SELF.set_pmc_keyed(key, v);
}
Expand All @@ -410,7 +410,7 @@ Sets the PMC value of the element at index C<key> to C<val>.

*/

VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) {
VTABLE void set_pmc_keyed_str(STRING *key, PMC *value) :manual_wb {
/* Wallpapering problem with HLL Strings as keys */
/* Apparently HLL registry in Parrot uses OrderedHash */
/* Now we have chicken and egg problem during freeze/thaw */
Expand Down Expand Up @@ -550,7 +550,7 @@ The created key = "\1idx".

*/

VTABLE void set_pmc_keyed_int(INTVAL idx, PMC *val) {
VTABLE void set_pmc_keyed_int(INTVAL idx, PMC *val) :manual_wb {
const INTVAL n = STATICSELF.elements();

if (idx < -n)
Expand All @@ -571,21 +571,21 @@ The created key = "\1idx".
}
}

VTABLE void set_integer_keyed_int(INTVAL idx, INTVAL value) {
VTABLE void set_integer_keyed_int(INTVAL idx, INTVAL value) :manual_wb {
PMC * const v = Parrot_pmc_new(INTERP, Parrot_hll_get_ctx_HLL_type(INTERP,
enum_class_Integer));
VTABLE_set_integer_native(INTERP, v, value);
SELF.set_pmc_keyed_int(idx, v);
}

VTABLE void set_number_keyed_int(INTVAL idx, FLOATVAL value) {
VTABLE void set_number_keyed_int(INTVAL idx, FLOATVAL value) :manual_wb {
PMC * const v = Parrot_pmc_new(INTERP, Parrot_hll_get_ctx_HLL_type(INTERP,
enum_class_Float));
VTABLE_set_number_native(INTERP, v, value);
SELF.set_pmc_keyed_int(idx, v);
}

VTABLE void set_string_keyed_int(INTVAL idx, STRING *value) {
VTABLE void set_string_keyed_int(INTVAL idx, STRING *value) :manual_wb {
PMC * const v = Parrot_pmc_new(INTERP, Parrot_hll_get_ctx_HLL_type(INTERP,
enum_class_String));
VTABLE_set_string_native(INTERP, v, value);
Expand All @@ -605,22 +605,22 @@ The created key = "\1idx".

*/

VTABLE void push_pmc(PMC *value) {
VTABLE void push_pmc(PMC *value) :manual_wb {
const INTVAL n = SELF.elements();
SELF.set_pmc_keyed_int(n, value);
}

VTABLE void push_float(FLOATVAL value) {
VTABLE void push_float(FLOATVAL value) :manual_wb {
const INTVAL n = SELF.elements();
SELF.set_number_keyed_int(n, value);
}

VTABLE void push_integer(INTVAL value) {
VTABLE void push_integer(INTVAL value) :manual_wb {
const INTVAL n = SELF.elements();
SELF.set_integer_keyed_int(n, value);
}

VTABLE void push_string(STRING *value) {
VTABLE void push_string(STRING *value) :manual_wb {
const INTVAL n = SELF.elements();
SELF.set_string_keyed_int(n, value);
}
Expand Down Expand Up @@ -711,12 +711,12 @@ Deletes the key C<*key> from the hash.
const INTVAL intval = VTABLE_get_integer(INTERP, key);
PMC * const nexti = VTABLE_shift_pmc(INTERP, key);

if (nexti)
if (nexti) {
VTABLE_delete_keyed(INTERP, STATICSELF.get_pmc_keyed_int(intval), nexti);
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
}
else
STATICSELF.delete_keyed_int(intval);

PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return;
}

Expand Down Expand Up @@ -752,7 +752,6 @@ Deletes the key C<*key> from the hash.
PMC * const list_entry = get_list_item(INTERP, SELF, idx);
STATICSELF.delete_keyed(
VTABLE_get_pmc_keyed_int(INTERP, list_entry, ORDERED_HASH_ITEM_KEY));
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/pmc/orderedhashiterator.pmc
Expand Up @@ -190,7 +190,7 @@ the next one.
ORDERED_HASH_ITEM_NEXT);
++attrs->pos;
--attrs->elements;

PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return ret;
}
Expand Down Expand Up @@ -222,7 +222,7 @@ the next one for reverse iterator.
ORDERED_HASH_ITEM_PREV);
--attrs->pos;
--attrs->elements;

PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return ret;
}
Expand Down

0 comments on commit f5a24a8

Please sign in to comment.