[svn:parrot] r38030 - in trunk: . src/pmc t/op t/pmc
cotto at svn.parrot.org
cotto at svn.parrot.org
Fri Apr 10 20:08:12 UTC 2009
Author: cotto
Date: Fri Apr 10 20:08:11 2009
New Revision: 38030
URL: https://trac.parrot.org/parrot/changeset/38030
Log:
[PMC] remove Ref and SharedRef, bump PBC_COMPAT
Deleted:
trunk/src/pmc/ref.pmc
trunk/src/pmc/sharedref.pmc
trunk/t/pmc/ref.t
trunk/t/pmc/sharedref.t
Modified:
trunk/DEPRECATED.pod
trunk/MANIFEST
trunk/PBC_COMPAT
trunk/t/op/gc.t
trunk/t/pmc/threads.t
Modified: trunk/DEPRECATED.pod
==============================================================================
--- trunk/DEPRECATED.pod Fri Apr 10 19:47:07 2009 (r38029)
+++ trunk/DEPRECATED.pod Fri Apr 10 20:08:11 2009 (r38030)
@@ -46,10 +46,6 @@
L<https://trac.parrot.org/parrot/ticket/189>
-=item ref [eligible in 1.1]
-
-L<https://trac.parrot.org/parrot/ticket/190>
-
=item moved to dynpmc [eligible in 1.1]
AddrRegistry, CodeString, Env, Eval, File, OS, PCCMETHOD_Test, StringHandle,
Modified: trunk/MANIFEST
==============================================================================
--- trunk/MANIFEST Fri Apr 10 19:47:07 2009 (r38029)
+++ trunk/MANIFEST Fri Apr 10 20:08:11 2009 (r38030)
@@ -1,7 +1,7 @@
# ex: set ro:
# $Id$
#
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Apr 1 16:50:29 2009 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Fri Apr 10 19:51:49 2009 UT
#
# See tools/dev/install_files.pl for documentation on the
# format of this file.
@@ -1431,7 +1431,6 @@
src/pmc/pmcproxy.pmc [devel]src
src/pmc/pointer.pmc [devel]src
src/pmc/random.pmc [devel]src
-src/pmc/ref.pmc [devel]src
src/pmc/resizablebooleanarray.pmc [devel]src
src/pmc/resizablefloatarray.pmc [devel]src
src/pmc/resizableintegerarray.pmc [devel]src
@@ -1442,7 +1441,6 @@
src/pmc/scalar.pmc [devel]src
src/pmc/scheduler.pmc [devel]src
src/pmc/schedulermessage.pmc [devel]src
-src/pmc/sharedref.pmc [devel]src
src/pmc/sockaddr.pmc [devel]src
src/pmc/socket.pmc [devel]src
src/pmc/string.pmc [devel]src
@@ -1888,7 +1886,6 @@
t/pmc/pointer.t [test]
t/pmc/prop.t [test]
t/pmc/random.t [test]
-t/pmc/ref.t [test]
t/pmc/resizablebooleanarray.t [test]
t/pmc/resizablefloatarray.t [test]
t/pmc/resizableintegerarray.t [test]
@@ -1900,7 +1897,6 @@
t/pmc/scalar.t [test]
t/pmc/scheduler.t [test]
t/pmc/schedulermessage.t [test]
-t/pmc/sharedref.t [test]
t/pmc/signal.t [test]
t/pmc/sockaddr.t [test]
t/pmc/socket.t [test]
Modified: trunk/PBC_COMPAT
==============================================================================
--- trunk/PBC_COMPAT Fri Apr 10 19:47:07 2009 (r38029)
+++ trunk/PBC_COMPAT Fri Apr 10 20:08:11 2009 (r38030)
@@ -27,6 +27,7 @@
# please insert tab separated entries at the top of the list
+4.5 2009.04.10 cotto removed Ref and SharedRef PMCs
4.4 2009.04.07 pmichaud find_caller_lex added
4.3 2009.03.25 jonathan socket opcodes added
4.2 2009.03.21 cotto removed Bound_NCI PMC
Deleted: trunk/src/pmc/ref.pmc
==============================================================================
--- trunk/src/pmc/ref.pmc Fri Apr 10 20:08:11 2009 (r38029)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,164 +0,0 @@
-/*
-Copyright (C) 2001-2008, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/ref.pmc - Reference to a PMC
-
-=head1 DESCRIPTION
-
-The vtable functions for the Ref base class.
-
-All methods not present below get a default body autogenerated inside
-C<Parrot::Pmc2c>.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-
-pmclass Ref provides ref {
-
-/*
-
-=item C<void init()>
-
-Sets the referenced PMC to C<PMCNULL>.
-
-=cut
-
-*/
-
- VTABLE void init() {
- SELF.init_pmc(PMCNULL);
- }
-
- VTABLE void destroy() {
- SELF.init_pmc(NULL);
- /* don't pass it on */
- }
-
-/*
-
-=item C<void init_pmc(PMC *initializer)>
-
-Sets the referenced PMC to C<initializer>.
-
-=cut
-
-*/
-
- VTABLE void init_pmc(PMC *initializer) {
- /* the referred PMC itself */
- PMC_pmc_val(SELF) = initializer;
- PObj_custom_mark_SET(SELF);
-
- /* if referred PMC needs active destruction we have to pass it on */
- if (initializer && PObj_active_destroy_TEST(initializer))
- PObj_active_destroy_SET(SELF);
- }
-
-/*
-
-=item C<void set_pmc(PMC *other)>
-
-Sets the referenced PMC to C<*other>.
-
-=item C<PMC *get_pmc()>
-
-Get the referenced PMC.
-
-=cut
-
-*/
-
- VTABLE void set_pmc(PMC *other) {
- PObj_active_destroy_CLEAR(SELF);
- GC_WRITE_BARRIER(INTERP, SELF, PMC_pmc_val(SELF), other);
- SELF.init_pmc(other);
- }
-
- VTABLE void assign_pmc(PMC *other) {
- SELF.set_pmc(other);
- }
-
- VTABLE PMC *get_pmc() {
- return PMC_pmc_val(SELF);
- }
-
-/*
-
-=item C<INTVAL type()>
-
-Returns the PMC's type.
-
-=cut
-
-*/
-
- VTABLE INTVAL type() {
- return VTABLE_type(interp, PMC_pmc_val(SELF));
- }
-
-/*
-
-=item C<void mark()>
-
-Marks the referenced PMC as live.
-
-=cut
-
-*/
-
- VTABLE void mark() {
- pobject_lives(INTERP, (PObj *)PMC_pmc_val(SELF));
- }
-
-/*
-
-=back
-
-These two methods must be implemented because they are not delegated.
-
-=over 4
-
-=item C<STRING *name()>
-
-Returns the name of the PMC, not the name of the referenced PMC.
-
-=cut
-
-*/
-
- VTABLE STRING *name() {
- return SUPER();
- }
-
-}
-
-/*
-
-=back
-
-=head1 HISTORY
-
-Initial revision by leo 2003.09.01.
-
-Allowed null value by TOGoS 2004.07.28 (evil+bad?)
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Deleted: trunk/src/pmc/sharedref.pmc
==============================================================================
--- trunk/src/pmc/sharedref.pmc Fri Apr 10 20:08:11 2009 (r38029)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,170 +0,0 @@
-/*
-Copyright (C) 2001-2008, Parrot Foundation.
-$Id$
-
-=head1 NAME
-
-src/pmc/sharedref.pmc - Shared PMC Reference
-
-=head1 DESCRIPTION
-
-The vtable functions for the SharedRef base class.
-
-This class wraps locking around PMC access.
-
-All methods not present below get a default body autogenerated inside
-C<Parrot::Pmc2c>.
-
-Currently all access is locked. When we have a non-copying GC allocator
-we can relax that a bit.
-
-=head2 Methods
-
-=over 4
-
-=cut
-
-*/
-
-#include "parrot/parrot.h"
-
-/*
- * TODO we should catch exceptions around these locks
- * if the vtable meth throws the lock is never unlocked
- */
-#define LOCK_PMC(interp, pmc) LOCK(PMC_sync(pmc)->pmc_lock);
-#define UNLOCK_PMC(interp, pmc) UNLOCK(PMC_sync(pmc)->pmc_lock);
-
-pmclass SharedRef provides ref need_ext is_shared extends Ref {
-
- VTABLE void init() {
- SUPER();
- }
-
-/*
-
-=item C<void init_pmc(PMC *init)>
-
-Initialize the shared reference.
-
-TODO - If the PMC we refer to is an aggregate (or has properties) then:
-
-=over 4
-
-=item *
-
-call C<share()> on the aggregate, which calls C<share()> on its contents
-- so getting aggregate members only yields shared PMCs
-
-=item *
-
-and unshare the aggregate itself, because we lock on behalf of the
-referee
-
-=back
-
-A direct dereference of the C<SharedRef> is currently not enabled so we
-shouldn't leak unshared PMCs into different threads.
-
-=cut
-
-*/
-
- VTABLE void init_pmc(PMC *initializer) {
- SUPER(initializer);
- PObj_active_destroy_SET(SELF);
- }
-
-/*
-
-=item C<void share()>
-
-We already share, so just ignore.
-
-=cut
-
-*/
-
- VTABLE void share() {
- }
-
-/*
-
-=item C<void mark()>
-
-Marks the reference as live.
-
-=cut
-
-*/
-
- VTABLE void mark() {
- SUPER();
- }
-
-/*
-
-=item C<void set_pmc(PMC *other)>
-
-Sets the referenced PMC to C<*other>.
-
-=item C<PMC *get_pmc()>
-
-Catch dereferencing. This would unshare the referred PMC.
-
-=cut
-
-*/
-
- VTABLE void set_pmc(PMC *other) {
- SUPER(other);
- PObj_active_destroy_SET(SELF);
- }
-
- VTABLE PMC *get_pmc() {
- Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
- "deref not allowed");
- }
-
-/*
-
-=item C<void destroy()>
-
-Destroys the referred object and itself. This probably needs destroy ordering
-or at least a detection if the referred PMC is already destroyed.
-
-=cut
-
-*/
-
- VTABLE void destroy() {
- PMC * const ref = PMC_pmc_val(SELF);
-
- if (ref && PObj_active_destroy_TEST(ref))
- VTABLE_destroy(INTERP, ref);
-
- if (PMC_sync(SELF)->owner != INTERP)
- PANIC(INTERP, "SharedRef destroyed by wrong interpreter");
-
- SUPER();
- }
-}
-
-/*
-
-=back
-
-=head1 HISTORY
-
-Initial revision by leo 2004.01.14.
-
-=cut
-
-*/
-
-/*
- * Local variables:
- * c-file-style: "parrot"
- * End:
- * vim: expandtab shiftwidth=4:
- */
Modified: trunk/t/op/gc.t
==============================================================================
--- trunk/t/op/gc.t Fri Apr 10 19:47:07 2009 (r38029)
+++ trunk/t/op/gc.t Fri Apr 10 20:08:11 2009 (r38030)
@@ -6,7 +6,7 @@
use warnings;
use lib qw( . lib ../lib ../../lib );
use Test::More;
-use Parrot::Test tests => 19;
+use Parrot::Test tests => 18;
=head1 NAME
@@ -406,74 +406,6 @@
ok
OUTPUT
-pasm_output_is( <<'CODE', <<OUTPUT, "write barrier 3 - ref" );
- null I2
- set I3, 10
-lp3:
- null I0
- set I1, 100
- new P5, 'Ref'
- new P0, 'Integer'
- needs_destroy P0
- # force partial sweep
- # ref should now be black
- sweep 0
- # store white hash in ref - needs a barrier
- new P1, 'Hash'
- setref P5, P1
- null P1
- new P0, 'Integer'
- needs_destroy P0
- null P0
- # force full sweep
- sweep 0
- deref P1, P5
-lp1:
- new P0, 'Integer'
- new P2, 'Ref', P0
- set P0, I0
- set S0, I0
- set P1[S0], P2
- if I0, not_0
- new P0, 'Integer'
-not_0:
- new P3, 'Undef'
- new P4, 'Undef'
- inc I0
- lt I0, I1, lp1
-
- null I0
- deref P1, P5
- # trace 1
-lp2:
- set S0, I0
- set P2, P1[S0]
- deref P2, P2
- eq P2, I0, ok
- print "nok\n"
- print "I0: "
- print I0
- print " P2: "
- print P2
- print " type: "
- typeof S0, P2
- print S0
- print " I2: "
- print I2
- print "\n"
- exit 1
-ok:
- inc I0
- lt I0, I1, lp2
- inc I2
- lt I2, I3, lp3
- print "ok\n"
- end
-
-CODE
-ok
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUTPUT', "verify pmc proxy object marking" );
.sub main :main
.local pmc cl, s, t
Deleted: trunk/t/pmc/ref.t
==============================================================================
--- trunk/t/pmc/ref.t Fri Apr 10 20:08:11 2009 (r38029)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,210 +0,0 @@
-#! parrot
-# Copyright (C) 2001-2009, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/ref.t - Reference PMC
-
-=head1 SYNOPSIS
-
- % prove t/pmc/ref.t
-
-=head1 DESCRIPTION
-
-Tests that vtable method delegation works on a C<Ref> PMC.
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
- plan(42)
-
- basic_ref_tests()
- setref_tests()
- assign_ref_tests()
- sharedref_tests()
- interface_tests()
- set_get_tests()
- push_pop_tests()
- add_tests()
-.end
-
-
-.sub basic_ref_tests
- new $P2, ['Integer']
- new $P1, ['Ref'], $P2
- ok(1, "Ref creation didn't explode")
-
- inc $P1
- is($P2, 1, "inc ref incremented the referand")
- is($P1, 1, "inc ref incremented the ref")
-
- dec $P1
- is($P2, 0, "dec ref decremented the referand")
- is($P1, 0, "dec ref decremented the ref")
-
- deref $P3, $P1
- typeof $S0, $P1
- is($S0, 'Ref', "Ref has correct type")
- typeof $S0, $P3
- is($S0, 'Integer', "referand has correct type")
-.end
-
-.sub setref_tests
- new $P2, ['Integer']
- new $P3, ['Float']
- set $P3, 0.5
- new $P1, ['Ref'], $P2
- inc $P1
- is($P1, 1, "Integer Ref is incremented correctly")
- setref $P1, $P3
- inc $P1
- is($P1, 1.5, "Float Ref (formerly Int Ref) is incremented correctly")
- is($P2, 1, "Int formerly referred to by Ref stays the same")
- is($P3, 1.5, "new Float Ref has right value")
-.end
-
-.sub assign_ref_tests
- new $P2, ['Integer']
- new $P3, ['Float']
- set $P2, 0
- set $P3, 0.5
- new $P1, ['Ref'], $P2
- assign $P1, 1
- $I0 = $P1
- is($I0, 1, "Ref has correct value")
- $I0 = $P2
- is($I0, 1, "assigned Ref has correct value")
- assign $P1, $P3
- $N0 = $P1
- is($N0, 0.5, "assigned Ref has correct value")
- $I0 = $P2
- is($I0, 1, "previously assigned Ref maintained previous value")
- $N0 = $P3
- is($N0, 0.5, "assigned Ref has correct value")
-.end
-
-.sub sharedref_tests
- new $P2, ['Integer']
- new $P1, ['SharedRef'], $P2
- ok(1, "SharedRef created without explosion")
- set $P1, 4711
- is($P1, 4711, "SharedRef assignment looks good")
- typeof $S0, $P1
- is($S0, "Integer", "SharedRef type looks good")
- set $P1, "hello"
- typeof $S0, $P1
- is($S0, "String", "SharedRef type looks good after type change")
- is($P1, "hello", "SharedRef value looks good after type change")
-
- new $P2, ['Integer']
- new $P1, ['SharedRef'], $P2
- ok(1, "SharedRef creation didn't explode")
- push_eh eh
- deref $P3, $P1
- pop_eh
- ok(0, "deref of SharedRef didn't cause an exception")
- goto end
-eh:
- ok(1, "deref of SharedRef caused an exception")
-end:
-.end
-
-.sub interface_tests
- .local pmc pmc1
- pmc1 = new ['Array']
- .local pmc pmc2
- pmc2 = new ['Ref'], pmc1
- .local pmc pmc3
- pmc3 = new ['SharedRef'], pmc1
- .local int bool1
- does bool1, pmc2, "scalar"
- is(bool1, 0, "Ref doesn't do scalar")
- does bool1, pmc2, "array"
- is(bool1, 1, "Ref does do array")
- does bool1, pmc2, "no_interface"
- is(bool1, 0, "Ref doesn't do no_interface")
-
- does bool1, pmc3, "scalar"
- is(bool1, 0, "SharedRef doesn't do scalar")
- does bool1, pmc3, "array"
- is(bool1, 1, "SharedRef does do array")
- does bool1, pmc3, "no_interface"
- is(bool1, 0, "SharedRef doesn't do no_interface")
-.end
-
-
-.sub set_get_tests
- new $P2, ['Integer']
- new $P1, ['Ref'], $P2
- set $P1, 10
- is($P1, 10, "set works on Integer Ref")
- set $I0, $P1
- is($I0, 10, "get works on Integer Ref")
-
- new $P2, ['Float']
- new $P1, ['Ref'], $P2
- set $P1, 12.5
- set $N0, $P2
- set $N1, 12.5
- is($N0, $N1, "set works on Float Ref")
- set $N2, $P1
- is($N2, $N1, "get works on Float Ref")
-.end
-
-.sub push_pop_tests
- new $P2, ['ResizableIntegerArray']
- new $P1, ['Ref'], $P2
- push $P1, 200
- push $P1, -3
- set $I0, $P1
- is($I0, 2, "element count of array via Ref is correct")
- set $I0, $P2
- is($I0, 2, "direct element count of array is correct")
- pop $I1, $P1
- pop $I2, $P1
- is($I1, -3, "first element popped via Ref is correct")
- is($I2, 200, "second element popped via Ref is correct")
- set $I0, $P1
- is($I0, 0, "element count of array via Ref is correct")
-.end
-
-.sub add_tests
- new $P2, ['Integer']
- new $P1, ['Ref'], $P2
- set $P1, 10
- add $P1, $P1
- is($P2, 20, "add ref,ref is ok")
-
- new $P3, ['Integer']
- new $P2, ['Integer']
- new $P1, ['Ref'], $P2
- set $P3, 12
- set $P1, 10
- add $P1, $P3
- is($P2, 22, "add ref,int is ok")
-
- new $P3, ['Integer']
- new $P2, ['Integer']
- new $P1, ['Ref'], $P2
- set $P3, 12
- set $P1, 10
- add $P4, $P3, $P1
- is($P4, 22, "add dest,int,ref is ok")
-
- new $P3, ['Integer']
- new $P2, ['Integer']
- new $P1, ['Ref'], $P2
- set $P3, 12
- set $P1, 10
- add $P4, $P1, $P3
- is($P4, 22, "add dest,ref,int is ok")
-.end
-
-# Local Variables:
-# mode: pir
-# cperl-indent-level: 4
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Deleted: trunk/t/pmc/sharedref.t
==============================================================================
--- trunk/t/pmc/sharedref.t Fri Apr 10 20:08:11 2009 (r38029)
+++ /dev/null 00:00:00 1970 (deleted)
@@ -1,32 +0,0 @@
-#! parrot
-# Copyright (C) 2006-2008, Parrot Foundation.
-# $Id$
-
-=head1 NAME
-
-t/pmc/sharedref.t - test the SharedRef PMC
-
-=head1 SYNOPSIS
-
- % prove t/pmc/sharedref.t
-
-=head1 DESCRIPTION
-
-Tests the SharedRef PMC.
-
-=cut
-
-.sub main :main
- .include 'test_more.pir'
-
- plan(1)
-
- new $P0, ['SharedRef']
- ok(1, 'Instantiated a SharedRef PMC')
-.end
-
-# Local Variables:
-# mode: pir
-# fill-column: 100
-# End:
-# vim: expandtab shiftwidth=4 ft=pir:
Modified: trunk/t/pmc/threads.t
==============================================================================
--- trunk/t/pmc/threads.t Fri Apr 10 19:47:07 2009 (r38029)
+++ trunk/t/pmc/threads.t Fri Apr 10 20:08:11 2009 (r38030)
@@ -46,7 +46,7 @@
}
}
if ( $platforms{$^O} ) {
- plan tests => 15;
+ plan tests => 14;
}
else {
plan skip_all => "No threading yet or test not enabled for '$^O'";
@@ -288,42 +288,6 @@
500500
OUTPUT
-pir_output_is( <<'CODE', <<'OUTPUT', "share a PMC" );
-.sub main :main
- .local pmc foo
- foo = get_global "_foo"
- .local pmc to_share
- to_share = new ['Integer']
- .local pmc shared_ref
- shared_ref = new ['SharedRef'], to_share
- shared_ref = 20
- .local pmc thread
- thread = new ['ParrotThread']
- thread.'run_clone'(foo, shared_ref)
-
- sleep 0.1 # to let the thread run
-
- .local pmc result
- thread.'join'()
- print "done\n"
- print shared_ref
- print "\n"
-.end
-
-.sub _foo
- .param pmc shared_ref
- print "thread\n"
- print shared_ref
- print "\n"
- inc shared_ref
-.end
-CODE
-thread
-20
-done
-21
-OUTPUT
-
pir_output_is( <<'CODE', <<'OUT', "sub name lookup in new thread" );
.sub check
$P0 = get_global ['Foo'], 'foo'
More information about the parrot-commits
mailing list