Re: PMC/GC help needed

2007-07-19 Thread Leopold Toetsch
Am Donnerstag, 19. Juli 2007 02:48 schrieb Will Coleda:
 I am trying to write a PMC version of PGE::CodeString, and while I  
 have a PMC now that passes all the old tests, I get GC errors during  
 the build process for TGE  JSON.

 I know they are GC related because running the affected steps with -
 G, and they complete normally.

 I was unable to find a document describing what sorts of things I  
 needed to do; Working with particle (on GC) and allison (on storage),  
 I now have:

      void init() {
          PMC* counter;

          PMC_str_val(SELF) =
              string_make_empty(INTERP, enum_stringrep_one, 0);
          PObj_custom_mark_SET(SELF);

          /* initialized our counter that keeps track of register  
 numbers */
          counter = pmc_new(INTERP, enum_class_Integer);
          VTABLE_set_integer_native(INTERP, counter, 10);
          PMC_data(SELF) = counter;
      }

The problem is as follows:

1) PObj_custom_mark_SET(SELF);
2) counter = pmc_new(INTERP, enum_class_Integer);
3) PMC_data(SELF) = counter;

In 1) you enable marking. 2) might cause a garbage collection, while the 
integer PMC isn't yet anchored. This is only done at step 3).

PMC_data(SELF) = pmc_new ...

should fix it, maybe along with doing 1) after all things are created.

leo


[perl #24251] [TODO] IMCC - improve error messages

2007-07-19 Thread Nuno Carvalho via RT
Greetings,

On Mon Sep 13 21:31:17 2004, coke wrote:
 The compile error has changed:
 
 error:imcc:Sub isn't a PMC
 in file 'bar.imc' line 5
 
 But, IMO, this should still barf on the declaration of index instead.
 
  [coke - Sun Oct 19 18:01:33 2003]:
  
  Is there a way to get this to barf on .local rather than the call to 
  index?
  
  (Was a bit confusing, since I had a working program, then moved the 
  .local up to the beginning of the sub. At that point, parrot started 
  complaining about my call to index.)
  
  bash-2.05a$ cat bar.imc
  .sub _main
  
.local int index
  
index $I0, whee, w
  
 end
  .end
  bash-2.05a$ ../../parrot bar.imc
  error:imcc:parse error, unexpected IREG, expecting '='
  
  in file 'bar.imc' line 5

As far as i can tell there's no decision on using parrot ops as variable
names (please do correct me if i'm wrong). So, are these valid PIR
instructions or not:

.local int set# or
.local int print  # or
.local int new

There is one test for this (leo++ for poiting it) in
t/compilers/imcc/syn/clash.t:

pir_output_is( 'CODE', 'OUT', parrot op as identifier );
(..)

Luckly (or not) that test uses:

.local int set  # which works ok
.local int new  # would have failed the test for example

Divine intervention needed, thank you.

Best regards,
./smash


[perl #44053] string_nprintf should be two functions

2007-07-19 Thread via RT
# New Ticket Created by  Andy Lester 
# Please include the string:  [perl #44053]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=44053 


There should be an in-place, and a string-returner, but not both in  
one func.

--
Andy Lester = [EMAIL PROTECTED] = www.petdance.com = AIM:petdance






Re: PMC/GC help needed

2007-07-19 Thread chromatic
On Thursday 19 July 2007 01:56:21 Leopold Toetsch wrote:

 Am Donnerstag, 19. Juli 2007 02:48 schrieb Will Coleda:

       void init() {
           PMC* counter;
 
           PMC_str_val(SELF) =
               string_make_empty(INTERP, enum_stringrep_one, 0);
           PObj_custom_mark_SET(SELF);
 
           /* initialized our counter that keeps track of register  
  numbers */
           counter = pmc_new(INTERP, enum_class_Integer);
           VTABLE_set_integer_native(INTERP, counter, 10);
           PMC_data(SELF) = counter;
       }

 The problem is as follows:

 1) PObj_custom_mark_SET(SELF);
 2) counter = pmc_new(INTERP, enum_class_Integer);
 3) PMC_data(SELF) = counter;

 In 1) you enable marking. 2) might cause a garbage collection, while the
 integer PMC isn't yet anchored. This is only done at step 3).

The Integer PMC or the String?

Perhaps I'm naive to expect that the system scanner will find counter, as it's 
on the stack.  Is that not the case?

-- c


Re: PMC/GC help needed

2007-07-19 Thread Will Coleda
chromatic writes: 

On Thursday 19 July 2007 01:56:21 Leopold Toetsch wrote: 


Am Donnerstag, 19. Juli 2007 02:48 schrieb Will Coleda:



  void init() {
  PMC* counter;

  PMC_str_val(SELF) =
  string_make_empty(INTERP, enum_stringrep_one, 0);
  PObj_custom_mark_SET(SELF);

  /* initialized our counter that keeps track of register  
 numbers */

  counter = pmc_new(INTERP, enum_class_Integer);
  VTABLE_set_integer_native(INTERP, counter, 10);
  PMC_data(SELF) = counter;
  } 

The problem is as follows: 


1) PObj_custom_mark_SET(SELF);
2) counter = pmc_new(INTERP, enum_class_Integer);
3) PMC_data(SELF) = counter; 


In 1) you enable marking. 2) might cause a garbage collection, while the
integer PMC isn't yet anchored. This is only done at step 3).


The Integer PMC or the String? 

Perhaps I'm naive to expect that the system scanner will find counter, as it's 
on the stack.  Is that not the case? 


-- c


This code is now checked into the 'codestring-pmc' branch for your perusal.


Re: Pre-OSCON hackathon: #hackathon

2007-07-19 Thread James E Keenan
At both Hackathon Toronto and the post-YAPC hackathon in Houston we had 
the use of IRC channel #hackathon.  But a couple of days after the 
Houston event ended, the channel got heavily spammed and someone changed 
the channel settings to invite only.  I was not on the channel at the 
time, so I was shut out.  And I don't know whom to ask to get an 
invitation back in.


Could someone who is knowledgeable about these things re-open the 
channel so that those of us whose attendance at the pre- and post-OSCON 
hackathons will be purely virtual can participate?


Thank you very much.


Re: [perl #43923] [TODO] Don't regenerate MANIFEST unnecessarily

2007-07-19 Thread James E Keenan

Will Coleda wrote:
# New Ticket Created by  Will Coleda 
# Please include the string:  [perl #43923]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt3/Ticket/Display.html?id=43923 



The recently added functionality to not regen MANIFEST.SKIP should be  
used when determining whether or not to regenerate MANIFEST as well.


--
Will Coke Coleda
[EMAIL PROTECTED]




[I posted this to RT  24 hours ago, but it hasn't made it to the 
newsgroup interface yet.  I wonder if something is amiss there.]



Please review the attached. Modifications to
tools/dev/mk_manifest_and_skip.pl and lib/Parrot/Manifest.pm. Tso
additional test files in t/manifest/.

In reviewing the patch, I recommend that you first run
tools/dev/mk_manifest_and skip.pl before running t/manifest/*.t. In
that way, you will be starting from a presumptively correct MANIFEST.

The interface to Parrot::Manifest has changed since last weekend.
However, that will not matter assuming that all you ever do is call:
perl tools/dev/mk_manifest_and_skip.pl. *That* is unchanged.

Thank you very much.

kid51
Index: tools/dev/mk_manifest_and_skip.pl
===
--- tools/dev/mk_manifest_and_skip.pl   (revision 2)
+++ tools/dev/mk_manifest_and_skip.pl   (working copy)
@@ -7,14 +7,20 @@
 
 my $script = $0;
 
-my $mani = Parrot::Manifest-new($script);
+my $mani = Parrot::Manifest-new( {
+script  = $script,
+} );
 
 my $manifest_lines_ref = $mani-prepare_manifest();
-$mani-print_manifest($manifest_lines_ref);
+my $need_for_files = $mani-determine_need_for_manifest($manifest_lines_ref);
+$mani-print_manifest($manifest_lines_ref) if $need_for_files;
 
-my $ignore_ref = $mani-prepare_manifest_skip();
-$mani-print_manifest_skip($ignore_ref);
+my $print_str = $mani-prepare_manifest_skip();
+my $need_for_skip = $mani-determine_need_for_manifest_skip($print_str);
+$mani-print_manifest_skip($print_str) if $need_for_skip;
 
+ DOCUMENTATION 
+
 =head1 NAME
 
 tools/dev/mk_manifest_and_skip.pl - Recreate MANIFEST and MANIFEST.SKIP
Index: MANIFEST
===
--- MANIFEST(revision 2)
+++ MANIFEST(working copy)
@@ -1,7 +1,7 @@
 # ex: set ro:
 # $Id$
 #
-# generated by tools/dev/mk_manifest_and_skip.pl Wed Jul 18 18:17:51 2007 UT
+# generated by tools/dev/mk_manifest_and_skip.pl Thu Jul 19 02:43:53 2007 UT
 #
 # See tools/dev/install_files.pl for documentation on the
 # format of this file.
@@ -2931,6 +2931,8 @@
 t/library/test_more.t   []
 t/library/yaml_parser_syck.t[]
 t/manifest/01-basic.t   []
+t/manifest/02-regenerate_file.t []
+t/manifest/03-regenerate_skip.t []
 t/manifest/README   []
 t/native_pbc/header.t   []
 t/native_pbc/integer.t  []
Index: lib/Parrot/Manifest.pm
===
--- lib/Parrot/Manifest.pm  (revision 2)
+++ lib/Parrot/Manifest.pm  (working copy)
@@ -3,26 +3,29 @@
 use strict;
 use warnings;
 use Carp;
+use Data::Dumper;
 
 sub new {
 my $class = shift;
-my $script = shift;
+my $argsref = shift;
 
 my $self = bless( {}, $class );
 
 my %data = (
-id  = '$' . 'Id$',
-time= scalar gmtime,
-cmd = -d '.svn' ? 'svn' : 'svk',
-script  = $script,
+id  = '$' . 'Id$',
+time= scalar gmtime,
+cmd = -d '.svn' ? 'svn' : 'svk',
+script  = $argsref-{script},
+file= $argsref-{file} ? $argsref-{file} : q{MANIFEST},
+skip= $argsref-{skip} ? $argsref-{skip} : q{MANIFEST.SKIP},
 );
 
-my @status_output = qx($data{cmd} status -v);
+my $status_output_ref = [ qx($data{cmd} status -v) ];
 
 # grab the versioned resources:
 my @versioned_files = ();
 my @dirs = ();
-my @versioned_output = grep !/^[?D]/, @status_output;
+my @versioned_output = grep !/^[?D]/, @{ $status_output_ref };
 for my $line (@versioned_output) {
 my @line_info = split( /\s+/, $line );
 
@@ -47,20 +50,36 @@
 
 sub prepare_manifest {
 my $self = shift;
-my @manifest_lines;
+my %manifest_lines;
 
 for my $file (@{ $self-{versioned_files} }) {
-push @manifest_lines, _get_manifest_entry($file);
+$manifest_lines{$file} = _get_manifest_entry($file);
 }
-return [EMAIL PROTECTED];
+return \%manifest_lines;
 }
 
+sub determine_need_for_manifest {
+my $self = shift;
+my $proposed_files_ref = shift;
+if  ( ! -f $self-{file} ) {
+return 1;
+} else {
+my $current_files_ref =