Author: chromatic
Date: Wed May 2 22:08:51 2007
New Revision: 18407
Modified:
trunk/lib/Parrot/Pmc2c/PCCMETHOD.pm
trunk/src/packfile.c
trunk/src/pmc/bound_nci.pmc
trunk/src/pmc/class.pmc
trunk/src/pmc/exporter.pmc
trunk/src/pmc/fixedbooleanarray.pmc
trunk/src/pmc/fixedpmcarray.pmc
trunk/src/pmc/lexinfo.pmc
trunk/src/pmc/ref.pmc
trunk/src/pmc/resizablebooleanarray.pmc
trunk/src/pmc/resizablepmcarray.pmc
trunk/src/pmc/role.pmc
trunk/src/pmc/slice.pmc
trunk/src/pmc/stmvar.pmc
trunk/src/pmc/tqueue.pmc
Log:
[PMC] More casting cleanups and minor standards corrections.
Modified: trunk/lib/Parrot/Pmc2c/PCCMETHOD.pm
==============================================================================
--- trunk/lib/Parrot/Pmc2c/PCCMETHOD.pm (original)
+++ trunk/lib/Parrot/Pmc2c/PCCMETHOD.pm Wed May 2 22:08:51 2007
@@ -243,8 +243,8 @@
#line $lineno2 $file
/*END GENERATED ACCESSORS */
{
- int temp_return_indexes[] = { $returns_indexes };
- return_indexes = (opcode_t *) temp_return_indexes;
+ opcode_t temp_return_indexes[] = { $returns_indexes };
+ return_indexes = temp_return_indexes;
}
return_sig = Parrot_FixedIntegerArray_new_from_string(interp, _type,
string_from_const_cstring(interp, $returns_flags, 0), 0);
Modified: trunk/src/packfile.c
==============================================================================
--- trunk/src/packfile.c (original)
+++ trunk/src/packfile.c Wed May 2 22:08:51 2007
@@ -2830,7 +2830,7 @@
{
opcode_t i;
for (i = 0; i < ft->fixup_count; i++) {
- if ((enum_fixup_t)ft->fixups[i]->type == type &&
+ if ((INTVAL)((enum_fixup_t)ft->fixups[i]->type) == type &&
!strcmp(ft->fixups[i]->name, name)) {
ft->fixups[i]->seg = ft->code;
return ft->fixups[i];
Modified: trunk/src/pmc/bound_nci.pmc
==============================================================================
--- trunk/src/pmc/bound_nci.pmc (original)
+++ trunk/src/pmc/bound_nci.pmc Wed May 2 22:08:51 2007
@@ -55,22 +55,23 @@
return PMC_pmc_val(SELF);
}
- opcode_t* invoke(void * next) {
+ opcode_t* invoke(void *next) {
if (PObj_get_FLAGS(SELF) & PObj_private0_FLAG) {
/* bound multi sub
* XXX maybe create separate PMC class
* see also src/pmc/default.pmc:get_attr_str()
* */
- PMC *multi = PMC_struct_val(SELF);
- next = VTABLE_invoke(INTERP, multi, next);
+ PMC *multi = (PMC *)PMC_struct_val(SELF);
+ next = VTABLE_invoke(INTERP, multi, next);
}
else {
- PMC *p2 = REG_PMC(2);
+ PMC *p2 = REG_PMC(2);
INTERP->current_object = REG_PMC(2) = PMC_pmc_val(SELF);
SUPER(next);
- REG_PMC(2) = p2;
+ REG_PMC(2) = p2;
}
- return next;
+
+ return (opcode_t *)next;
}
void mark() {
Modified: trunk/src/pmc/class.pmc
==============================================================================
--- trunk/src/pmc/class.pmc (original)
+++ trunk/src/pmc/class.pmc Wed May 2 22:08:51 2007
@@ -600,7 +600,8 @@
Parrot_Class *_class = PARROT_CLASS(SELF);
/* What should we return? */
- PMC *found;
+ PMC *found = PMCNULL;
+
if (string_equal(interp, what, CONST_STRING(interp, "name")) == 0) {
found = pmc_new(interp, enum_class_String);
VTABLE_set_string_native(interp, found, _class->name);
Modified: trunk/src/pmc/exporter.pmc
==============================================================================
--- trunk/src/pmc/exporter.pmc (original)
+++ trunk/src/pmc/exporter.pmc Wed May 2 22:08:51 2007
@@ -84,7 +84,7 @@
PObj_active_destroy_SET(SELF);
/* Set up the object. */
- exp = mem_sys_allocate_zeroed(sizeof (Parrot_Exporter));
+ exp = mem_allocate_zeroed_typed(Parrot_Exporter);
exp->ns_src = PMCNULL;
exp->ns_dest = CONTEXT(interp->ctx)->current_namespace;
exp->globals = PMCNULL;
Modified: trunk/src/pmc/fixedbooleanarray.pmc
==============================================================================
--- trunk/src/pmc/fixedbooleanarray.pmc (original)
+++ trunk/src/pmc/fixedbooleanarray.pmc Wed May 2 22:08:51 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2005, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -182,7 +182,7 @@
*/
INTVAL get_integer_keyed_int(INTVAL key) {
- Parrot_UInt1 *sd = PMC_data(SELF);
+ Parrot_UInt1 *sd = PMC_data_typed(SELF, Parrot_UInt1 *);
if (key < 0 || key >= PMC_int_val(SELF))
real_exception(INTERP, NULL, E_IndexError,
@@ -332,18 +332,16 @@
*/
void set_integer_keyed_int(INTVAL key, INTVAL value) {
- Parrot_UInt1 *sd = PMC_data(SELF);
+ Parrot_UInt1 *sd = PMC_data_typed(SELF, Parrot_UInt1 *);
if (key < 0 || key >= PMC_int_val(SELF))
real_exception(INTERP, NULL, E_IndexError,
"FixedBooleanArray: index out of bounds!");
- if (value) {
+ if (value)
sd[key/BITS_PER_CHAR] |= (1 << (key % BITS_PER_CHAR));
- }
- else {
+ else
sd[key/BITS_PER_CHAR] &= (~ (1 << (key % BITS_PER_CHAR)));
- }
}
/*
@@ -495,11 +493,12 @@
*/
void freeze(visit_info *info) {
IMAGE_IO *io = info->image_io;
- STRING *s;
+ STRING *s;
+
io->vtable->push_integer(INTERP, io, PMC_int_val(SELF));
s = string_from_cstring(INTERP,
- PMC_data(SELF),
- PMC_int_val2(SELF)/BITS_PER_CHAR);
+ PMC_data_typed(SELF, char *),
+ PMC_int_val2(SELF) / BITS_PER_CHAR);
io->vtable->push_string(INTERP, io, s);
}
@@ -537,7 +536,7 @@
*/
METHOD void fill(INTVAL fill) {
- Parrot_UInt1 *sd = PMC_data(SELF);
+ Parrot_UInt1 *sd = PMC_data_typed(SELF, Parrot_UInt1 *);
INTVAL j;
j = PMC_int_val(SELF) / BITS_PER_CHAR + 1;
if (fill)
Modified: trunk/src/pmc/fixedpmcarray.pmc
==============================================================================
--- trunk/src/pmc/fixedpmcarray.pmc (original)
+++ trunk/src/pmc/fixedpmcarray.pmc Wed May 2 22:08:51 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2005, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -39,12 +39,14 @@
static INTVAL
COMPARE(Interp *interp, void *a, void *b, PMC *cmp)
{
- if (!cmp)
- return mmd_dispatch_i_pp(interp, a, b, MMD_CMP);
+ if (PMC_IS_NULL(cmp))
+ return mmd_dispatch_i_pp(interp, (PMC *)a, (PMC *)b, MMD_CMP);
+
if (cmp->vtable->base_type == enum_class_NCI) {
sort_func_t f = (sort_func_t)D2FPTR(PMC_struct_val(cmp));
return f(interp, a, b);
}
+
return Parrot_runops_fromc_args_reti(interp, cmp, "IPP", a, b);
}
@@ -85,7 +87,7 @@
/*
-=item C<METHOD void sort(PMC* cmp_func)>
+=item C<METHOD void sort(PMC *cmp_func)>
Sort this array, optionally using the provided cmp_func
@@ -94,15 +96,12 @@
*/
METHOD void sort(PMC *cmp_func) {
- UINTVAL n;
+ UINTVAL n = (UINTVAL) PMC_int_val(SELF);
-
- n = (UINTVAL) PMC_int_val(SELF);
if (n <= 1)
return;
- if (PMC_IS_NULL(cmp_func))
- cmp_func = NULL;
- quicksort(interp, PMC_data(SELF), n, cmp_func);
+
+ quicksort(interp, PMC_data_typed(SELF, void **), n, cmp_func);
}
/*
Modified: trunk/src/pmc/lexinfo.pmc
==============================================================================
--- trunk/src/pmc/lexinfo.pmc (original)
+++ trunk/src/pmc/lexinfo.pmc Wed May 2 22:08:51 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005, The Perl Foundation.
+Copyright (C) 2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -25,14 +25,14 @@
static size_t
key_hash_STRING(Interp *interp, void *value, size_t seed)
{
- STRING *s = value;
+ STRING *s = (STRING *)value;
- if (s->hashval) {
+ if (s->hashval)
return s->hashval;
- }
return string_hash(interp, s, seed);
}
+
/*
* LexInfo contains a constant Hash with constant string
* keys and integer indices - no marking and no pmc_ext
@@ -95,12 +95,12 @@
*/
- METHOD void declare_lex_preg(STRING* name, INTVAL preg) {
- parrot_hash_put(INTERP, PMC_struct_val(SELF), name, (void*)preg);
+ METHOD void declare_lex_preg(STRING *name, INTVAL preg) {
+ parrot_hash_put(INTERP, (Hash*)PMC_struct_val(SELF), name,
(void*)preg);
}
INTVAL elements() {
- return parrot_hash_size(INTERP, PMC_struct_val(SELF));
+ return parrot_hash_size(INTERP, (Hash *)PMC_struct_val(SELF));
}
/*
@@ -140,7 +140,7 @@
* TODO create hash with needed types in the first place
*/
SELF.init_pmc(NULL);
- hash = PMC_struct_val(SELF);
+ hash = (Hash *)PMC_struct_val(SELF);
hash->entries = elems;
}
else {
Modified: trunk/src/pmc/ref.pmc
==============================================================================
--- trunk/src/pmc/ref.pmc (original)
+++ trunk/src/pmc/ref.pmc Wed May 2 22:08:51 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2003, The Perl Foundation.
+Copyright (C) 2001-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -54,7 +54,7 @@
*/
- void init_pmc(PMC* initializer) {
+ void init_pmc(PMC *initializer) {
PMC_pmc_val(SELF) = initializer; /* the referred PMC itself */
PObj_custom_mark_SET(SELF);
if (initializer) {
Modified: trunk/src/pmc/resizablebooleanarray.pmc
==============================================================================
--- trunk/src/pmc/resizablebooleanarray.pmc (original)
+++ trunk/src/pmc/resizablebooleanarray.pmc Wed May 2 22:08:51 2007
@@ -143,9 +143,11 @@
/* The size is different, and doesn't fit within the current
* allocation */
else if (new_bytesize != old_bytesize) {
- Parrot_UInt1 * old_store = PMC_data(SELF);
- Parrot_UInt1 * new_store = mem_sys_allocate_zeroed(newsize);
- INTVAL copy_size = new_bytesize < old_bytesize ?
new_bytesize : old_bytesize;
+ Parrot_UInt1 * old_store = PMC_data_typed(SELF, Parrot_UInt1 *);
+ Parrot_UInt1 * new_store =
+ (Parrot_UInt1 *)mem_sys_allocate_zeroed(newsize);
+ INTVAL copy_size =
+ new_bytesize < old_bytesize ? new_bytesize : old_bytesize;
/* Replace old array with new array, and free old array */
PMC_data(SELF) = mem_sys_memmove(new_store, old_store, copy_size);
@@ -208,13 +210,14 @@
/* If the current head position offset is 0, size this thing up by one
* allocation unit */
if (PMC_int_val2(SELF) <= 0) {
- Parrot_UInt1 * const sdOld = PMC_data(SELF);
+ Parrot_UInt1 * const sdOld = PMC_data_typed(SELF, Parrot_UInt1 *);
/* Allocate an extra allocation unit of space in new array */
INTVAL oldmemsize, newmemsize;
- Parrot_UInt1 * sdNew = NULL;
- newmemsize = ROUND_BYTES(PMC_int_val(SELF) + MIN_ALLOC);
- sdNew = mem_sys_allocate_zeroed(newmemsize);
+ Parrot_UInt1 *sdNew = NULL;
+ newmemsize = ROUND_BYTES(PMC_int_val(SELF) + MIN_ALLOC);
+ sdNew =
+ (Parrot_UInt1 *)mem_sys_allocate_zeroed(newmemsize);
/* Copy contents of old array to new array, moving the head
* position forward by one allocation unit (in bytes). */
@@ -266,14 +269,15 @@
if (PMC_int_val2(SELF) >= MIN_ALLOC) {
/* Allocate one allocation unit less of space in new array */
INTVAL newmemsize;
- Parrot_UInt1 * sdNew = NULL;
- Parrot_UInt1 * sdOld = NULL;
- newmemsize = ROUND_BYTES(PMC_int_val(SELF) - MIN_ALLOC);
- sdNew = mem_sys_allocate_zeroed(newmemsize);
+ Parrot_UInt1 *sdNew = NULL;
+ Parrot_UInt1 *sdOld = NULL;
+ newmemsize = ROUND_BYTES(PMC_int_val(SELF) - MIN_ALLOC);
+ sdNew =
+ (Parrot_UInt1 *)mem_sys_allocate_zeroed(newmemsize);
/* Copy contents of old array to new array, move the head position
* offset back by one allocation unit (in bytes) */
- sdOld = PMC_data(SELF);
+ sdOld = PMC_data_typed(SELF, Parrot_UInt1 *);
mem_sys_memmove(sdNew, sdOld + (BITS_TO_BYTES(MIN_ALLOC)),
newmemsize);
/* Replace old array with new array, and free old array */
@@ -344,7 +348,7 @@
io->vtable->push_integer(INTERP, io, PMC_int_val2(SELF));
io->vtable->push_integer(INTERP, io, PMC_int_val(SELF));
- s = string_from_cstring(INTERP, PMC_data(SELF), size);
+ s = string_from_cstring(INTERP, PMC_data_typed(SELF, char *), size);
io->vtable->push_string(INTERP, io, s);
}
Modified: trunk/src/pmc/resizablepmcarray.pmc
==============================================================================
--- trunk/src/pmc/resizablepmcarray.pmc (original)
+++ trunk/src/pmc/resizablepmcarray.pmc Wed May 2 22:08:51 2007
@@ -199,14 +199,19 @@
if (key < 0)
key += PMC_int_val(SELF);
+
if (key < 0)
real_exception(INTERP, NULL, E_IndexError,
"ResizablePMCArray: index out of bounds!");
+
if (key >= PMC_int_val(SELF))
DYNSELF.set_integer_native(key+1);
- data = PMC_data(SELF);
+
+ data = PMC_data_typed(SELF, PMC **);
+
if ( PMC_IS_NULL(data[key]) )
data[key] = pmc_new(INTERP, enum_class_Undef);
+
return data[key];
}
@@ -247,13 +252,14 @@
}
void delete_keyed(PMC* key) {
- PMC **data;
- INTVAL idx = key_integer(INTERP, key);
- INTVAL i;
- INTVAL n = PMC_int_val(SELF);
- data = PMC_data(SELF);
+ INTVAL i;
+ INTVAL idx = key_integer(INTERP, key);
+ INTVAL n = PMC_int_val(SELF);
+ PMC **data = PMC_data_typed(SELF, PMC **);
+
for (i = idx; i < n - 1; ++i)
data[i] = data[i + 1];
+
PMC_int_val(SELF)--;
}
@@ -615,18 +621,18 @@
other->vtable->base_type == enum_class_FixedPMCArray) {
PMC **other_data, **this_data;
- other_data = PMC_data(other);
- this_data = PMC_data(SELF);
- for (i = 0; i < m; ++i) {
+ other_data = PMC_data_typed(other, PMC **);
+ this_data = PMC_data_typed(SELF, PMC **);
+
+ for (i = 0; i < m; ++i)
this_data[n + i] = other_data[i];
- }
}
else {
PMC **this_data;
- this_data = PMC_data(SELF);
- for (i = 0; i < m; ++i) {
+ this_data = PMC_data_typed(SELF, PMC **);
+
+ for (i = 0; i < m; ++i)
this_data[n + i] = VTABLE_get_pmc_keyed_int(INTERP, other, i);
- }
}
}
/*
Modified: trunk/src/pmc/role.pmc
==============================================================================
--- trunk/src/pmc/role.pmc (original)
+++ trunk/src/pmc/role.pmc Wed May 2 22:08:51 2007
@@ -232,7 +232,7 @@
PObj_active_destroy_SET(SELF);
/* Set up the object. */
- role = mem_sys_allocate_zeroed(sizeof (Parrot_Role));
+ role = mem_allocate_zeroed_typed(Parrot_Role);
role->name = CONST_STRING(interp, "");
role->_namespace = PMCNULL;
role->roles = pmc_new(interp, enum_class_ResizablePMCArray);
@@ -390,10 +390,11 @@
*/
PMC* inspect_str(STRING *what) {
- Parrot_Role *role = PARROT_ROLE(SELF);
+ Parrot_Role *role = PARROT_ROLE(SELF);
/* What should we return? */
- PMC *found;
+ PMC *found = PMCNULL;
+
if (string_equal(interp, what, CONST_STRING(interp, "name")) == 0) {
found = pmc_new(interp, enum_class_String);
VTABLE_set_string_native(interp, found, role->name);
Modified: trunk/src/pmc/slice.pmc
==============================================================================
--- trunk/src/pmc/slice.pmc (original)
+++ trunk/src/pmc/slice.pmc Wed May 2 22:08:51 2007
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2004-2006, The Perl Foundation.
+Copyright (C) 2004-2007, The Perl Foundation.
$Id$
=head1 NAME
@@ -52,15 +52,17 @@
static void
set_slice_start(Interp *interp, PMC *self, PMC *key, PMC *agg)
{
- parrot_range_t *range = mem_sys_allocate(sizeof *range);
+ parrot_range_t *range = mem_allocate_typed(parrot_range_t);
+
+ PMC_struct_val(self) = range;
- PMC_struct_val(self) = range;
next_range:
- range->next = NULL;
+ range->next = NULL;
RVal_int(range->step) = 1;
if (key_type(interp, key) & KEY_integer_FLAG) {
range->type = enum_type_INTVAL;
+
/* integer key */
if ((PObj_get_FLAGS(key) &
(KEY_start_slice_FLAG|KEY_end_slice_FLAG)) ==
@@ -94,21 +96,26 @@
}
else {
/* must have end in next key */
- key = PMC_data(key);
+ key = PMC_data_typed(key, PMC *);
+
if (!key)
internal_exception(1, "no end range specified");
+
RVal_int(range->end) = key_integer(interp, key);
}
}
+
if (agg->vtable->base_type == enum_class_Slice)
--RVal_int(range->end);
RVal_int(range->cur) = RVal_int(range->start);
+
range_end:
- key = PMC_data(key);
+ key = PMC_data_typed(key, PMC *);
+
if (key) {
- parrot_range_t *n = mem_sys_allocate(sizeof *range);
- range->next = n;
- range = n;
+ parrot_range_t *n = mem_allocate_typed(parrot_range_t);
+ range->next = n;
+ range = n;
goto next_range;
}
return;
@@ -135,9 +142,11 @@
}
else {
/* must have end in next key */
- key = PMC_data(key);
+ key = PMC_data_typed(key, PMC *);
+
if (!key)
internal_exception(1, "no end range specified");
+
RVal_str(range->end) = key_string(interp, key);
}
goto range_end;
@@ -151,9 +160,11 @@
static void
set_slice_next(Interp *interp, PMC *self, PMC *agg)
{
- parrot_range_t *r = PMC_struct_val(self);
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(self);
+
if (!r || (INTVAL) r == -1)
real_exception(interp, NULL, E_StopIteration, "StopIteration");
+
if (r->type == enum_type_INTVAL) {
RVal_int(r->cur) += RVal_int(r->step);
if (RVal_int(r->step) > 0) {
@@ -162,20 +173,22 @@
next_range:
n = r->next;
mem_sys_free(r);
+
PMC_struct_val(self) = n;
+
if (!n)
PMC_int_val(self) = -1;
}
}
else {
- if (RVal_int(r->cur) < RVal_int(r->end)) {
+ if (RVal_int(r->cur) < RVal_int(r->end))
goto next_range;
- }
}
}
else {
STRING *cur = RVal_str(r->cur);
STRING *end = RVal_str(r->end);
+
if (string_compare(interp, cur, end) < 0)
RVal_str(r->cur) = string_increment(interp, cur);
else
@@ -195,7 +208,7 @@
pobject_lives(INTERP, (PObj*) PMC_pmc_val(SELF));
}
- void init_pmc(PMC* key) {
+ void init_pmc(PMC *key) {
SELF.init();
/* that's actually the KEY_number_FLAG - but I can't hardly
* imagine that we get keyed by FLOATVAL slices on
@@ -207,10 +220,13 @@
}
void destroy() {
- parrot_range_t *r = PMC_struct_val(SELF), *n;
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(SELF);
+ parrot_range_t *n;
+
/* iteration ended - all is freed */
if ((INTVAL) r == -1)
return;
+
while (r) {
n = r->next;
mem_sys_free(r);
@@ -238,14 +254,17 @@
*/
INTVAL get_integer() {
- parrot_range_t *r = PMC_struct_val(SELF);
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(SELF);
+
if (!r || (INTVAL) r == -1)
real_exception(INTERP, NULL, E_StopIteration, "StopIteration");
+
return RVal_int(r->cur);
}
STRING* get_string() {
- parrot_range_t *r = PMC_struct_val(SELF);
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(SELF);
+
return RVal_str(r->cur);
}
@@ -282,7 +301,7 @@
}
INTVAL elements() {
- parrot_range_t *r = PMC_struct_val(SELF);
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(SELF);
/* only start .. end supported so:
* TODO check flags somewhere
* */
@@ -290,25 +309,26 @@
return n;
}
- INTVAL get_integer_keyed(PMC* key) {
- parrot_range_t *r = PMC_struct_val(key);
+ INTVAL get_integer_keyed(PMC *key) {
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(key);
return RVal_int(r->cur);
}
- STRING* get_string_keyed(PMC* key) {
+ STRING* get_string_keyed(PMC *key) {
INTVAL v = VTABLE_get_integer(INTERP, key);
return string_from_int(INTERP, v);
}
- PMC* get_pmc_keyed(PMC* key) {
- parrot_range_t *r = PMC_struct_val(key);
- PMC *res = PMC_pmc_val(SELF);
- PMC_int_val(res) = RVal_int(r->cur);
+ PMC* get_pmc_keyed(PMC *key) {
+ parrot_range_t *r = (parrot_range_t *)PMC_struct_val(key);
+ PMC *res = PMC_pmc_val(SELF);
+ PMC_int_val(res) = RVal_int(r->cur);
+
return res;
}
/*
-=item C<PMC* nextkey_keyed(PMC* agg, INTVAL what)>
+=item C<PMC* nextkey_keyed(PMC *agg, INTVAL what)>
Prepare slice PMC SELF for iteration over the passed aggregate or
advance to next position in the range, depending on what.
@@ -316,7 +336,7 @@
=cut
*/
- PMC* nextkey_keyed(PMC* agg, INTVAL what) {
+ PMC* nextkey_keyed(PMC *agg, INTVAL what) {
PMC *ret = SELF;
switch (what) {
Modified: trunk/src/pmc/stmvar.pmc
==============================================================================
--- trunk/src/pmc/stmvar.pmc (original)
+++ trunk/src/pmc/stmvar.pmc Wed May 2 22:08:51 2007
@@ -1,5 +1,5 @@
/*
-Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
+Copyright: 2001-2007 The Perl Foundation. All Rights Reserved.
$Id$
=head1 NAME
@@ -83,19 +83,23 @@
void mark() {
assert(PObj_is_PMC_shared_TEST(SELF));
assert(PMC_sync(SELF)->owner == INTERP);
- Parrot_STM_mark_pmc_handle(INTERP, PMC_struct_val(SELF));
+ Parrot_STM_mark_pmc_handle(INTERP,
+ (Parrot_STM_PMC_handle)PMC_struct_val(SELF));
}
METHOD PMC* get_read() {
- return Parrot_STM_read(INTERP, PMC_struct_val(SELF));
+ return Parrot_STM_read(INTERP,
+ (Parrot_STM_PMC_handle)PMC_struct_val(SELF));
}
METHOD PMC* get_update() {
- return Parrot_STM_begin_update(INTERP, PMC_struct_val(SELF));
+ return Parrot_STM_begin_update(INTERP,
+ (Parrot_STM_PMC_handle)PMC_struct_val(SELF));
}
METHOD void set(PMC* new_value) {
- Parrot_STM_write(INTERP, PMC_struct_val(SELF), new_value);
+ Parrot_STM_write(INTERP, (Parrot_STM_PMC_handle)PMC_struct_val(SELF),
+ new_value);
}
void freeze(visit_info *info) {
@@ -103,7 +107,8 @@
SUPER(info);
- Parrot_freeze_STM_PMC_handle(INTERP, io, PMC_struct_val(SELF));
+ Parrot_freeze_STM_PMC_handle(INTERP, io,
+ (Parrot_STM_PMC_handle)PMC_struct_val(SELF));
}
void thaw(visit_info *info) {
Modified: trunk/src/pmc/tqueue.pmc
==============================================================================
--- trunk/src/pmc/tqueue.pmc (original)
+++ trunk/src/pmc/tqueue.pmc Wed May 2 22:08:51 2007
@@ -77,17 +77,19 @@
*/
void mark() {
- QUEUE *queue = PMC_data(SELF);
+ QUEUE *queue = PMC_data_typed(SELF, QUEUE *);
QUEUE_ENTRY *entry;
queue_lock(queue);
entry = queue->head;
+
while (entry) {
pobject_lives(INTERP, (PObj*) entry->data);
if (entry == queue->tail)
break;
entry = entry->next;
}
+
queue_unlock(queue);
}
@@ -103,7 +105,7 @@
void destroy() {
if (PMC_data(SELF)) {
- QUEUE *queue = PMC_data(SELF);
+ QUEUE *queue = PMC_data_typed(SELF, QUEUE *);
#if 0
/*
* wait til queue is empty
@@ -144,11 +146,7 @@
*/
INTVAL get_integer() {
- INTVAL items;
- QUEUE *queue = PMC_data(SELF);
-
- items = PMC_int_val(SELF);
- return items;
+ return PMC_int_val(SELF);
}
/*
@@ -176,8 +174,8 @@
*/
void push_pmc(PMC *item) {
- QUEUE_ENTRY* entry = mem_allocate_typed(QUEUE_ENTRY);
- QUEUE *queue = PMC_data(SELF);
+ QUEUE_ENTRY *entry = mem_allocate_typed(QUEUE_ENTRY);
+ QUEUE *queue = PMC_data_typed(SELF, QUEUE *);
/*
* if item isn't shared nor const, then make
@@ -218,18 +216,20 @@
PMC* shift_pmc() {
QUEUE_ENTRY *entry;
- QUEUE *queue = PMC_data(SELF);
- PMC *ret;
+ QUEUE *queue = PMC_data_typed(SELF, QUEUE *);
+ PMC *ret;
queue_lock(queue);
while (queue->head == NULL) {
queue_wait(queue);
}
+
entry = nosync_pop_entry(queue);
--PMC_int_val(SELF);
queue_unlock(queue);
- ret = entry->data;
+ ret = (PMC *)entry->data;
mem_sys_free(entry);
+
return ret;
}
}