[perl #41837] [PATCH] integer overflow in include/parrot/sub.h

2007-03-15 Thread via RT
# New Ticket Created by   
# Please include the string:  [perl #41837]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41837 >


Index: include/parrot/sub.h
===
--- include/parrot/sub.h(Revision 17473)
+++ include/parrot/sub.h(Arbeitskopie)
@@ -87,7 +87,6 @@
 SUB_COMP_FLAG_BIT_28 = 1 << 28,
 SUB_COMP_FLAG_BIT_29 = 1 << 29,
 SUB_COMP_FLAG_BIT_30 = 1 << 30,
-SUB_COMP_FLAG_BIT_31 = 1 << 31,
 SUB_COMP_FLAG_MASK   = 0x0400,
 } sub_comp_flags_enum;




[perl #41827] ICU endian issues causing test failures.

2007-03-15 Thread via RT
# New Ticket Created by  Joshua Isom 
# Please include the string:  [perl #41827]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41827 >


I keep getting a test failure on t/op/stringu.t with test 25 on 
ppc-darwin(and likely all big endian systems with icu installed).  
Parrot outputs "\x00A\x00B" when the test expects "A\x00B\x00" to be 
printed.  I got a hint to the problem at the icu 
faq(http://icu.sourceforge.net/userguide/icufaq.html).  "A Unicode 
string is currently represented as UTF-16. The endianess of UTF-16 is 
platform dependent. You can guarantee the endianess of UTF-16 by using 
a converter. UTF-16 strings can be converted to other Unicode forms by 
using a converter or with the UTF conversion macros."



[PATCH] [library/Test::More] add isnt() to test inequality - str and float

2007-03-15 Thread Sam Vilain
Continue the previous factoring out of the comparison and
test function, by adding _cmp_ok() for other types
---
 runtime/parrot/library/Test/More.pir |  233 +++---
 t/library/test_more.t|   39 ++-
 2 files changed, 222 insertions(+), 50 deletions(-)

diff --git a/runtime/parrot/library/Test/More.pir 
b/runtime/parrot/library/Test/More.pir
index dea010c..f9f6673 100644
--- a/runtime/parrot/library/Test/More.pir
+++ b/runtime/parrot/library/Test/More.pir
@@ -32,10 +32,12 @@ Test::More - Parrot extension for testing modules
 isnt( 200, 100, 'passing integer negative compare' )
 
 is( 1.001, 1.001, 'passing float compare with diagnostic' )
+isnt( 1.001, 1.001, 'failing float negative compare with diag' )
 is( 8.008, 4.004 )
 
 is( 'foo', 'foo', 'passing string compare with diagnostic' )
 is( 'foo', 'bar', 'failing string compare with diagnostic' )
+isnt( 'foo', 'bar', 'passing string negative compare with diag' )
 
 is( some_pmc, another_pmc, 'pmc comparison uses "eq" op' )
 
@@ -194,22 +196,17 @@ add more.
 .return($I0)
 .end
 
-.sub is :multi( float, float )
+.sub _cmp_ok :multi( float, float, pmc )
 .param float  left
 .param float  right
+.param pmccomp
 .param string description :optional
 
 .local pmc test
 find_global test, 'Test::More', '_test'
 
 .local int pass
-pass = 0
-
-eq left, right, pass_it
-goto report
-
-  pass_it:
-pass = 1
+pass = comp(left, right)
 
   report:
 test.ok( pass, description )
@@ -227,22 +224,46 @@ add more.
   done:
 .end
 
-.sub is :multi( string, string )
+.sub is :multi( float, float )
+.param floatleft
+.param floatright
+.param string description :optional
+.local pmc comp
+comp = find_name "_eq_float"
+_cmp_ok(left,right,comp,description)
+.end
+
+.sub _eq_float
+.param floatleft
+.param floatright
+$I0 = 0
+if left == right goto pass_it
+
+   # XXX - significant places?  I don't care :)
+   .local float diff
+   diff = left - right
+   abs diff
+
+   if diff < 0.0001 goto pass_it
+
+   goto out
+pass_it:
+   $I0 = 1
+out:   
+.return($I0)
+.end
+
+.sub _cmp_ok :multi( string, string, pmc )
 .param string left
 .param string right
+.param pmccomp
 .param string description :optional
 
 .local pmc test
 find_global test, 'Test::More', '_test'
 
 .local int pass
-pass = 0
-
-eq left, right, pass_it
-goto report
-
-  pass_it:
-pass = 1
+pass = comp(left, right)
 
   report:
 test.ok( pass, description )
@@ -260,63 +281,128 @@ add more.
   done:
 .end
 
-.sub is :multi()
+.sub is :multi( string, string )
+.param stringleft
+.param stringright
+.param string description :optional
+.local pmc comp
+comp = find_name "_eq_string"
+_cmp_ok(left,right,comp,description)
+.end
+
+.sub _eq_string
+.param stringleft
+.param stringright
+$I0 = iseq left, right
+.return($I0)
+.end
+
+.sub _ne_string
+.param stringleft
+.param stringright
+$I0 = isne left, right
+.return($I0)
+.end
+
+.sub _cmp_ok :multi()
 .param pmcleft
 .param pmcright
+.param pmccomp
 .param string description :optional
 
 .local pmc test
 find_global test, 'Test::More', '_test'
 
 .local int pass
-pass = 0
+pass = comp(left, right)
+
+  report:
+test.ok( pass, description )
+if pass goto done
+
+.local string diagnostic
+.local string l_string
+.local string r_string
+
+l_string= left
+r_string= right
+
+diagnostic = _make_diagnostic( l_string, r_string )
+test.diag( diagnostic )
+  done:
+.end
 
-   .local string r_type
-   r_type = typeof right
+.sub _is_or_isnt :multi()
+.param pmcleft
+.param pmcright
+.param string which
+.param string description :optional
 
-   if r_type == 'Float' goto num_compare
-   if r_type == 'Int'   goto num_compare
-   goto string_compare
+.local string func
+func = "_" . which
+func = func . "_"
 
-  num_compare:
+.local string r_type
+r_type = typeof right
+
+.local pmccomp
+if r_type == 'Float'  goto float_compare
+if r_type == 'Int'goto int_compare
+if r_type == 'String' goto string_compare
+goto object_compare
+
+  float_compare:
.local float l_val
.local float r_val
l_val = left
r_val = right
-
-if l_val == r_val goto pass_it
-
-   # XXX - significant places?  I don't care :)
-   .local float diff
-   diff = l_val - r_val
-
-   if diff < 0.0001 goto pass_it
+   func = func . "float"
+   comp = find_name func
+   say "# comparing floats"
+   _cmp_ok(l_val, r_val, comp, description)
+   goto out
 
   string_compare:
.local string l_val
.l

Re: [perl #38764] Test results of parrot on Freebsd

2007-03-15 Thread Pankaj kaushal
Will Coleda via RT wrote:
> Thank you (belatedly) for the report.
> 
> Can you retest against parrot-0.4.9?  We're seeing passes on 6.2-release 
> there, hopefully 
> that will translate back to your version.

Sure, Tests coming up in a bit.

P.
-- 
Wir wollen dass ihr uns alles glaubt.


[PATCH] [t/library/Test::More] move skip test to be first

2007-03-15 Thread Sam Vilain
The tested output from test_skip() depends on the number of tests
that ran in the unrelated sections before it.  Tidy this up.
---
 t/library/test_more.t |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/t/library/test_more.t b/t/library/test_more.t
index 7baefd5..23576eb 100644
--- a/t/library/test_more.t
+++ b/t/library/test_more.t
@@ -33,12 +33,12 @@
.IMPORT( 'Test::Builder::Tester', 'test_test' )
 
plan( 47 )
+   test_skip()
test_ok()
test_is()
test_like()
test_is_deeply()
test_diagnostics()
-test_skip()
 
test.'finish'()
 .end
@@ -338,25 +338,25 @@
 .local pmc test
 test = new 'Test::Builder'
 
-   test_out( 'ok 43 #skip skipping' )
-   test_out( 'ok 44 #skip skipping' )
+   test_out( 'ok 1 #skip skipping' )
+   test_out( 'ok 2 #skip skipping' )
 test.'skip'( 2, 'skipping' )
test_test( 'skip test should pass' )
 
-   test_out( 'ok 45 #skip skipped' )
+   test_out( 'ok 3 #skip skipped' )
skip( 1 )
test_test( 'skip(int)' )
 
-   test_out( 'ok 46 #skip jumping' )
+   test_out( 'ok 4 #skip jumping' )
skip( "jumping" )
test_test( 'skip(string)' )
 
-   test_out( 'ok 47 #skip lunch' )
-   test_out( 'ok 48 #skip lunch' )
+   test_out( 'ok 5 #skip lunch' )
+   test_out( 'ok 6 #skip lunch' )
skip( 2, "lunch" )
test_test( 'skip(int, string)' )
 
-   test_out( 'ok 49 #skip skipped' )
+   test_out( 'ok 7 #skip skipped' )
skip()
test_test( 'skip()' )
 .end
-- 
1.5.0.759.g41ffe



[PATCH] [library] Test::More: use hllmacros.pir in man page example

2007-03-15 Thread Sam Vilain
From: Sam Vilain <[EMAIL PROTECTED]>

Use current best practice for importing symbols in the example.
---
 runtime/parrot/library/Test/More.pir |   26 --
 1 files changed, 12 insertions(+), 14 deletions(-)

diff --git a/runtime/parrot/library/Test/More.pir 
b/runtime/parrot/library/Test/More.pir
index 8441b25..51660ea 100644
--- a/runtime/parrot/library/Test/More.pir
+++ b/runtime/parrot/library/Test/More.pir
@@ -4,23 +4,20 @@ Test::More - Parrot extension for testing modules
 
 =head1 SYNOPSIS
 
+ .include "hllmacros.pir"
+
+ .sub main :main
 # load this library
 load_bytecode 'library/Test/More.pir'
 
-# get the testing functions
-.local pmc plan
-.local pmc diag
-.local pmc ok
-.local pmc is
-.local pmc is_deeply
-.local pmc like
-
-plan  = find_global 'Test::More', 'plan'
-diag  = find_global 'Test::More', 'diag'
-ok= find_global 'Test::More', 'ok'
-is= find_global 'Test::More', 'is'
-is_deeply = find_global 'Test::More', 'is_deeply'
-like  = find_global 'Test::More', 'like'
+# from hllmacros.pir
+.local pmc _
+.IMPORT( 'Test::More', 'plan', _ )
+.IMPORT( 'Test::More', 'diag', _ )
+.IMPORT( 'Test::More', 'ok', _ )
+.IMPORT( 'Test::More', 'is', _ )
+.IMPORT( 'Test::More', 'is_deeply', _ )
+.IMPORT( 'Test::More', 'like', _ )
 
 # set a test plan
 plan( 12 )
@@ -44,6 +41,7 @@ Test::More - Parrot extension for testing modules
 is_deeply( some_deep_pmc, another_deep_pmc, 'deep structure comparison' )
 
 like( 'foo', 'f o**{2}', 'passing regex compare with diagnostic' )
+ .end
 
 =head1 DESCRIPTION
 
-- 
1.5.0.759.g41ffe



[perl #41829] languages/Zcode is broken

2007-03-15 Thread via RT
# New Ticket Created by  Bernhard Schmalhofer 
# Please include the string:  [perl #41829]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41829 >


Hi,

'languages/Zcode' has bees broken for some time.
The first error that pops up seems to be an issue with looking up subs
in a different namespace:

[EMAIL PROTECTED]:~/devel/Parrot/repos/parrot/languages/Zcode$ ../../parrot 
z3.pir  t/10_jumps.z3
Null PMC access in invoke()
current instr.: 'parrot;ZComp;decode_text' pc 3503 (zops.pir:471)
called from Sub 'parrot;ZComp;zop_print' pc 3529 (zops.pir:485)
called from Sub 'parrot;ZComp;decode_one_sub' pc 762 (z3main.pir:400)
called from Sub 'parrot;ZComp;translate' pc 575 (z3main.pir:322)
called from Sub 'parrot;Zmachine;translate' pc 301 (z3main.pir:185)
called from Sub 'main' pc 64 (z3.pir:50)

Regards,
  Bernhard


Re: [perl #40544] [NEW] Test for DOS line endings in Parrot text files

2007-03-15 Thread Paul Cochrane

On 15/03/07, Will Coleda via RT <[EMAIL PROTECTED]> wrote:

Again, more failures.

Paul, can you coordinate with Jerry Gay (particle) to insure the test doesn't 
encourage updates of
files that would break the windows build? Once we can trust the output of the 
test, we can
update the remaining files and close the ticket.


Jerry and I have already been discussing this, and he let me know
about the problems with windows (my main problem has been lack of time
due to $work to fix the issue).  He also mentioned that the test
itself is broken, and he is unable to run the relevant test due to
SVN::Client being nonexistent on CPAN.  I am about to try and fix the
test so that the files which require LF keep the setting, and the rest
get 'native'.  Perhaps we should skip the test for the time being to
reduce noise until the test itself is fixed.

Paul


[PATCH] [lib/Test::More] base comparison type on expected, not received PMC type

2007-03-15 Thread Sam Vilain
The type of the 'left' argument was being used for the selection
of which comparison function to use.  This does not agree with the
typical usage of the second argument to is() to mean the expected
value (as in English).
---
 runtime/parrot/library/Test/More.pir |8 
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/runtime/parrot/library/Test/More.pir 
b/runtime/parrot/library/Test/More.pir
index 51660ea..fd297ab 100644
--- a/runtime/parrot/library/Test/More.pir
+++ b/runtime/parrot/library/Test/More.pir
@@ -258,11 +258,11 @@ add more.
 .local int pass
 pass = 0
 
-   .local string l_type
-   l_type = typeof left
+   .local string r_type
+   r_type = typeof right
 
-   if l_type == 'Float' goto num_compare
-   if l_type == 'Int'   goto num_compare
+   if r_type == 'Float' goto num_compare
+   if r_type == 'Int'   goto num_compare
goto string_compare
 
   num_compare:
-- 
1.5.0.759.g41ffe



[PATCH] [library/Test::More] add isnt() to test inequality - ints only

2007-03-15 Thread Sam Vilain
refactor the is() :multi for integers into a _cmp_ok() function, and
then use that to provide is() and isnt()
---
 runtime/parrot/library/Test/More.pir |   53 --
 t/library/test_more.t|   16 +-
 2 files changed, 59 insertions(+), 10 deletions(-)

diff --git a/runtime/parrot/library/Test/More.pir 
b/runtime/parrot/library/Test/More.pir
index fd297ab..dea010c 100644
--- a/runtime/parrot/library/Test/More.pir
+++ b/runtime/parrot/library/Test/More.pir
@@ -16,11 +16,12 @@ Test::More - Parrot extension for testing modules
 .IMPORT( 'Test::More', 'diag', _ )
 .IMPORT( 'Test::More', 'ok', _ )
 .IMPORT( 'Test::More', 'is', _ )
+.IMPORT( 'Test::More', 'isnt', _ )
 .IMPORT( 'Test::More', 'is_deeply', _ )
 .IMPORT( 'Test::More', 'like', _ )
 
 # set a test plan
-plan( 12 )
+plan( 13 )
 
 # run your tests
 ok( 1 )
@@ -28,6 +29,7 @@ Test::More - Parrot extension for testing modules
 
 is( 100, 100 )
 is( 200, 100, 'failing integer compare with diagnostic' )
+isnt( 200, 100, 'passing integer negative compare' )
 
 is( 1.001, 1.001, 'passing float compare with diagnostic' )
 is( 8.008, 4.004 )
@@ -148,22 +150,17 @@ add more.
 
 =cut
 
-.sub is :multi( int, int )
+.sub _cmp_ok :multi( int, int, pmc )
 .param intleft
 .param intright
+.param pmccomp
 .param string description :optional
 
 .local pmc test
 find_global test, 'Test::More', '_test'
 
 .local int pass
-pass   = 0
-
-if left == right goto pass_it
-goto report
-
-  pass_it:
-pass = 1
+pass = comp(left, right)
 
   report:
 test.ok( pass, description )
@@ -181,6 +178,22 @@ add more.
   done:
 .end
 
+.sub is :multi( int, int )
+.param intleft
+.param intright
+.param string description :optional
+.local pmc comp
+comp = find_name "_eq_int"
+_cmp_ok(left,right,comp,description)
+.end
+
+.sub _eq_int
+.param intleft
+.param intright
+$I0 = iseq left, right
+.return($I0)
+.end
+
 .sub is :multi( float, float )
 .param float  left
 .param float  right
@@ -306,6 +319,28 @@ add more.
   done:
 .end
 
+=item C
+
+As C, but the test passes if the arguments I match.
+
+=cut
+
+.sub isnt :multi( int, int )
+.param intleft
+.param intright
+.param string description :optional
+.local pmc comp
+comp = find_name "_ne_int"
+_cmp_ok(left,right,comp,description)
+.end
+
+.sub _ne_int
+.param intleft
+.param intright
+$I0 = isne left, right
+.return($I0)
+.end
+
 =item C
 
 Prints C to the screen, without affecting test comparisons.
diff --git a/t/library/test_more.t b/t/library/test_more.t
index 23576eb..4bc08b8 100644
--- a/t/library/test_more.t
+++ b/t/library/test_more.t
@@ -21,6 +21,7 @@
.local pmc import_sub
.IMPORT( 'Test::More', 'ok' )
.IMPORT( 'Test::More', 'is' )
+   .IMPORT( 'Test::More', 'isnt' )
.IMPORT( 'Test::More', 'diag' )
.IMPORT( 'Test::More', 'like' )
.IMPORT( 'Test::More', 'skip' )
@@ -32,13 +33,14 @@
.IMPORT( 'Test::Builder::Tester', 'test_pass' )
.IMPORT( 'Test::Builder::Tester', 'test_test' )
 
-   plan( 47 )
+   plan( 49 )
test_skip()
test_ok()
test_is()
test_like()
test_is_deeply()
test_diagnostics()
+   test_isnt()
 
test.'finish'()
 .end
@@ -360,3 +362,15 @@
skip()
test_test( 'skip()' )
 .end
+
+.sub test_isnt
+   test_fail()
+   isnt( 100, 100 )
+   test_diag( 'Received: 100' )
+   test_diag( 'Expected: 100' )
+   test_test( 'failing test isnt() for ints')
+
+   test_pass()
+   isnt( -100, 200 )
+   test_test( 'passing test isnt() for ints')
+.end
-- 
1.5.0.759.g41ffe



Re: [perl #39908] [BUG] IMCC treats $S as a non-register instead of throwing an error

2007-03-15 Thread jerry gay

On 3/14/07, Nuno Carvalho via RT <[EMAIL PROTECTED]> wrote:

Greetings,

here are some examples running the changed lexer:

$ cat 1.pir
.sub main :main
.macro SpinForever (Count)
.local $LOOP: dec .COUNT# ".local $LOOP" defines a local label.
 branch .$LOOP # Jump to said label.
.endm
.end
$ ./parrot 1.pir
$
$ cat 2.pir
.sub main :main
print $AA
.end
$ ./parrot 2.pir
error:imcc:'$AA' is not a valid register name
in file '2.pir' line 2
$ cat 3.pir
.sub main :main
$I = 5
.end
$ ./parrot 3.pir
error:imcc:'$I' is not a valid register name
in file '3.pir' line 2
$ cat 4.pir
.sub main :main
print "$A"
.end
$ ./parrot 4.pir
$A
$ cat 5.pir
.sub main :main
print $2
.end
$ ./parrot 5.pir
error:imcc:'$2' is not a valid register name
in file '5.pir' line 2

With the new lexer the result of running 'make test' is the same, except
for 't/compilers/imcc/syn/errors.t' because now we have a different
error message. I attached a patch with the new lexer and the corrected test.

More tests/comments welcome!


the above examples should be converted to tests. please place them in
t/compilers/imcc/syn/macro.t, and resubmit. that should allow us to do
a partial apply (tests only), see the failures, then apply the source,
rebuild, test, and see the failures disappear, with no other failures.
~jerry


[PATCH] [lib] Test::More - add isa_ok()

2007-03-15 Thread Sam Vilain
---
 runtime/parrot/library/Test/More.pir |   80 ++
 t/library/test_more.t|   38 -
 2 files changed, 117 insertions(+), 1 deletions(-)

diff --git a/runtime/parrot/library/Test/More.pir 
b/runtime/parrot/library/Test/More.pir
index f9f6673..7a1d18d 100644
--- a/runtime/parrot/library/Test/More.pir
+++ b/runtime/parrot/library/Test/More.pir
@@ -19,6 +19,7 @@ Test::More - Parrot extension for testing modules
 .IMPORT( 'Test::More', 'isnt', _ )
 .IMPORT( 'Test::More', 'is_deeply', _ )
 .IMPORT( 'Test::More', 'like', _ )
+.IMPORT( 'Test::More', 'isa_ok', _ )
 
 # set a test plan
 plan( 13 )
@@ -47,6 +48,11 @@ Test::More - Parrot extension for testing modules
 like( 'foo', 'f o**{2}', 'passing regex compare with diagnostic' )
  .end
 
+$P0 = getclass "Moose"
+$P0.new()
+
+isa_ok($P0, "Moose", "new Moose")
+
 =head1 DESCRIPTION
 
 C is a pure-Parrot library for testing modules.  It provides
@@ -943,6 +949,80 @@ actually skipped.  Arguments are optional.
 test.'skip'()
 .end
 
+=item C
+
+Pass if the pmc passed "isa" class.  The "name" passed in is a
+description of what it is you've passed in, not a comment.  It is
+presented as "name isa class" in the description.
+
+Good input: "C", "C"
+
+Bad input: "C"
+
+=cut
+
+.sub isa_ok :multi(pmc, string)
+.param pmc thingy
+.param string class_name
+.param string name :optional
+.param int got_name :opt_flag
+
+.local pmc test
+find_global test, 'Test::More', '_test'
+
+.local string _name
+_name = name
+if got_name goto great
+_name = "object"
+great: 
+$S0 = _name . " isa "
+$S0 = $S0 . class_name
+
+$I0 = isa thingy, class_name
+test.'ok'($I0, $S0)
+if $I0 goto out
+_isa_ok_diag(test, class_name, _name, thingy)
+out:   
+.end
+
+.sub isa_ok :multi(pmc, pmc)
+.param pmc thingy
+.param pmc class
+.param string name :optional
+.param int got_name :opt_flag
+
+.local pmc test
+find_global test, 'Test::More', '_test'
+
+.local string _name, class_name
+_name = name
+if got_name goto great
+_name = "object"
+great: 
+$S0 = _name . " isa "
+class_name = classname class
+$S0 = $S0 . class_name
+
+$I0 = isa thingy, class
+test.'ok'($I0, $S0)
+if $I0 goto out
+_isa_ok_diag(test, class_name, _name, thingy)
+out:   
+.end
+
+.sub _isa_ok_diag
+.param pmc test
+.param string class_name
+.param string name
+.param pmc thingy
+$S0 = name . " isn't a "
+$S0 = $S0 . class_name
+$S0 = $S0 . " it's a "
+$S1 = typeof thingy
+$S0 = $S0 . $S1
+test.'diag'($S0)
+.end
+
 .sub _make_diagnostic
 .param string received
 .param string expected
diff --git a/t/library/test_more.t b/t/library/test_more.t
index b7aa317..17b0671 100644
--- a/t/library/test_more.t
+++ b/t/library/test_more.t
@@ -26,6 +26,7 @@
.IMPORT( 'Test::More', 'like' )
.IMPORT( 'Test::More', 'skip' )
.IMPORT( 'Test::More', 'is_deeply' )
+   .IMPORT( 'Test::More', 'isa_ok' )
.IMPORT( 'Test::Builder::Tester', 'plan' )
.IMPORT( 'Test::Builder::Tester', 'test_out' )
.IMPORT( 'Test::Builder::Tester', 'test_diag' )
@@ -33,7 +34,7 @@
.IMPORT( 'Test::Builder::Tester', 'test_pass' )
.IMPORT( 'Test::Builder::Tester', 'test_test' )
 
-   plan( 55 )
+   plan( 60 )
test_skip()
test_ok()
test_is()
@@ -41,6 +42,7 @@
test_is_deeply()
test_diagnostics()
test_isnt()
+   test_isa_ok()
 
test.'finish'()
 .end
@@ -411,3 +413,37 @@
 

 .end
+
+.sub test_isa_ok
+   .local pmc dog, terrier, daschund, Spot, Sossy
+
+   dog = newclass "dog"
+   terrier = subclass dog, "terrier"
+   daschund = subclass dog, "daschund"
+
+   Spot = new "terrier"
+   Sossy = new "daschund"
+
+   test_pass( 'Spot isa terrier' )
+   isa_ok(Spot, "terrier", "Spot")
+   test_test( 'passing isa_ok for PMC/string (class =)' )
+
+   test_pass( 'Spot isa dog' )
+   isa_ok(Spot, "dog", "Spot")
+   test_test( 'passing isa_ok for PMC/string (super)')
+
+   test_pass( 'Sossy isa daschund' )
+   isa_ok(Sossy, "daschund", "Sossy")
+   test_test( 'passing isa_ok for PMC/PMC (class =)' )
+
+   test_pass( 'Sossy isa dog' )
+   isa_ok(Sossy, "dog", "Sossy")
+   test_test( 'passing isa_ok for PMC/PMC (super)')
+
+   test_fail( 'Spot isa daschund' )
+test_diag( "Spot isn't a daschund it's a terrier" )
+   isa_ok(Spot, 'daschund', "Spot")
+   test_test( 'failing test isnt() for PMC/string')
+   
+.end
+
-- 
1.5.0.759.g41ffe



Re: [perl #41364] [PATCH] Fixed object vtable method overrides in PIR

2007-03-15 Thread Alek Storm

I'll be gone for a few days, so I'll fix it when I get back.  It just looks
like object.ops changed since I submitted the patch.

On 3/15/07, Will Coleda via RT <[EMAIL PROTECTED]> wrote:


Can't apply this patch:

$ patch -p0 < foo.patch
patching file CREDITS
Hunk #1 succeeded at 572 (offset 19 lines).
patching file src/ops/object.ops
Hunk #1 FAILED at 54.
Hunk #2 FAILED at 92.
Hunk #3 FAILED at 128.
3 out of 3 hunks FAILED -- saving rejects to file src/ops/object.ops.rej
patching file src/pmc/parrotobject.pmc
Hunk #1 succeeded at 164 (offset -38 lines).

On Sun Mar 04 19:33:30 2007, [EMAIL PROTECTED] wrote:
> Just kidding!  Here's the patch, for real this time.
>
> On 3/4/07, Alek Storm <[EMAIL PROTECTED]> wrote:
> > That's because the patch refers to a function that is now outdated
> because
> > of #41549.  I've attached an updated version of the patch.
> >
> > Thanks,
> > Alek Storm
> >
> > On 3/2/07, [EMAIL PROTECTED] via RT  [EMAIL PROTECTED]> wrote:
> > >
> > > On Sun Feb 25 20:10:00 2007, [EMAIL PROTECTED] wrote:
> > > > Now that 0.4.9 has been released, can this be committed?
> > > >
> > > I just tried, but I get:
> > >
> > > /home/default/jnthn.net/dev/parrot/blib/lib/libparrot.so:
> undefined
> > > reference to `find_vtable_meth'
> > > collect2: ld returned 1 exit status
> > >
> > > After applying it. Any ideas?
> > >
> > > Jonathan
> > >
> >






Re: [perl #40544] [NEW] Test for DOS line endings in Parrot text files

2007-03-15 Thread Paul Cochrane

On 15/03/07, Will Coleda via RT <[EMAIL PROTECTED]> wrote:

Again, more failures.

Paul, can you coordinate with Jerry Gay (particle) to insure the test doesn't 
encourage updates of
files that would break the windows build? Once we can trust the output of the 
test, we can
update the remaining files and close the ticket.


I have a patch (attached) of t/distro/file_metadata.t which tests for
files which "should" have LF as their eol-style, and then excludes
this list of files from the check for files which should have 'native'
as their eol-style.  If people seem happy with it I'll apply it.  I'm
not sure if all the files which require LF as eol-style are included
atm, which is why I'm putting the patch up here for review.  Put
another way, are there any Windows users currently seeing failures
they shouldn't as a result of input files to tests having the
incorrect EOL character(s)?

Paul


file_metadata.patch
Description: Binary data


[perl #41805] [library/Test::More] add isnt() to test inequality - ints only

2007-03-15 Thread Allison Randal via RT
On Tue Mar 13 16:10:04 2007, [EMAIL PROTECTED] wrote:
> [library/Test::More] add isnt() to test inequality - ints only

> refactor the is() :multi for integers into a _cmp_ok() function, and
> then use that to provide is() and isnt()

I spent some time poking at refactoring this patch and #41806 (since
they are really one change), then decided it was a better use of your
time and mine, and better PIR training for you, if I tell you how (and
why) I want it refactored.

I definitely like adding isnt(). I'm fine with implementing is() and
isnt() as simple pass-throughs to cmp_ok(). But, the particular
implementation here, with :multi is(), :multi isnt(), :multi _cmp_ok(),
a pile of _eq_*() and _ne_*() utility functions, and the grab-bag
_is_or_isnt(), is a good example of a solution that seems simple enough
when applied to just ints, but expands into unmaintainability when
applied to the full range of cases. So, these are my requests:

- Instead of a "private" utility function _cmp_ok(), implement the
public cmp_ok() function, similar to Perl 5's Test::More.

- Instead of passing a Sub PMC into cmp_ok(), pass a string "eq", "ne",
"gt", "ge", etc. (to make it usable as a public function).

- Implement is(), isnt(), and cmp_ok() as methods on Test::Builder
instead of functions in Test::More, so they're available to everyone.
The Test::More functions can be simple pass-throughs to the methods,
like Test::More's plan(), ok(), and diag().

- The :multi strategy clearly isn't working, so let's eliminate it. You
had to repeat all the selections by type name in _is_or_isnt() anyway,
so just make that the primary implementation of cmp_ok(). When non-PMC
register and constant arguments are passed to PMC parameters, strings
are autopromoted to PMC Strings, and ints and floats are autopromoted to
PMC Floats, so the comparisons will work. (Though, it does make me
wonder if int registers and constants should be autopromoted to PMC
Integers instead.)

- Eliminate all the _eq_*() and _ne_*() utility functions. Most of them
were just syntactic sugar wrappers to change the name of the builtin
comparison opcodes.

Feel free to come back with questions, etc. and I'll be on #parrot all
day Saturday if you want to work on it interactively.

Thanks!
Allison


Re: [library/Test::More] add isnt() to test inequality - ints only

2007-03-15 Thread chromatic
On Thursday 15 March 2007 09:51, Allison Randal via RT wrote:

(removed from the RT comment, I hope)

> (Though, it does make me
> wonder if int registers and constants should be autopromoted to PMC
> Integers instead.)

Indeed they should be.  I can poke at this.

-- c


Re: [perl #41658] [TODO] Move all gc source files into a separate directory

2007-03-15 Thread Joshua Isom
I have a patch for doing this, at least a build, compile, and test type 
patch.  Instead of doing one massive patch to send, here's a script to 
move the files(diffs include the entire file twice) and apply the 
patch.  It moves all the files I've noticed that are primarily related 
to memory management and the garbage collector.


On Mar 1, 2007, at 2:21 PM, Joshua Isom (via RT) wrote:


# New Ticket Created by  Joshua Isom
# Please include the string:  [perl #41658]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=41658 >


While most of the other sections of the parrot source tree are fairly
neat and clean to be able to find what you're looking for, the garbage
collection files are all in src/ and not always obviously files used
for gc.  Most of my gc segfaults seem to be from smallobject.c but by
looking at the filename, I wouldn't expect it to be a gc file.  This
may help people to quickly be able to help track down a gc bug when
they find one, especially since the next day they're not reproducible,
even on the source machine.





modified.patch
Description: Binary data


update.sh
Description: Binary data


[svn:perl6-synopsis] r14350 - doc/trunk/design/syn

2007-03-15 Thread larry
Author: larry
Date: Thu Mar 15 13:29:54 2007
New Revision: 14350

Modified:
   doc/trunk/design/syn/S02.pod

Log:
Change CONTEXT:: vars to be consistent with new context() function.
Clarify that CALLER:: can return variables defined elsewhere if visible there.


Modified: doc/trunk/design/syn/S02.pod
==
--- doc/trunk/design/syn/S02.pod(original)
+++ doc/trunk/design/syn/S02.podThu Mar 15 13:29:54 2007
@@ -12,9 +12,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 10 Aug 2004
-  Last Modified: 14 Mar 2007
+  Last Modified: 15 Mar 2007
   Number: 2
-  Version: 98
+  Version: 99
 
 This document summarizes Apocalypse 2, which covers small-scale
 lexical items and typological issues.  (These Synopses also contain
@@ -1516,7 +1516,13 @@
 lexical variable must have the trait "C" to be
 visible via C.  (C<$_>, C<$!> and C<$/> are always
 contextual.) If the variable is not visible in the caller, it returns
-failure.
+failure.  Variables whose names are visible at the point of the call but that
+come from outside that lexical scope are controlled by the scope
+in which they were originally declared, and so on transitively.
+Hence the visibility of C<< CALLER::<$+foo> >> is determined where
+C<$+foo> is actually declared, not by the caller's scope.  Likewise
+C<< CALLER::CALLER::<$x> >> depends only on the declaration of C<$x>
+in your caller's caller.
 
 Any lexical declared with the C trait is by default
 considered readonly outside the current lexical scope.  You may
@@ -1529,7 +1535,8 @@
 =item *
 
 The C pseudo-package is just like C except that
-it scans outward through all dynamic scopes until it finds a
+it starts in the current dynamic scope and from there
+scans outward through all dynamic scopes until it finds a
 contextual variable of that name in that context's lexical scope.
 (Use of C<$+FOO> is equivalent to CONTEXT::<$FOO> or $CONTEXT::FOO.)
 If after scanning all the lexical scopes of each dynamic scope,
@@ -1537,12 +1544,18 @@
 If there is no variable in the C<*> package and the variable is
 a scalar, it then looks in C<%*ENV> for the identifier of the variable,
 that is, in the environment variables passed to program.  If the
-value is not found there, it returns failure.  Note that C<$+_> is
-always the same as CALLER::<$_> since all contexts have a C<$_> that
-is automatically considered environmental.  Note also that C
-and C<$+> always skip the current scope, since you can always name
-the variable directly without the C or C<+> if it's been
-declared in the current lexical scope.
+value is not found there, it returns failure.  Unlike C,
+C will see a contextual variable that is declared in
+the current scope, however it will not be writeable via C unless
+declared "C<< is context >>", even if the variable itself is
+modifiable in that scope.  (If it is, you should just use the bare
+variable itself to modify it.)  Note that C<$+_> will always see
+the C<$_> in the current scope, not the caller's scope.  You may
+use C<< CALLER::<$+foo> >> to bypass a contextual definition of C<$foo>
+in your current context, such as to initialize it with the outer
+contextual value:
+
+my $foo is context = CALLER::<$+foo>;
 
 The C package is only for internal overriding of contextual
 information, modelled on how environmental variables work among


Re: Parrot, Perl 5 and performance

2007-03-15 Thread Nicholas Clark
I've re-ordered things because gmail's love of top posting confuses the flow
of the narrative.

> On Mar 12, 5:43 pm, [EMAIL PROTECTED] (Chromatic) wrote:
> > On Monday 12 March 2007 14:29, [EMAIL PROTECTED] wrote:
> >
> > I wish I had better news for you, but I'm not sure anyone can answer your
> > questions easily without a lot more information.
> >
> > > I'd like to get opinions from developers on this list. I'm looking
> > > into this system that executes massive amounts of Perl 5 code on a
> > > Perl 5.8 interpreter.  The system burns tons of CPU while running Perl
> > > code, and I'm speculating on ways to improve our throughput (say, 50
> > > billion inst per module -> 10 billion inst/modl) and latency (say, 2
> > > sec/modl -> 0.5 secs/modl).

I don't think that you're going to get a 4 or 5 fold speedup on existing
code by either re-writing the interpreter, or recompiling to different
bytecode for a different VM.

> > > In summary, my questions are:
> >
> > > (1) How much effort would it take to convert Perl 5 source to Parrot
> > > bytecode?
> >
> > A fair amount.  A complete translation of Perl 5 syntax and semantics is a
> > complex project.  A subset of Perl 5 could be much easier.

But the problem with trying to figure out any subset is that it's likely that
an existing codebase uses rather more Perl than you might like. Particularly
if it has dependencies off into CPAN.


> > *) Parrot doesn't pay the overhead of magic in Perl 5 (which complicates 
> > just
> > about every pp_code)

But the problem is that to make a faithful translation of Perl 5 into anything
else, requires that the behaviour of magic and overloading works properly.

Perl 5 is tricky to convert to a form that it suitable for a JIT compiler to
make headway on, because not only can any value be polymorphic (string or
floating point or integer), it can also be tied or overloaded. So basically
a JIT for regular (and therefore existing written) Perl 5 code would be
stringing together calls to the existing Perl 5 ops (or code as flexible as
them), rather than really converting to low level CPU instructions.

Perl 6 has resolved part of this by defaulting variables no "not tied" -
only variables that are explicity declared as such may hold tied values.

It may well be possible to provide ways to annotate Perl 5 with things like
"this is never tied" or even "this is an integer" but it won't help existing
code without a massive review/annotation(/bug introduction) phase

On Tue, Mar 13, 2007 at 10:28:59AM -0700, [EMAIL PROTECTED] wrote:

> In our setting, there isn't a single module that takes up 3 or 5% of
> CPU. Since we profile code on a regular basis, these offenders are
> easy to catch and fix. The problem is, we have more and more modules
> written every day, each taking, say, %0.01 of CPU time, but they add
> up to quite a lot. We also have a lot of code running in the same
> environment in C++ (they talk over XS), and recently a friend
> forwarded the following benchmarks:

It would seem that profiling the Perl interpreter (while it is running your
code) might reveal more than profiling the code itself. I would have thought
that an organisation large enough to be maintaining tens of thousands of
modules would be able to justify the resources to do that, and hopefully
then feed back any improvements to the core.

> http://shootout.alioth.debian.org/debian/benchmark.php?test=nbody&lang=all
> (one sample test)
> http://shootout.alioth.debian.org/debian/benchmark.php?test=all&lang=java&lang2=perl
> 
> Every language has its merits, and I know you can never do an apples
> to apples comparison. However, if we can get more performance out of
> Perl's VM, well, that would be great. In short, I just wondered if
> Perl/Parrot were on the benchmarks, around where it would be.

JVMs such as Sun's have a whole team of full time engineers working on them.
Perl (and Parrot) don't have anyone paid - it's all volunteers. In some ways
it's surprising how well Perl is doing despite that.

We've managed to find some ways to speed things up in 5.10, and those that
I've been able to backport will be in 5.8.9, but it's really hard to

a: Actually find a representitive benchmark for "Perl code"
b: Find any way to make a measurable difference

Mostly I've found ways to reduce the memory of core structures, but as these
are necessarily binary incompatible they can't go back to 5.8.x

Nicholas Clark


[perl #41858] [CAGE] Make a reasonable set of rules for splint

2007-03-15 Thread via RT
# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #41858]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41858 >


splint spews many many errors by default.  Take a look at the
Makefile that perl5 has for the start of some rules that Andy worked
on for the perl5 code.


[perl #41859] [TODO] Replace cage/todo.pod files by RT tickets

2007-03-15 Thread via RT
# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #41859]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41859 >


The todo items listed in cage/todo.pod should be replaced by tickets in RT.


[perl #41857] [CAGE] Make a "make valgrind" target

2007-03-15 Thread via RT
# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #41857]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41857 >


Create a makefile target so that we can use the valgrind tool suite:
http://valgrind.org/


[perl #41860] [CAGE] Run Parrot under Coverity Prevent

2007-03-15 Thread via RT
# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #41860]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41860 >


Coverity already runs Prevent on the Perl 5 source.  Let's get
Parrot running under it, too. L


[perl #41861] [TODO] Create (and start the basics of) a cage cleaner guide

2007-03-15 Thread via RT
# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #41861]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41861 >


 - A guide for cage cleaners is dearly needed.  Such a document should
be put into docs/project/cage_cleaners_guide.pod.

 - The cage/consting.pod can go within this file.

 - The cage/ directory can then be removed.


Re: [perl #41658] [TODO] Move all gc source files into a separate directory

2007-03-15 Thread Joshua Isom
I have a patch for doing this, at least a build, compile, and test type 
patch.  Instead of doing one massive patch to send, here's a script to 
move the files(diffs include the entire file twice) and apply the 
patch.  It moves all the files I've noticed that are primarily related 
to memory management and the garbage collector.


On Mar 1, 2007, at 2:21 PM, Joshua Isom (via RT) wrote:


# New Ticket Created by  Joshua Isom
# Please include the string:  [perl #41658]
# in the subject line of all future correspondence about this issue.
# http://rt.perl.org/rt3/Ticket/Display.html?id=41658 >


While most of the other sections of the parrot source tree are fairly
neat and clean to be able to find what you're looking for, the garbage
collection files are all in src/ and not always obviously files used
for gc.  Most of my gc segfaults seem to be from smallobject.c but by
looking at the filename, I wouldn't expect it to be a gc file.  This
may help people to quickly be able to help track down a gc bug when
they find one, especially since the next day they're not reproducible,
even on the source machine.



modified.patch
Description: Binary data


update
Description: Binary data


[perl #41862] [CAGE] Make a reasonable set of rules for lint

2007-03-15 Thread via RT
# New Ticket Created by  Paul Cochrane 
# Please include the string:  [perl #41862]
# in the subject line of all future correspondence about this issue. 
# http://rt.perl.org/rt3/Ticket/Display.html?id=41862 >


Andy has a pretty decent set of rules for perl5's code in that
project's Makefile.  Take a look at those for a start.


Re: [svn:perl6-synopsis] r14325 - doc/trunk/design/syn

2007-03-15 Thread Zev Benjamin
If the idea of having an author attribute is to allow multiple
implementations of a module, why not add an API version attribute?  The
idea would be to detach the module version number from the module API
version number.

This way, if I want to reimplement Foo::Bar, I wouldn't be required to
use the same versioning scheme as the original Foo::Bar, I would just
have to specify that my Foo::Bar implementation uses the same API version.

This also solves some problems with specifying a particular module
version number.  You can instead state that your program uses a
particular API version.  Then, the module author can fix bugs and
increment version numbers as much as he likes, and, so long as he
doesn't change the API, those module versions are completely acceptable
to use (I claim that if your program breaks due to a newer module
version that doesn't use a new API, then either the module author lied
and really did change the API, or your program is broken because it
depends on features that aren't part of the API).

Similar to the emulates attribute, there could be some way of specifying
that a new API version is compatible with an older version.  You would
declare this if the new version only added functionality and didn't
change syntax/semantics of existing features.


Zev

[EMAIL PROTECTED] wrote:
> Author: larry
> Date: Fri Mar  9 16:38:18 2007
> New Revision: 14325
> 
> Modified:
>doc/trunk/design/syn/S11.pod
> 
> Log:
> As noted by allbery_b++, Smylers++, and david.green++, we've thoroughly
> neglected to thoroughly spec the intended version sharing and emulation model.
> 
> 
> Modified: doc/trunk/design/syn/S11.pod
> ==
> --- doc/trunk/design/syn/S11.pod  (original)
> +++ doc/trunk/design/syn/S11.pod  Fri Mar  9 16:38:18 2007
> @@ -12,9 +12,9 @@
>  
>Maintainer: Larry Wall <[EMAIL PROTECTED]>
>Date: 27 Oct 2004
> -  Last Modified: 8 Mar 2006
> +  Last Modified: 9 Mar 2006
>Number: 11
> -  Version: 16
> +  Version: 17
>  
>  =head1 Overview
>  
> @@ -351,6 +351,41 @@
>  
>  specifically rules out any prereleases.
>  
> +If two different modules in your program require two different
> +versions of the same module, Perl will simply load both versions at
> +the same time.  For modules that do not manage exclusive resources,
> +the only penalty for this is memory, and the disk space in the library
> +to hold both the old and new versions.  For modules that do manage
> +an exclusive resource, such as a database handle, there are two approaches
> +short of requiring the user to upgrade.  The first is simply to refactor
> +the module into a stable supplier of the exclusive resource that doesn't
> +change version often, and then the outer wrappers of that resource can
> +both be loaded and use the same supplier of the resource.
> +
> +The other approach is for the module to keep the management of its exclusive
> +resource, but offer to emulate older versions of the API.  Then if there
> +is a conflict over which version to use, the new one is used by both users,
> +but each gets a view that is consistent with the version it thinks it is
> +using.  Of course, this depends crucially on how well the new version
> +actually emulates the old version.
> +
> +To declare that a module emulates an older version, declare it like this:
> +
> +class Dog:<1.2.1 cpan:JRANDOM> emulates :<1.2.0>;
> +
> +Or to simply exclude use of the older module and (presumably) force
> +the user to upgrade:
> +
> +class Dog:<1.2.1 cpan:JRANDOM> excludes :<1.2.0>;
> +
> +The name is parsed like a C wildcard, and you can have more than one,
> +so you can say things like:
> +
> +class Dog:<1.2.1 cpan:JRANDOM>
> +emulates Dog:auth(DCONWAY|JCONWAY|TCONWAY):ver<1.0+>
> +excludes Fox:<3.14159 http://oreillymedia.com>
> +emulates Wolf:from;
> +
>  =head1 Forcing Perl 6
>  
>  To get Perl 6 parsing rather than the default Perl 5 parsing,



[svn:perl6-synopsis] r14351 - doc/trunk/design/syn

2007-03-15 Thread larry
Author: larry
Date: Thu Mar 15 14:26:26 2007
New Revision: 14351

Modified:
   doc/trunk/design/syn/S06.pod

Log:
Refinements to context methods.


Modified: doc/trunk/design/syn/S06.pod
==
--- doc/trunk/design/syn/S06.pod(original)
+++ doc/trunk/design/syn/S06.podThu Mar 15 14:26:26 2007
@@ -13,9 +13,9 @@
 
   Maintainer: Larry Wall <[EMAIL PROTECTED]>
   Date: 21 Mar 2003
-  Last Modified: 14 Mar 2007
+  Last Modified: 15 Mar 2007
   Number: 6
-  Version: 80
+  Version: 81
 
 
 This document summarizes Apocalypse 6, which covers subroutines and the
@@ -1808,10 +1808,11 @@
 .leave
 .want
 .inline
-.my
+.package
 .file
 .line
-.subname
+.my
+.hints
 
 The C<.context> and C<.caller> methods work the same as the functions
 except that they are relative to the context supplied as invocant.
@@ -1827,10 +1828,15 @@
 
 The C<.my> method provides access to the lexical namespace in effect at
 the given dynamic context's current position.  It may be used to look
-up ordinary lexical variables in that lexical scope (not your lexical
-scope) as well as special compiler variables such as C<$?PACKAGE>.
-It must not be used to change any lexical variable that is not marked
-as C<< context >>.
+up ordinary lexical variables in that lexical scope.  It must not be
+used to change any lexical variable that is not marked as C<< context >>.
+
+The C<.hints> method gives access to a snapshot of compiler symbols in
+effect at the point of the call when the call was originally compiled.
+(For instance, C will give you the caller's
+routine object.)  Such values are always read-only, though in the
+case of some (like the caller's routine above) may return a fixed
+object that is nevertheless mutable.
 
 =head2 The C function