From f5a24a8bdee545d349def415b2af2fd8e92c937f Mon Sep 17 00:00:00 2001 From: ZYROz Date: Thu, 5 Jun 2014 20:19:22 +0530 Subject: [PATCH] [pmc] Improved WB annotations - [j-o]*.pmc --- src/pmc/key.pmc | 1 - src/pmc/lexpad.pmc | 9 ++++----- src/pmc/mappedbytearray.pmc | 3 +-- src/pmc/namespace.pmc | 6 +++--- src/pmc/nci.pmc | 6 +++--- src/pmc/null.pmc | 2 -- src/pmc/object.pmc | 8 +++++--- src/pmc/opcode.pmc | 2 +- src/pmc/oplib.pmc | 2 +- src/pmc/orderedhash.pmc | 31 +++++++++++++++---------------- src/pmc/orderedhashiterator.pmc | 4 ++-- 11 files changed, 35 insertions(+), 39 deletions(-) diff --git a/src/pmc/key.pmc b/src/pmc/key.pmc index bd3d096ce8..2b4b417220 100644 --- a/src/pmc/key.pmc +++ b/src/pmc/key.pmc @@ -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"); diff --git a/src/pmc/lexpad.pmc b/src/pmc/lexpad.pmc index 4b4a92147d..6214ab293a 100644 --- a/src/pmc/lexpad.pmc +++ b/src/pmc/lexpad.pmc @@ -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"); } @@ -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); } diff --git a/src/pmc/mappedbytearray.pmc b/src/pmc/mappedbytearray.pmc index 26af14c534..3c7f461acd 100644 --- a/src/pmc/mappedbytearray.pmc +++ b/src/pmc/mappedbytearray.pmc @@ -123,7 +123,6 @@ Free all resources used. */ VTABLE void init() { - UNUSED(INTERP); #ifdef ENABLED PObj_custom_destroy_SET(SELF); #endif @@ -153,7 +152,7 @@ Free all resources used. #endif } - VTABLE void destroy() { + VTABLE void destroy() :no_wb { #ifdef ENABLED unsigned char *buffer; UINTVAL size; diff --git a/src/pmc/namespace.pmc b/src/pmc/namespace.pmc index 00bc29d6e3..a2029aad4e 100644 --- a/src/pmc/namespace.pmc +++ b/src/pmc/namespace.pmc @@ -809,7 +809,7 @@ an invalid type exception if C 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)) @@ -831,7 +831,7 @@ invalid type exception if C 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"); @@ -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); } diff --git a/src/pmc/nci.pmc b/src/pmc/nci.pmc index 1eb5621d75..1fd65bf142 100644 --- a/src/pmc/nci.pmc +++ b/src/pmc/nci.pmc @@ -136,11 +136,11 @@ Call the equivalent C 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)); } @@ -164,7 +164,7 @@ Sets the specified function pointer and siganture as described in the string C_class); @@ -935,6 +935,8 @@ The C arguments are ignored. } VTABLE void thaw(PMC *info) :no_wb { + UNUSED(INTERP) + UNUSED(SELF) UNUSED(info) } @@ -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); @@ -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. */ @@ -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); } diff --git a/src/pmc/opcode.pmc b/src/pmc/opcode.pmc index cd598ee268..4bda19d0e8 100644 --- a/src/pmc/opcode.pmc +++ b/src/pmc/opcode.pmc @@ -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."); } diff --git a/src/pmc/oplib.pmc b/src/pmc/oplib.pmc index b7d3324bcd..e3378276fd 100644 --- a/src/pmc/oplib.pmc +++ b/src/pmc/oplib.pmc @@ -37,7 +37,7 @@ Throws an error. OpLib requires an argument to init. See C. */ - 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"); } diff --git a/src/pmc/orderedhash.pmc b/src/pmc/orderedhash.pmc index 7d11aaccdf..aff11ea633 100644 --- a/src/pmc/orderedhash.pmc +++ b/src/pmc/orderedhash.pmc @@ -385,17 +385,17 @@ Sets the PMC value of the element at index C to C. */ - 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); } @@ -410,7 +410,7 @@ Sets the PMC value of the element at index C to C. */ - 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 */ @@ -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) @@ -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); @@ -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); } @@ -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; } @@ -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); } } diff --git a/src/pmc/orderedhashiterator.pmc b/src/pmc/orderedhashiterator.pmc index c291363501..82bbcf6a80 100644 --- a/src/pmc/orderedhashiterator.pmc +++ b/src/pmc/orderedhashiterator.pmc @@ -190,7 +190,7 @@ the next one. ORDERED_HASH_ITEM_NEXT); ++attrs->pos; --attrs->elements; - + PARROT_GC_WRITE_BARRIER(INTERP, SELF); return ret; } @@ -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; }