Skip to content

Commit

Permalink
[pmc] capture, HashIterator, ImageIoThaw: WBs
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYROz authored and Reini Urban committed May 23, 2014
1 parent f39953b commit 29feb94
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 23 deletions.
16 changes: 9 additions & 7 deletions src/pmc/capture.pmc
Expand Up @@ -405,7 +405,7 @@ Delete the element corresponding to C<key> in the array component.
return VTABLE_exists_keyed_int(INTERP, array, key);
}

VTABLE void delete_keyed_int(INTVAL key) {
VTABLE void delete_keyed_int(INTVAL key) :no_wb {
PMC *array;

GET_ATTR_array(INTERP, SELF, array);
Expand Down Expand Up @@ -661,7 +661,7 @@ Delete the element corresponding to C<key> in the hash component.
return VTABLE_exists_keyed(INTERP, hash, key);
}

VTABLE void delete_keyed(PMC *key) {
VTABLE void delete_keyed(PMC *key) :no_wb {
PMC *hash;

GET_ATTR_hash(INTERP, SELF, hash);
Expand Down Expand Up @@ -708,7 +708,7 @@ Delete the element corresponding to C<key> in the hash component.
return VTABLE_exists_keyed_str(INTERP, hash, key);
}

VTABLE void delete_keyed_str(STRING *key) {
VTABLE void delete_keyed_str(STRING *key) :no_wb {
PMC *hash;

GET_ATTR_hash(INTERP, SELF, hash);
Expand All @@ -728,7 +728,7 @@ erase the contents of the array and hash components.

*/

VTABLE void set_pmc(PMC *capture) {
VTABLE void set_pmc(PMC *capture) :no_wb {
if (PMC_IS_NULL(capture)) {
SET_ATTR_array(INTERP, SELF, NULL);
SET_ATTR_hash(INTERP, SELF, NULL);
Expand Down Expand Up @@ -758,7 +758,7 @@ and memory address.

*/

VTABLE STRING *get_string() {
VTABLE STRING *get_string() :no_wb {
const STRING * const classname = VTABLE_name(INTERP, SELF);
return Parrot_sprintf_c(INTERP, "%S[0x%x]", classname, SELF);
}
Expand All @@ -773,7 +773,7 @@ Mark the array.

*/

VTABLE void mark() {
VTABLE void mark() :no_wb {
PMC *array, *hash;
GET_ATTR_array(INTERP, SELF, array);
GET_ATTR_hash(INTERP, SELF, hash);
Expand All @@ -794,7 +794,7 @@ Freeze/thaw Capture

*/

VTABLE void freeze(PMC *info) {
VTABLE void freeze(PMC *info) :no_wb {
PMC *array, *hash;
GET_ATTR_array(INTERP, SELF, array);
GET_ATTR_hash(INTERP, SELF, hash);
Expand All @@ -805,6 +805,8 @@ Freeze/thaw Capture

VTABLE void thaw(PMC *info) {
PMC *tmp;
PARROT_GC_WRITE_BARRIER(INTERP, SELF);

tmp = VTABLE_shift_pmc(INTERP, info);
if (!PMC_IS_NULL(tmp)) {
SET_ATTR_array(INTERP, SELF, tmp);
Expand Down
23 changes: 14 additions & 9 deletions src/pmc/hashiterator.pmc
Expand Up @@ -72,7 +72,7 @@ Advance to next position. Return found (if any) HashBucket.
*/

static void
advance_to_next(ARGMOD(PMC *self))
advance_to_next(ARGMOD(PMC *self)) :no_wb
{
ASSERT_ARGS(advance_to_next)
Parrot_HashIterator_attributes * const attrs = PARROT_HASHITERATOR(self);
Expand Down Expand Up @@ -137,7 +137,7 @@ Defaults iteration mode to iterate from start.

*/

VTABLE void init_pmc(PMC *hash) {
VTABLE void init_pmc(PMC *hash) :no_wb {
Parrot_HashIterator_attributes * const attrs =
(Parrot_HashIterator_attributes *) PMC_data(SELF);

Expand All @@ -162,6 +162,7 @@ Marks the hash as live.
*/

VTABLE void mark() {
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
PMC * const hash = PARROT_HASHITERATOR(SELF)->pmc_hash;
Parrot_gc_mark_PMC_alive(INTERP, hash);
/* We don't mark underlying parrot_hash. Hash PMC will mark it */
Expand All @@ -174,7 +175,7 @@ Marks the hash as live.
=cut

*/
VTABLE PMC* clone() {
VTABLE PMC* clone() :no_wb {
UNUSED(INTERP)
UNUSED(SELF)
return PMCNULL;
Expand All @@ -187,7 +188,7 @@ Marks the hash as live.
=cut

*/
VTABLE void set_integer_native(INTVAL value) {
VTABLE void set_integer_native(INTVAL value) :no_wb {
Parrot_HashIterator_attributes * const attrs =
PARROT_HASHITERATOR(SELF);

Expand All @@ -212,7 +213,7 @@ Returns this Iterator's Hash.
=cut

*/
VTABLE PMC* get_pmc() {
VTABLE PMC* get_pmc() :no_wb {
UNUSED(INTERP)
return PARROT_HASHITERATOR(SELF)->pmc_hash;
}
Expand All @@ -227,7 +228,7 @@ Returns true if there is more elements to iterate over.

*/

VTABLE INTVAL get_bool() {
VTABLE INTVAL get_bool() :no_wb {
UNUSED(INTERP)
return PARROT_HASHITERATOR(SELF)->elements != 0;

Expand All @@ -243,12 +244,12 @@ Returns the number of remaining elements in the Hash.

*/

VTABLE INTVAL elements() {
VTABLE INTVAL elements() :no_wb {
UNUSED(INTERP)
return PARROT_HASHITERATOR(SELF)->elements;
}

VTABLE INTVAL get_integer() {
VTABLE INTVAL get_integer() :no_wb {
UNUSED(INTERP)
return PARROT_HASHITERATOR(SELF)->elements;
}
Expand Down Expand Up @@ -277,6 +278,8 @@ the next one.
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
"StopIteration");

PARROT_GC_WRITE_BARRIER(INTERP, SELF);

ret = Parrot_pmc_new(INTERP, enum_class_HashIteratorKey);
VTABLE_set_pointer_keyed_int(INTERP, ret, 0, attrs->parrot_hash);
VTABLE_set_pointer_keyed_int(INTERP, ret, 1, attrs->bucket);
Expand All @@ -296,7 +299,8 @@ the next one.

if (attrs->elements < 0)
return CONST_STRING(INTERP, "");


PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return Parrot_hash_key_to_string(INTERP, attrs->parrot_hash, attrs->bucket->key);
}
/*
Expand All @@ -313,6 +317,7 @@ the next one.
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_OUT_OF_BOUNDS,
"StopIteration");

PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return Parrot_hash_key_to_int(INTERP, attrs->parrot_hash, attrs->bucket->key);
}
}
Expand Down
21 changes: 14 additions & 7 deletions src/pmc/imageiothaw.pmc
Expand Up @@ -45,7 +45,7 @@ Initializes the PMC.

*/

VTABLE void init() {
VTABLE void init() :no_wb {
PARROT_IMAGEIOTHAW(SELF)->seen =
Parrot_pmc_new(INTERP, enum_class_ResizablePMCArray);
PARROT_IMAGEIOTHAW(SELF)->todo =
Expand All @@ -67,7 +67,7 @@ Destroys the PMC.

*/

VTABLE void destroy() {
VTABLE void destroy() :no_wb {
PackFile_destroy(INTERP, PARROT_IMAGEIOTHAW(SELF)->pf);
PARROT_IMAGEIOTHAW(SELF)->pf = NULL;
}
Expand All @@ -83,7 +83,7 @@ Marks the PMC as alive.

*/

VTABLE void mark() {
VTABLE void mark() :no_wb {
Parrot_gc_mark_STRING_alive(INTERP, PARROT_IMAGEIOTHAW(SELF)->img);
Parrot_gc_mark_PMC_alive(INTERP, PARROT_IMAGEIOTHAW(SELF)->seen);
Parrot_gc_mark_PMC_alive(INTERP, PARROT_IMAGEIOTHAW(SELF)->todo);
Expand All @@ -100,7 +100,7 @@ Thaws the PMC contained in C<image>.

*/

VTABLE void set_string_native(STRING *image) {
VTABLE void set_string_native(STRING *image) :no_wb {
if (!PObj_external_TEST(image))
Parrot_str_pin(INTERP, image);

Expand Down Expand Up @@ -134,6 +134,7 @@ Thaws the PMC contained in C<image>.
STATICSELF.shift_pmc();

{
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
PMC * const seen = PARROT_IMAGEIOTHAW(SELF)->seen;
PMC * const todo = PARROT_IMAGEIOTHAW(SELF)->todo;
INTVAL i, n;
Expand Down Expand Up @@ -180,7 +181,7 @@ Get the thawed PMC.

*/

VTABLE PMC *get_pmc() {
VTABLE PMC *get_pmc() :no_wb {
if (PObj_flag_TEST(private1, SELF))
return PARROT_IMAGEIOTHAW(SELF)->seen;
else
Expand All @@ -198,7 +199,7 @@ Get the visit action.

*/

VTABLE INTVAL get_integer() {
VTABLE INTVAL get_integer() :no_wb {
UNUSED(INTERP)
UNUSED(SELF)
return VISIT_THAW_NORMAL;
Expand All @@ -215,7 +216,7 @@ Set an exterior constant table to use for cross-referencing constants.

*/

VTABLE void set_pointer(void *value) {
VTABLE void set_pointer(void *value) :no_wb {
PObj_flag_SET(private1, SELF);
PARROT_IMAGEIOTHAW(SELF)->pf_ct = (PackFile_ConstTable *)value;
}
Expand All @@ -240,6 +241,7 @@ Retrieve an integer as the next item from the image.
PARROT_IMAGEIOTHAW(SELF)->curs = (opcode_t *)PARROT_const_cast(unsigned char *,
stream + pf->header->wordsize);
BYTECODE_SHIFT_OK(INTERP, SELF);
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return i;
}

Expand All @@ -261,6 +263,7 @@ Retrieve a float as the next item from the image.
DECL_CONST_CAST;
PARROT_IMAGEIOTHAW(SELF)->curs = PARROT_const_cast(opcode_t *, curs);
BYTECODE_SHIFT_OK(INTERP, SELF);
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return f;
}

Expand Down Expand Up @@ -298,6 +301,7 @@ Retrieve a string as the next item from the image.
DECL_CONST_CAST;
PARROT_IMAGEIOTHAW(SELF)->curs = PARROT_const_cast(opcode_t *, curs);
BYTECODE_SHIFT_OK(INTERP, SELF);
PARROT_GC_WRITE_BARRIER(INTERP, SELF);
return s;
}
}
Expand All @@ -317,6 +321,9 @@ Retrieve a PMC as the next item from the image.
const UINTVAL n = SELF.shift_integer();
const INTVAL id = PackID_get_PMCID(n);
const int packid_flags = PackID_get_FLAGS(n);

PARROT_GC_WRITE_BARRIER(INTERP, SELF);

PMC *pmc = PMCNULL;
PMC *seen = PARROT_IMAGEIOTHAW(SELF)->seen;
PMC *todo = PARROT_IMAGEIOTHAW(SELF)->todo;
Expand Down

0 comments on commit 29feb94

Please sign in to comment.