[svn:parrot] r40804 - in branches/context_pmc3: . compilers/pct/src/PAST compilers/pge/PGE docs/book/pir editor src src/dynpmc src/gc src/pmc t/op t/pmc
bacek at svn.parrot.org
bacek at svn.parrot.org
Tue Aug 25 23:47:21 UTC 2009
Author: bacek
Date: Tue Aug 25 23:47:19 2009
New Revision: 40804
URL: https://trac.parrot.org/parrot/changeset/40804
Log:
Bring branch up-to-date with trunk.
Conflicts:
src/dynpmc/subproxy.pmc
src/gc/mark_sweep.c
src/pmc/addrregistry.pmc
src/pmc/coroutine.pmc
src/pmc/eval.pmc
src/pmc/eventhandler.pmc
src/pmc/exception.pmc
src/pmc/hash.pmc
src/pmc/lexinfo.pmc
src/pmc/namespace.pmc
src/pmc/nci.pmc
src/pmc/object.pmc
src/pmc/sub.pmc
t/op/arithmetics.t
t/op/inf_nan.t
Modified:
branches/context_pmc3/MANIFEST
branches/context_pmc3/compilers/pct/src/PAST/Compiler.pir
branches/context_pmc3/compilers/pge/PGE/Match.pir
branches/context_pmc3/docs/book/pir/ch04_variables.pod
branches/context_pmc3/editor/README.pod
branches/context_pmc3/src/dynpmc/subproxy.pmc
branches/context_pmc3/src/gc/mark_sweep.c
branches/context_pmc3/src/oo.c
branches/context_pmc3/src/pmc/addrregistry.pmc
branches/context_pmc3/src/pmc/class.pmc
branches/context_pmc3/src/pmc/coroutine.pmc
branches/context_pmc3/src/pmc/eval.pmc
branches/context_pmc3/src/pmc/eventhandler.pmc
branches/context_pmc3/src/pmc/exception.pmc
branches/context_pmc3/src/pmc/hash.pmc
branches/context_pmc3/src/pmc/lexinfo.pmc
branches/context_pmc3/src/pmc/namespace.pmc
branches/context_pmc3/src/pmc/object.pmc
branches/context_pmc3/src/pmc/parrotinterpreter.pmc
branches/context_pmc3/src/pmc/scheduler.pmc
branches/context_pmc3/src/pmc/sub.pmc
branches/context_pmc3/t/op/arithmetics.t
branches/context_pmc3/t/op/inf_nan.t
branches/context_pmc3/t/pmc/threads.t
Modified: branches/context_pmc3/MANIFEST
==============================================================================
--- branches/context_pmc3/MANIFEST Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/MANIFEST Tue Aug 25 23:47:19 2009 (r40804)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Sat Aug 15 07:51:12 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Mon Aug 24 09:19:26 2009 UT
#
# See below for documentation on the format of this file.
#
@@ -1798,6 +1798,7 @@
t/op/globals.t [test]
t/op/hacks.t [test]
t/op/ifunless.t [test]
+t/op/inf_nan.t [test]
t/op/integer.t [test]
t/op/interp.t [test]
t/op/io.t [test]
Modified: branches/context_pmc3/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- branches/context_pmc3/compilers/pct/src/PAST/Compiler.pir Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/compilers/pct/src/PAST/Compiler.pir Tue Aug 25 23:47:19 2009 (r40804)
@@ -83,6 +83,7 @@
piropsig['print'] = 'v*'
piropsig['set'] = 'PP'
piropsig['setprop'] = '0P~P'
+ piropsig['setattribute'] = '0P~P'
set_global '%piropsig', piropsig
## %valflags specifies when PAST::Val nodes are allowed to
@@ -2253,8 +2254,13 @@
.tailcall self.'vivify'(node, ops, fetchop, storeop)
attribute_bind:
- $P0 = get_hll_global ['POST'], 'Op'
- .tailcall $P0.'new'(call_on, name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
+ $P0 = get_hll_global ['POST'], 'Ops'
+ $P0 = $P0.'new'()
+ $P0.'push'(call_on)
+ $P1 = get_hll_global ['POST'], 'Op'
+ $P1 = $P1.'new'(call_on, name, bindpost, 'pirop'=>'setattribute', 'result'=>bindpost)
+ $P0.'push'($P1)
+ .return ($P0)
.end
Modified: branches/context_pmc3/compilers/pge/PGE/Match.pir
==============================================================================
--- branches/context_pmc3/compilers/pge/PGE/Match.pir Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/compilers/pge/PGE/Match.pir Tue Aug 25 23:47:19 2009 (r40804)
@@ -243,7 +243,7 @@
=cut
.sub 'orig' :method
- $P0 = getattribute self, '$!target'
+ $P0 = getattribute self, '$.target'
.return ($P0)
.end
Modified: branches/context_pmc3/docs/book/pir/ch04_variables.pod
==============================================================================
--- branches/context_pmc3/docs/book/pir/ch04_variables.pod Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/docs/book/pir/ch04_variables.pod Tue Aug 25 23:47:19 2009 (r40804)
@@ -131,18 +131,18 @@
=head3 Floating-point operations
-The most common floating-point operations are C<ln>X<ln opcode> (natural
-log), C<log2>X<log2 opcode> (log base 2), C<log10>X<log10 opcode> (log
-base 10), and C<exp>X<exp opcode> (I<e>G<x>), as well as a full set of
-trigonometric opcodes such as C<sin>X<sin opcode> (sine), C<cos>X<cos
-opcode> (cosine), C<tan>X<tan opcode> (tangent), C<sec>X<sec opcode>
-(secant), C<cosh>X<cosh opcode> (hyperbolic cosine), C<tanh>X<tanh
+The most common floating-point operations are C<ln>X<ln opcode> (natural log),
+C<log2>X<log2 opcode> (log base 2), C<log10>X<log10 opcode> (log base 10), and
+C<exp>X<exp opcode> (I<e>G<x>), as well as a full set of trigonometric opcodes
+such as C<sin>X<sin opcode> (sine), C<cos>X<cos opcode> (cosine), C<tan>X<tan
+opcode> (tangent), C<sec>X<sec opcode> (secant), C<sinh>X<sinh opcode>
+(hyperbolic sine), C<cosh>X<cosh opcode> (hyperbolic cosine), C<tanh>X<tanh
opcode> (hyperbolic tangent), C<sech>X<sech opcode> (hyperbolic secant),
C<asin>X<asin opcode> (arc sine), C<acos>X<acos opcode> (arc cosine),
-C<atan>C<atan opcode> (arc tangent), C<asec>X<asec opcode> (arc secant),
+C<atan>X<atan opcode> (arc tangent), C<asec>X<asec opcode> (arc secant),
C<exsec>X<exsec opcode> (exsecant), C<hav>X<hav opcode> (haversine), and
-C<vers>X<vers opcode> (versine). All angle arguments for the
-X<trigonometric opcodes> trigonometric opcodes are in radians:
+C<vers>X<vers opcode> (versine). All angle arguments for the X<trigonometric
+opcodes> trigonometric opcodes are in radians:
=begin PIR_FRAGMENT
Modified: branches/context_pmc3/editor/README.pod
==============================================================================
--- branches/context_pmc3/editor/README.pod Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/editor/README.pod Tue Aug 25 23:47:19 2009 (r40804)
@@ -85,11 +85,19 @@
=head2 TAGS file
There is a script here to automatically generate a TAGS file, which works with
-Vim and other editors that recognize ctags-format files. The tool "exuberant
-ctags" is required. Run
+Vim and other editors that recognize ctags-format files. Run
- make tags
+ make tags-vi
-in the parrot root directory to build the tags file.
+for Vim-compatible tags or
+
+ make tags-emacs
+
+for Emacs-style tags. The tool "exuberant ctags" is required for both. There
+is also the
+
+ make tags-xemacs
+
+target which will work with older XEmacs etags (21.5*).
=cut
Modified: branches/context_pmc3/src/dynpmc/subproxy.pmc
==============================================================================
--- branches/context_pmc3/src/dynpmc/subproxy.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/dynpmc/subproxy.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -1,6 +1,6 @@
/*
* $Id$
- * Copyright (C) 2003-2008, Parrot Foundation.
+ * Copyright (C) 2003-2009, Parrot Foundation.
*/
/*
@@ -14,7 +14,7 @@
*/
#define enum_class_SubProxy -1
-pmclass SubProxy dynpmc extends Sub {
+pmclass SubProxy dynpmc extends Sub auto_attrs {
VTABLE void init() {
SUPER();
Modified: branches/context_pmc3/src/gc/mark_sweep.c
==============================================================================
--- branches/context_pmc3/src/gc/mark_sweep.c Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/gc/mark_sweep.c Tue Aug 25 23:47:19 2009 (r40804)
@@ -779,6 +779,18 @@
if (PObj_active_destroy_TEST(p))
VTABLE_destroy(interp, pmc);
+ if (PMC_data(pmc) && pmc->vtable->attr_size) {
+#if GC_USE_FIXED_SIZE_ALLOCATOR
+ Parrot_gc_free_pmc_attributes(interp, pmc, pmc->vtable->attr_size);
+#else
+ mem_sys_free(PMC_data(pmc));
+ PMC_data(pmc) = NULL;
+#endif
+ }
+ else {
+ PMC_data(pmc) = NULL;
+ }
+
#ifndef NDEBUG
pmc->vtable = (VTABLE *)0xdeadbeef;
Modified: branches/context_pmc3/src/oo.c
==============================================================================
--- branches/context_pmc3/src/oo.c Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/oo.c Tue Aug 25 23:47:19 2009 (r40804)
@@ -143,14 +143,7 @@
/* Look up the name of the vtable function from the index. */
const INTVAL vtable_index = Parrot_str_to_int(interp, vtable_index_str);
const char * const meth_c = Parrot_vtable_slot_names[vtable_index];
- STRING *vtable_name = Parrot_str_new(interp, meth_c, 0);
-
- /* Strip leading underscores in the vtable name */
- if (Parrot_str_find_index(interp, vtable_name, CONST_STRING(interp, "__"), 0) == 0) {
- vtable_name = Parrot_str_substr(interp, vtable_name, 2,
- Parrot_str_byte_length(interp, vtable_name) - 2, NULL, 0);
- }
-
+ STRING * const vtable_name = Parrot_str_new(interp, meth_c, 0);
VTABLE_add_vtable_override(interp, self, vtable_name, vtable_sub);
}
}
@@ -279,8 +272,7 @@
if (!PMC_IS_NULL(dest)) {
PARROT_ASSERT(!PMC_IS_NULL(class_));
PARROT_ASSERT(class_->vtable->base_type == enum_class_Class);
- obj = (Parrot_Object_attributes *)
- Parrot_oo_new_object_attrs(interp, class_);
+ obj = PARROT_OBJECT(pmc);
cloned = dest;
}
else {
@@ -330,10 +322,6 @@
}
}
- /* free object attributes if created directly */
- if (!PMC_IS_NULL(dest))
- mem_sys_free(obj);
-
/* And we have ourselves a clone. */
return cloned;
}
@@ -385,10 +373,17 @@
get_pmc_proxy(PARROT_INTERP, INTVAL type)
{
ASSERT_ARGS(get_pmc_proxy)
+ PMC * type_class;
/* Check if not a PMC or invalid type number */
if (type > interp->n_vtable_max || type <= 0)
return PMCNULL;
+
+ type_class = interp->vtables[type]->pmc_class;
+ if (type != enum_class_Class
+ && type_class->vtable->base_type == enum_class_Class) {
+ return type_class;
+ }
else {
PMC * const parrot_hll = Parrot_get_namespace_keyed_str(interp, interp->root_namespace, CONST_STRING(interp, "parrot"));
PMC * const pmc_ns =
@@ -521,12 +516,7 @@
PMC *result =
VTABLE_get_pmc_keyed_str(interp, _class->parent_overrides, name);
- if (!PMC_IS_NULL(result)) {
- return result;
- }
- else if (VTABLE_exists_keyed_str(interp, _class->parent_overrides, name))
- return PMCNULL;
- else {
+ if (PMC_IS_NULL(result)) {
/* Walk and search for the vtable method. */
const INTVAL num_classes = VTABLE_elements(interp, _class->all_parents);
INTVAL i;
@@ -542,11 +532,13 @@
if (!PMC_IS_NULL(result))
break;
}
-
+ if (PMC_IS_NULL(result))
+ result = pmc_new(interp, enum_class_Undef);
VTABLE_set_pmc_keyed_str(interp, _class->parent_overrides, name, result);
-
- return result;
}
+ if (result->vtable->base_type == enum_class_Undef)
+ result = PMCNULL;
+ return result;
}
Modified: branches/context_pmc3/src/pmc/addrregistry.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/addrregistry.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/addrregistry.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2005-2008, Parrot Foundation.
+Copyright (C) 2005-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -29,7 +29,7 @@
#include "parrot/hash.h"
#include "pmc_hash.h"
-pmclass AddrRegistry extends Hash provides hash {
+pmclass AddrRegistry extends Hash provides hash auto_attrs {
/*
=item C<void init()>
@@ -48,8 +48,8 @@
key_hash_int);
Parrot_AddrRegistry_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_AddrRegistry_attributes);
- PMC_data(SELF) = attrs;
+ (Parrot_AddrRegistry_attributes *) PMC_data(SELF);
+
SELF.set_pointer(registry);
PObj_custom_mark_destroy_SETALL(SELF);
Modified: branches/context_pmc3/src/pmc/class.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/class.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/class.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -1229,9 +1229,14 @@
/* Initialize the object's underlying structure, pointing it to this
* class. */
- PMC_data(object) =
- (Parrot_Object_attributes *)Parrot_oo_new_object_attrs(interp, SELF);
-
+ /* TODO: this has been changed in order to use auto_attrs in the
+ * Object PMC. Needs to be redone in a cleaner way. */
+ {
+ Parrot_Object_attributes * const objattr =
+ (Parrot_Object_attributes *)PMC_data(object);
+ objattr->_class = SELF;
+ objattr->attrib_store = pmc_new(interp, enum_class_ResizablePMCArray);
+ }
if (!PMC_IS_NULL(init)) {
/* Initialize attributes with the supplied values. */
PMC * const iter = VTABLE_get_iter(interp, init);
@@ -1287,21 +1292,6 @@
/* Check if the class object is the same as self's class object */
if (VTABLE_is_same(interp, SELF, classobj))
return 1;
- else {
- STRING * const classname = VTABLE_get_string(interp, classobj);
- const INTVAL is_proxy = (SELF->vtable->base_type == enum_class_PMCProxy);
-
- /* avoid the expensive string copy, if possible */
- STRING * const self_name = is_proxy
- ? VTABLE_get_string(interp, SELF)
- : make_class_name(interp, SELF);
-
- /* Check if the passed name is the same as the stored short name. */
- const INTVAL name_match = Parrot_str_equal(interp, classname, self_name);
-
- if (name_match)
- return 1;
- }
/* Iterate over all the parents and check if they respond true
* for 'isa' on the original comparison. */
Modified: branches/context_pmc3/src/pmc/coroutine.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/coroutine.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/coroutine.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -56,7 +56,7 @@
print_pbc_location(interp);
}
-pmclass Coroutine extends Sub {
+pmclass Coroutine extends Sub auto_attrs {
ATTR PackFile_ByteCode *caller_seg; /* bytecode segment */
ATTR opcode_t *address; /* next address to run - toggled each time */
@@ -76,11 +76,10 @@
VTABLE void init() {
Parrot_Coroutine_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_Coroutine_attributes);
+ (Parrot_Coroutine_attributes *) PMC_data(SELF);
attrs->seg = INTERP->code;
attrs->ctx = NULL;
- PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
Modified: branches/context_pmc3/src/pmc/eval.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/eval.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/eval.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2001-2008, Parrot Foundation.
+Copyright (C) 2001-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -125,7 +125,7 @@
}
}
-pmclass Eval extends Sub {
+pmclass Eval extends Sub auto_attrs {
VTABLE void init() {
Parrot_Sub_attributes *sub_data;
Modified: branches/context_pmc3/src/pmc/eventhandler.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/eventhandler.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/eventhandler.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -19,7 +19,7 @@
*/
-pmclass EventHandler extends Sub {
+pmclass EventHandler extends Sub auto_attrs {
ATTR STRING *type; /* the type of the event to handle */
ATTR PMC *code; /* the code object to execute */
@@ -38,13 +38,8 @@
*/
VTABLE void init() {
- Parrot_EventHandler_attributes *e =
- mem_allocate_zeroed_typed(Parrot_EventHandler_attributes);
-
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
-
- PMC_data(SELF) = e;
}
/*
@@ -84,7 +79,8 @@
PMC *interpreter = PMCNULL;
STRING *type = NULL;
INTVAL priority = 0;
- Parrot_EventHandler_attributes *e = NULL;
+ Parrot_EventHandler_attributes *e =
+ (Parrot_EventHandler_attributes *) PMC_data(SELF);
if (VTABLE_isa(INTERP, data, CONST_STRING(INTERP, "Sub"))) {
code = data;
@@ -104,12 +100,9 @@
interpreter = VTABLE_get_pmc_keyed_int(INTERP,
INTERP->iglobals, IGLOBALS_INTERPRETER);
- e = mem_allocate_zeroed_typed(Parrot_EventHandler_attributes);
-
PObj_custom_mark_SET(SELF);
PObj_active_destroy_SET(SELF);
- PMC_data(SELF) = e;
e->type = type;
e->code = code;
e->interp = interpreter;
Modified: branches/context_pmc3/src/pmc/exception.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/exception.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/exception.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -643,7 +643,7 @@
else if (Parrot_str_equal(INTERP, name, CONST_STRING(INTERP, "thrower"))) {
/* Ensure it's a ret cont, and extract the from_ctx.
* XXX TT#596 - when we have Context PMCs, just take and set that. */
- if (VTABLE_isa(interp, value, CONST_STRING(interp, "Continuation"))) {
+ if (!PMC_IS_NULL(value) && VTABLE_isa(interp, value, CONST_STRING(interp, "Continuation"))) {
PMC *ctx = PMC_cont(value)->from_ctx;
if (!PMC_IS_NULL(ctx)) {
SET_ATTR_thrower(interp, SELF, ctx);
Modified: branches/context_pmc3/src/pmc/hash.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/hash.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/hash.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -376,7 +376,7 @@
/* Needs ext struct for the next_for_GC pointer
* We would get recursive marking of a deeply nested HoHoH...
*/
-pmclass Hash provides hash {
+pmclass Hash provides hash auto_attrs {
ATTR Hash *hash;
/*
@@ -395,9 +395,8 @@
VTABLE void init() {
Parrot_Hash_attributes * const attr =
- mem_allocate_typed(Parrot_Hash_attributes);
+ (Parrot_Hash_attributes *) PMC_data(SELF);
- PMC_data(SELF) = attr;
attr->hash = parrot_new_hash(INTERP);
attr->hash->container = SELF;
PObj_custom_mark_destroy_SETALL(SELF);
@@ -407,9 +406,6 @@
Hash * const hash = (Hash *)SELF.get_pointer();
if (hash)
parrot_hash_destroy(INTERP, hash);
-
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
Modified: branches/context_pmc3/src/pmc/lexinfo.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/lexinfo.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/lexinfo.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2008, Parrot Foundation.
+Copyright (C) 2008-2009, Parrot Foundation.
$Id$
=head1 NAME
@@ -26,7 +26,7 @@
* keys and integer indices
*/
-pmclass LexInfo extends Hash provides hash no_ro {
+pmclass LexInfo extends Hash provides hash no_ro auto_attrs {
/*
@@ -60,7 +60,8 @@
VTABLE void init_pmc(PMC *sub) {
Hash *hash;
Parrot_LexInfo_attributes *attrs =
- mem_allocate_zeroed_typed(Parrot_LexInfo_attributes);
+ (Parrot_LexInfo_attributes *) PMC_data(SELF);
+
PARROT_ASSERT(PObj_constant_TEST(SELF));
hash = parrot_create_hash(INTERP,
@@ -69,7 +70,6 @@
(hash_comp_fn)Parrot_str_not_equal, /* STRING compare */
(hash_hash_key_fn)Parrot_str_to_hashval); /* hash */
- PMC_data(SELF) = attrs;
SELF.set_pointer(hash);
PObj_active_destroy_SET(SELF);
}
Modified: branches/context_pmc3/src/pmc/namespace.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/namespace.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/namespace.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -123,7 +123,7 @@
#define FPA_is_ns_ext PObj_private0_FLAG
-pmclass NameSpace extends Hash provides hash no_ro {
+pmclass NameSpace extends Hash provides hash no_ro auto_attrs {
ATTR STRING *name; /* Name of this namespace part. */
ATTR PMC *_class; /* The class or role attached to this namespace. */
@@ -144,8 +144,6 @@
*/
VTABLE void init() {
- PMC_data(SELF) =
- mem_allocate_zeroed_typed(Parrot_NameSpace_attributes);
PARROT_NAMESPACE(SELF)->vtable = PMCNULL;
PARROT_NAMESPACE(SELF)->_class = PMCNULL;
SELF.set_pointer(parrot_new_hash(INTERP));
@@ -178,20 +176,6 @@
/*
-=item C<void destroy()>
-
-Frees the namespace info struct.
-
-=cut
-
-*/
- VTABLE void destroy() {
- /* Call Hash.destroy. It will free all memory. */
- SUPER();
- }
-
-/*
-
=item C<PMC *get_class()>
Returns the class or role PMC that is associated with this namespace.
Modified: branches/context_pmc3/src/pmc/object.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/object.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/object.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -107,7 +107,7 @@
return -1;
}
-pmclass Object {
+pmclass Object auto_attrs {
ATTR PMC *_class; /* The class this is an instance of. */
ATTR PMC *attrib_store; /* The attributes store - a resizable PMC array. */
@@ -146,14 +146,12 @@
=item C<void destroy()>
-Free the object's underlying struct.
+Just to avoid the automatic generation of one.
=cut
*/
VTABLE void destroy() {
- mem_sys_free(PMC_data(SELF));
- PMC_data(SELF) = NULL;
}
/*
@@ -644,26 +642,16 @@
*/
VTABLE PMC * clone() {
- Parrot_Object_attributes * const obj = PARROT_OBJECT(pmc);
- Parrot_Class_attributes * const _class = PARROT_CLASS(obj->_class);
- STRING * const meth_name = CONST_STRING(interp, "clone");
-
- /* See if we have a custom override of the method first. */
- const int num_classes = VTABLE_elements(interp, _class->all_parents);
- int i;
- for (i = 0; i < num_classes; i++) {
- /* Get the class. */
- PMC * const cur_class = VTABLE_get_pmc_keyed_int(interp, _class->all_parents, i);
-
- /* Look for a method and run it if we find one. */
- PMC * const meth =
- Parrot_oo_find_vtable_override_for_class(interp, cur_class, meth_name);
- if (!PMC_IS_NULL(meth))
- return (PMC*)Parrot_run_meth_fromc_args(interp, meth, pmc, meth_name, "P");
- }
-
- /* If we get here, no custom clone. Create a new object PMC. */
- return Parrot_oo_clone_object(interp, SELF, obj->_class, NULL);
+ Parrot_Object_attributes * const obj = PARROT_OBJECT(pmc);
+ /* If we have a custom override, invoke it.
+ * If not, use the oo function. */
+ STRING * const meth_name = CONST_STRING(interp, "clone");
+ PMC * const meth =
+ Parrot_oo_find_vtable_override(interp, obj->_class, meth_name);
+ if (!PMC_IS_NULL(meth))
+ return (PMC*)Parrot_run_meth_fromc_args(interp, meth, pmc, meth_name, "P");
+ else
+ return Parrot_oo_clone_object(interp, SELF, obj->_class, NULL);
}
/*
Modified: branches/context_pmc3/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/parrotinterpreter.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/parrotinterpreter.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -184,7 +184,7 @@
return ret;
}
-pmclass ParrotInterpreter need_ext no_ro {
+pmclass ParrotInterpreter no_ro {
ATTR struct parrot_interp_t *interp; /* this PMC's interpreter */
ATTR INTVAL tid; /* thread id */
ATTR PMC *args; /* args passed to this thread */
Modified: branches/context_pmc3/src/pmc/scheduler.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/scheduler.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/scheduler.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -246,7 +246,10 @@
*/
VTABLE void destroy() {
Parrot_Scheduler_attributes * const core_struct = PARROT_SCHEDULER(SELF);
- MUTEX_DESTROY(core_struct->msg_lock);
+ /* TT #946: this line is causing an order-of-destruction error
+ because the scheduler is being freed before it's tasks.
+ Commenting this out till we get a real fix (although it's a hack) */
+ /* MUTEX_DESTROY(core_struct->msg_lock); */
}
Modified: branches/context_pmc3/src/pmc/sub.pmc
==============================================================================
--- branches/context_pmc3/src/pmc/sub.pmc Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/src/pmc/sub.pmc Tue Aug 25 23:47:19 2009 (r40804)
@@ -35,7 +35,7 @@
print_pbc_location(interp);
}
-pmclass Sub {
+pmclass Sub auto_attrs {
ATTR PackFile_ByteCode *seg; /* bytecode segment */
ATTR size_t start_offs; /* sub entry in ops from seg->base.data */
ATTR size_t end_offs;
@@ -90,11 +90,10 @@
*/
VTABLE void init() {
Parrot_Sub_attributes * const attrs =
- mem_allocate_zeroed_typed(Parrot_Sub_attributes);
+ (Parrot_Sub_attributes *) PMC_data(SELF);
attrs->seg = INTERP->code;
- PMC_data(SELF) = attrs;
PObj_custom_mark_destroy_SETALL(SELF);
}
@@ -114,11 +113,7 @@
if (sub) {
if (sub->arg_info)
mem_sys_free(sub->arg_info);
-
- mem_sys_free(sub);
}
-
- PMC_data(SELF) = NULL;
}
/*
Modified: branches/context_pmc3/t/op/arithmetics.t
==============================================================================
--- branches/context_pmc3/t/op/arithmetics.t Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/t/op/arithmetics.t Tue Aug 25 23:47:19 2009 (r40804)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 31;
+use Parrot::Test tests => 21;
# test for GMP
use Parrot::Config;
@@ -594,213 +594,6 @@
OUTPUT
}
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - basic arith" );
-.sub 'test' :main
- $N0 = 'Inf'
- say $N0
- $N0 -= $N0
- say $N0
- $N0 *= -1
- say $N0
- $N0 *= 0
- say $N0
- $N0 += 5
- say $N0
- $N0 -= 42
- say $N0
-.end
-CODE
-Inf
-NaN
-NaN
-NaN
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - exp" );
-.sub 'test' :main
- $N0 = 'Inf'
- $N1 = exp $N0
- say $N1
- $N0 = '-Inf'
- $N1 = exp $N0
- say $N1
- $N0 = 'NaN'
- $N1 = exp $N0
- say $N1
-.end
-CODE
-Inf
-0
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - sin" );
-.sub 'test' :main
- $N0 = 'Inf'
- $N1 = sin $N0
- say $N1
- $N0 = '-Inf'
- $N1 = sin $N0
- say $N1
- $N0 = 'NaN'
- $N1 = sin $N0
- say $N1
-.end
-CODE
-NaN
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - tan" );
-.sub 'test' :main
- $N0 = 'Inf'
- $N1 = tan $N0
- say $N1
- $N0 = '-Inf'
- $N1 = tan $N0
- say $N1
- $N0 = 'NaN'
- $N1 = tan $N0
- say $N1
-.end
-CODE
-NaN
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - cos" );
-.sub 'test' :main
- $N0 = 'Inf'
- $N1 = cos $N0
- say $N1
- $N0 = '-Inf'
- $N1 = cos $N0
- say $N1
- $N0 = 'NaN'
- $N1 = cos $N0
- say $N1
-.end
-CODE
-NaN
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - ln" );
-.sub 'test' :main
- $N0 = 'Inf'
- $N1 = ln $N0
- say $N1
- $N0 = '-Inf'
- $N1 = ln $N0
- say $N1
- $N0 = 'NaN'
- $N1 = ln $N0
- say $N1
-.end
-CODE
-Inf
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - pow" );
-.sub 'test' :main
- $N0 = 'Inf'
- pow $N1, $N0, 2
- say $N1
- pow $N1, 2, $N0
- say $N1
- $N0 = 'NaN'
- pow $N1, $N0, 2
- say $N1
- pow $N1, 2, $N0
- say $N1
-.end
-CODE
-Inf
-Inf
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Mixing NaN and Inf should give NaN" );
-.sub 'test' :main
- $N0 = 'NaN'
- $N1 = 'Inf'
- $N0 *= $N1
- say $N0
- $N0 /= $N1
- say $N0
- $N0 -= $N1
- say $N0
- $N0 += $N1
- say $N0
-.end
-CODE
-NaN
-NaN
-NaN
-NaN
-OUTPUT
-
-pir_output_is( <<'CODE', <<OUTPUT, "Inf/NaN - rounding" );
-.sub 'test' :main
- $N0 = 'NaN'
- $N1 = floor $N0
- say $N1
- $N2 = ceil $N0
- say $N2
- $N0 = 'Inf'
- $N1 = floor $N0
- say $N1
- $N2 = ceil $N0
- say $N2
- $N0 = '-Inf'
- $N1 = floor $N0
- say $N1
- $N2 = ceil $N0
- say $N2
-.end
-CODE
-NaN
-NaN
-Inf
-Inf
--Inf
--Inf
-OUTPUT
-
-TODO: {
-
-local $TODO = 'rounding nan/inf gives something like -2147483648';
-pir_output_is(<<'CODE',<<OUTPUT, "TT #370 Rounding inf/nan");
-.sub 'main'
- $N0 = 'Inf'
- $I0 = floor $N0
- say $I0
- $N0 = 'NaN'
- $I0 = floor $N0
- say $I0
- $N0 = 'Inf'
- $I0 = ceil $N0
- say $I0
- $N0 = 'NaN'
- $I0 = ceil $N0
- say $I0
- .end
-CODE
-Inf
-NaN
-Inf
-NaN
-OUTPUT
-
-}
# Local Variables:
# mode: cperl
Modified: branches/context_pmc3/t/op/inf_nan.t
==============================================================================
--- branches/context_pmc3/t/op/inf_nan.t Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/t/op/inf_nan.t Tue Aug 25 23:47:19 2009 (r40804)
@@ -7,7 +7,7 @@
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 27;
+use Parrot::Test tests => 32;
=head1 NAME
@@ -575,6 +575,74 @@
OUTPUT
}
+{
+local $TODO = 'fdiv/mod/cmod do not play nicely with PMCs and NaN';
+pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Integer PMCs and NaN');
+.sub main
+ $P1 = new "Integer"
+ $P2 = new "Integer"
+ $P2 = 1
+ $N0 = 'NaN'
+ fdiv $P1, $P2, $N0
+ say $P1
+.end
+CODE
+NaN
+OUTPUT
+
+pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Float PMCs and NaN');
+.sub main
+ $P1 = new 'Float'
+ $P2 = new 'Float'
+ $P2 = 1
+ $N0 = 'NaN'
+ fdiv $P1, $P2, $N0
+ say $P1
+.end
+CODE
+NaN
+OUTPUT
+
+pir_output_is(<<'CODE',<<OUTPUT,'fdiv with Float and Integer PMCs and NaN');
+.sub main
+ $P1 = new 'Float'
+ $P2 = new 'Integer'
+ $P2 = 1
+ $N0 = 'NaN'
+ fdiv $P1, $P2, $N0
+ say $P1
+.end
+CODE
+NaN
+OUTPUT
+
+pir_output_is(<<'CODE',<<OUTPUT,'cmod with Float and Integer PMCs and NaN');
+.sub main
+ $P1 = new 'Float'
+ $P2 = new 'Integer'
+ $P2 = 1
+ $N0 = 'NaN'
+ cmod $P1, $P2, $N0
+ say $P1
+.end
+CODE
+NaN
+OUTPUT
+
+pir_output_is(<<'CODE',<<OUTPUT,'mod with Float and Integer PMCs and NaN');
+.sub main
+ $P1 = new 'Float'
+ $P2 = new 'Integer'
+ $P2 = 1
+ $N0 = 'NaN'
+ mod $P1, $P2, $N0
+ say $P1
+.end
+CODE
+NaN
+OUTPUT
+}
+
# Local Variables:
# mode: cperl
# cperl-indent-level: 4
Modified: branches/context_pmc3/t/pmc/threads.t
==============================================================================
--- branches/context_pmc3/t/pmc/threads.t Tue Aug 25 23:30:41 2009 (r40803)
+++ branches/context_pmc3/t/pmc/threads.t Tue Aug 25 23:47:19 2009 (r40804)
@@ -535,7 +535,7 @@
OUTPUT
}
-pir_output_is( <<'CODE', <<'OUTPUT', "CLONE_CODE | CLONE_CLASSES; superclass built-in" );
+pir_output_is( <<'CODE', <<'OUTPUT', "CLONE_CODE | CLONE_CLASSES; superclass built-in", todo => 'likely incorrect test');
.namespace [ 'Foo' ]
.sub foometh :method
More information about the parrot-commits
mailing list