Re: configure.pl failed under cygwin, build failed on win32

2003-08-11 Thread Vladimir Lipskiy
 Under cygwin, ./Configure.pl fails with the message:
 
 Determining some sizes...Linker failed (see test.ldo) at
 lib/Parrot/Configure/Step.pm line
 
 Try to add this line
 
 link = 'gcc',
 
 to config/init/hints/cygwin.pl
 
 As a result, it must be in the following way:
 
 Configure::Data-set(
   link = 'link',

s/link = 'link'/link='gcc'/

Sorry. I was meditating on MSVC.





okay to use iterator?

2003-08-11 Thread Michal Wallace

perlhash.pod says:


TODO: Steve Fink sayd:

  And if there were a keys() method, then 'defined' and 'exists' are
  very different. (And there ought to be, and would be if we weren't
  all ignoring Leo's iterator proposal.)

I need to read that proposal :-)


Looks like the proposal got accepted? I see iterator.c and 
read the recorresponding tests... I went ahead and used it. 
Is that cool?

 
# s is a PerlHash
dict:
unless s goto empty
.local object iter
.local object key
.local object val
.local string skey
key = new PerlString

print {
iter = new Iterator, s
iter = 0  # reset it
unless iter goto enddict
shift skey, iter
key = skey
.arg 1
.arg key
call __py__print
print : 
val = s[skey]
.arg 1
.arg val
call __py__print
enddict:
   print }
empty:
print {}
goto done


Sincerely,
 
Michal J Wallace
Sabren Enterprises, Inc.
-
contact: [EMAIL PROTECTED]
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/
--




Re: parrot bug: continuations/multiple return

2003-08-11 Thread Piers Cawley
Leopold Toetsch [EMAIL PROTECTED] writes:

 Piers Cawley [EMAIL PROTECTED] wrote:
 Leopold Toetsch [EMAIL PROTECTED] writes:
 As calling conventions clearly state, that the caller has to save
 everything, its probably up to imcc/pcc.c to insert above
 statements, if another sub gets called from a sub. I'll fix that in
 a minute ;-)

 If and only if that's not a tail call of course.

 Good point. But I can imagine, that's by far more simple to detect tail
 calls at the AST level then inside the flattened code parrot sees. So
 the HL can emit (a TBD) flag like tailcall appended to the .pcc_call
 sequence.
 Then the call can be optimized to a Cjump opcode. The construction of
 the subroutine object (which is outside of the call sequence) will lead
 to an used once LHS, which the optimizer already can get rid of.

I'm not sure you can optimize it to a jump opcode when you're tail
calling another function can you? You could be tailcalling into a
closure so you'll need to use invoke to do the right thing with the
lexical stack etc.


Re: configure.pl failed under cygwin, build failed on win32

2003-08-11 Thread Vladimir Lipskiy
# A note about building shared libraries:  Perl5 uses the 'ld2' tool, which
# is installed as part of the perl5 installation.  So far, it appears
# parrot can get by with simply using gcc -shared, so we override the
# perl5 Configure defaults and use 'gcc -shared' instead of 'ld2'.
# If this later causes problems, it might be worth revisiting.
# A. Dougherty 9/9/2002
Configure::Data-set(
  link = 'gcc',
  ld = 'gcc',
  ld_shared = '-shared',
);





[perl #23276] Prefixing #define names

2003-08-11 Thread Vladimir Lipskiy
# New Ticket Created by  Vladimir Lipskiy 
# Please include the string:  [perl #23276]
# in the subject line of all future correspondence about this issue. 
# URL: http://rt.perl.org/rt2/Ticket/Display.html?id=23276 


OK. I'm starting out a prefixing story and here is 
CHAPTER I. The HAS_HEADER_ defines.



-- attachment  1 --
url: http://rt.perl.org/rt2/attach/62485/46046/966e5a/prefixing.diff



prefixing.diff
Description: prefixing.diff


Re: Packfile stuff

2003-08-11 Thread Juergen Boemmels
Index: KNOWN_ISSUES
===
RCS file: /cvs/public/parrot/KNOWN_ISSUES,v
retrieving revision 1.8
diff -u -r1.8 KNOWN_ISSUES
--- KNOWN_ISSUES	4 Feb 2003 10:24:45 -	1.8
+++ KNOWN_ISSUES	8 Aug 2003 16:09:11 -
@@ -42,7 +42,6 @@
 
 Utilities
 
-- assemble.pl rolls its own packfile packing
 - lib/Parrot/PackFile.pm does it's own packing  unpacking, which is
   not capable of reading the dir_format=1 PBC format. Non native floats
   are also not implemented.
Index: MANIFEST
===
RCS file: /cvs/public/parrot/MANIFEST,v
retrieving revision 1.394
diff -u -r1.394 MANIFEST
--- MANIFEST	8 Aug 2003 10:06:28 -	1.394
+++ MANIFEST	8 Aug 2003 16:09:12 -
@@ -13,7 +13,6 @@
 RESPONSIBLE_PARTIES   [main]doc
 TODO  [main]doc
 VERSION   [main]doc
-assemble.pl   [devel]
 bit.ops   []
 build_nativecall.pl   []
 byteorder.c   []
@@ -153,7 +152,6 @@
 debug.c   []
 debug.ops []
 disassemble.c []
-disassemble.pl[devel]
 docs/debug.pod[devel]doc
 docs/debugger.pod [main]doc
 docs/dev/byteorder.dev[main]doc
Index: assemble.pl
===
RCS file: assemble.pl
diff -N assemble.pl
--- assemble.pl	27 Jul 2003 21:03:06 -	1.103
+++ /dev/null	1 Jan 1970 00:00:00 -
@@ -1,1175 +0,0 @@
-#!/usr/bin/perl -w
-
-=head1 Parrot Assembler
-
-The Parrot Assembler's job is to take .pasm (Parrot Assembly) files and assemble
-them into Parrot bytecode. Plenty of references for Parrot assembly syntax
-already exist, so we won't go into details there. The assembler does its job
-by reading a .pasm file, extracting numeric and string constants from it, and
-reassembling the bits into bytecode.
-
-The first pass goes through and expands constants, macros, and local labels.
-Syntax is described later on, in the 'Macro' section. The next pass goes through
-and collects the numeric and string constants along with the definition points
-and PCs of labels.
-
-If you would like to view the text after the macro expansion pass, use the C-E
-flag. This flag simply tells the assembler to quit after the CMacro class
-does it thing.
-
-The final pass replaces label occurrences with the appropriate PC offset and
-accumulates the (finally completely numeric) bytecode onto the output string.
-The XS portion takes the constants and bytecode, generates a header, tacks the
-constants and bytecode on, and finally prints out the string.
-
-=head2 Macro
-
-The Parrot assembler's macro layer has now been more-or-less defined, with one
-or two additions to come. The addition of the '.' preface will hopefully make
-things easier to parse, inasmuch as everything within an assembler file that
-needs to be expanded or processed by the macro engine will have a period ('.')
-prepended to it.
-
-The macro layer implements constants, macros, and local labels. Including files
-will be done later on, but this handles most of the basic needs we have for
-macros.
-
-To create a macro, the syntax is slightly different.
-
-  .macro swap (A,B,TEMP) # . marks the directive
-set .TEMP,.A # . marks the special variable.
-set .A,.B
-set .B,.TEMP
-  .endm  # And . marks the end of the macro.
-
-Macros support labels that are local to a given macro expansion, and the syntax
-looks something like this:
-
-  .macro SpinForever (Count)
-.local $LOOP: dec .COUNT # .local $LOOP defines a local label.
-  branch .$LOOP # Jump to said label.
-  .endm
-
-Include this macro as many times as you like, and the branch statement should
-do the right thing every time. To use a global label, just as you usually do.
-
-Constants are new, and the syntax looks like:
-
-  .constant PerlHash 6 # Again, . marks the directive
-
-  new P0, .PerlHash # . marks the special variable for expansion.
-
-Several constants are predefined in the Macro class, but are not generated
-dynamically as they should be, at least not yet.
-
-  .constant Array 0
-  .constant PerlUndef 1
-  ...
-
-This should be generated from include/parrot/pmc.h, but my plans are to add a
-'.include' directive so we can '.include constants.pmc', and let pmc2c build
-the .pmc file at the same time as it builds pmc.h.
-
-When the Assembler class is separated out, tests can use the Assembler class to
-accept a simple array of instructions and generate bytecode directly from that.
-This should eliminate the intermediary 

Re: QUERIES: Questions about Unanswered Elderly or Recent Issues Eventually Solvable

2003-08-11 Thread Leopold Toetsch
Benjamin Goldberg [EMAIL PROTECTED] wrote:
 Dan Sugalski wrote:

 At 11:06 AM +0200 8/8/03, Leopold Toetsch wrote:
[snip]
 PMC methods
 ---
 ParrotIO has methods via find_method/invoke. Should that be a general
 mechanism in default.pmc with one vtable slot for the meth hash?

 We're going to want lexially nested method caches, so I don't think
 we're going to want to do this. The method hash needs to be living in
 the interpreter struct, alas.

 There's no reason why the find_method in default.pmc can't do lookups in
 the interpreter struct, and then of course the normal method would be to
 use find_method.

ParrotIO's methods are hard wired functions implemented in C and called
via our NCI mechanism. So the question is, if we should generalize this
scheme. From pmc/io.t:

   set S5, ok\n
   getstdout P5
   find_method P0, P5, puts
   invoke
   end

 This way, if a pmc class wants to override the normal find_method, it
 can.

 For example, PerlObject's find_method could be:

PMC * find_method(STRING *name) {
   PMC * perlclass = SELF.getprop(string_from_cstring(class));
   return VTABLE_find_method(INTERP, perlclass, name);
}

This looks like:
s/perl/python/g; s/class/__class__/;

Anyway, that's up to ParrotClass/ParrotObject. I was thinking of a low
level Cfind_method for all PMCs, with (probably) hard wired methods
like Cisa(). And these methods should probably not pollute the property
namespace.

 (Hmm, I think that default.pmc would smaller, and no less clear if we
 defined a macro:

 #define THROW_ILL_INHERIT(METH) \
internal_exception(ILL_INHERIT, \
   METH () not implemented in class '%s'\n, \
   caller(INTERP, SELF))

 And then use
THROW_ILL_INHERIT(get_number_keyed);

Yep. Actually I'd like to have these autogenerated for all functions
that now throw an exception. We have a list of functions in vtable.tbl,
so classes/pmc2c.pl could provide the function body, if there is none.
default.pmc then would only have functions bodies with real
functionality.

Patches welcome.

[ snip ]

 That's why encapsulation is so important.  If we had a vtable-isa
 method, then it could be overridden however we want.

We have Ccan and Cdoes, yep Cisa seems to be missing.

leo


configure.pl failed under cygwin, build failed on win32

2003-08-11 Thread K Stol
hello,

I just picked up a fresh copy with cvs.
Under cygwin, ./Configure.pl fails with the message:

Determining some sizes...Linker failed (see test.ldo) at lib/Parrot/Configure/Step.pm 
line 147

So I tried under win32 (MS VS 6.0). Now, Configure.pl is ok, but nmake ends with a 
fatal error.
I don't know how to discover the reason... (are there ways for that?). message:

NMAKE : fatal error U1077: 'e:\AP806_source\perl.exe' : return code '0x2'
Stop.

Klaas-Jan


Re: Packfile stuff

2003-08-11 Thread Juergen Boemmels
Simon Glover [EMAIL PROTECTED] writes:

  parrot_compiler: No make test:
make fails with missing 'open_i_s' (integer file descriptors
are removed)
 
  This is a two-line fix; I've already commited it. (It still doesn't
  actually work, mind, as it makes Parrot segfault when I try to compile
  the sample PASM file, but I don't have time to investigate this at the
  moment).

I don't even know if its a good idea to work more on this. This is yet
another try to replace assemble.pl, this time by something parrot
based.

We should really get imcc/parrot as the default assembler. With the
introduction of the compile opcodes a parrot-based assembler might be
as simple as
  read S0
  compreg P1, PASM1
  compile P0, P1, S0
  write P0

I only entered this directory to find out if the removal of
assembly.pl breaks something that wasn't formerly broken.

bye
boe
-- 
Juergen Boemmels[EMAIL PROTECTED]
Fachbereich Physik  Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47


Re: IMCC hangs

2003-08-11 Thread Leopold Toetsch
Togos [EMAIL PROTECTED] wrote:
 This code causes IMCC to hang:

  ... This started happening around
 the time the 'multiple return' bug was
 fixed,

Seems to be related with the multiple freeing reported by Michael.
With the workaround it runs fine now.

leo


Re: Tail calls

2003-08-11 Thread Juergen Boemmels
Piers Cawley [EMAIL PROTECTED] writes:

 Leopold Toetsch [EMAIL PROTECTED] writes:
 
  Piers Cawley [EMAIL PROTECTED] wrote:
 
  I'm not sure you can optimize it to a jump opcode when you're tail
  calling another function can you? You could be tailcalling into a
  closure so you'll need to use invoke to do the right thing with the
  lexical stack etc.
 
  Argh, yes. What about:
 
  If the subroutine is constructed inside the sub, parrot sees the class
  and can decide at compile time to either jump or invoke.
 
  If the subroutine is passed in, a runtime check could be done:
 
if sub.isa(Sub) goto do_jump
invoke
 
 Umm... not sure quite what you mean there. Don't forget that the sub
 could be got by doing:
 
 find_lex P0, 'sub_name'

One of my projects is to allow tail-calls in languages/scheme (Don't
assume anything in the near future; i currently work on the io-system
and its near and far friends). My plan for this is to use a new
emitting instruction _tail_call_function which does emit
  find_lex P0, 'name'
  invoke  # this does not change P1
instead of
  find_lex P0, 'name'
  save P1
  invokecc# this uses P1 as return address
  restore P1  # invoke P1 from the function brings us back here
  invoke P1   # this brings us back to our caller
which the current _call_function would emit

Thinking a little about it, even call/cc is very simple to implement
  # checking of arguments
  set P0, P5  # first argument is the function which will be called
  set P5, P1  # first argument of the called function is cc
  invoke  # tail call

No jumps are needed in this code. Jump should get translated
jmp/branch - invoke
jsr/bsr- invokecc
ret- invoke P1

bye
boe
-- 
Juergen Boemmels[EMAIL PROTECTED]
Fachbereich Physik  Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47


Re: This Week's Summary

2003-08-11 Thread Robert Spier
  list has been about fighting Subversion. However, Arthur did post a mini
  status update at the end of July
  http://xrl.us/o2s -- Status report
 
  I am having trouble following this url.  Is there another?
 
 Ah... bugger. I thought ponie-dev got gatewayed through to news and
 picked up by google in the same way as the perl6 lists. I'm not sure
 where the archive might be.

It will be, but it takes some time to propogate through the system.

-R


parrot bug: continuations/multiple return

2003-08-11 Thread Michal Wallace

Hey all,

Sorry for the huge code listing here, but I don't
have a simpler case. This is what pirate outputs
when it compiles the following program:


   def f(x):
   if x:
   return 1
   else:
   return 0
print f(1), f(0)


As far as I can tell, I'm doing exactly the same thing
for the return 1 and return 0 branches... But the output
of this program is: 

   1 get_string() not implemented in class 'Continuation'\n

Calling f(0) causes the bug even if f(1) isn't called first.
I think this is a bug in parrot's register allocation scheme.

Or am I just doing something stupid? :)


BTW: It would be SO nice if parrot could print a line 
number for ALL its error messages. (Or if the debugger
didn't segfault g)


##

.sub __main__
new_pad 0
setline 1
newsub $P0, .Sub, _sub0
store_lex -1, 'f', $P0
.local object arg0
arg0 = new PerlInt
arg0 = 1
find_lex $P2, 'f'
newsub $P3, .Continuation, ret0
.pcc_begin non_prototyped
.arg arg0
.pcc_call $P2, $P3
ret0:
.result $P1
.pcc_end
.arg $P1
call __py__print
print  
.local object arg1
arg1 = new PerlInt
arg1 = 0
find_lex $P5, 'f'
newsub $P6, .Continuation, ret1
.pcc_begin non_prototyped
.arg arg1
.pcc_call $P5, $P6
ret1:
.result $P4
.pcc_end
.arg $P4
call __py__print
print \n
end
.end
.include 'pirate.imc'

# f from line 1
.pcc_sub _sub0 non_prototyped
.param object x
setline 2
.local object test0
test0 = new PerlInt
test0 = x
unless test0 goto elif0  ### if x return 1
.local object res0   
res0 = new PerlInt
res0 = 1
.pcc_begin_return
.return res0
.pcc_end_return
goto endif0
elif0:   ### else return 0
.local object res1
res1 = new PerlInt
res1 = 0
.pcc_begin_return
.return res1
.pcc_end_return
endif0:
.end

##


Sincerely,
 
Michal J Wallace
Sabren Enterprises, Inc.
-
contact: [EMAIL PROTECTED]
hosting: http://www.cornerhost.com/
my site: http://www.withoutane.com/
--




Further to: Resumable ops and exceptions

2003-08-11 Thread Jos Visser
There are a number of ops that could fail. Examples are find_lex but
also the various load and lookup ops. Options for handling failure are:

- Abort parrot
- Throw an exception
- Return a default (null) value

I think it is hard for the parrot designers to decide what language
implementors want (given the vast array of languages out there for which
parrot is a godsend). I am currently extending my OpenComal interpreter 
with a parrot code generator and since Comal is a somewhat awkward 
language I need different things than the average perl/python/hq9 
implementor.

I would therefore vote for a feature where I (as language designer)
could indicate whether for instance a find_lex (but others too) fails
silently (null return value) or with an exception.

Maybe this should be a global something...

Real CPU's often have a control register that contains CPU-wide flags.
Maybe parrot needs one too?

++Jos.es

-- 
ek is so lug jy vlieg deur my
sonder jou is ek sonder patroon
   Breyten Breytenbach



Re: [CVS ci] Exec

2003-08-11 Thread Daniel Grunblatt
On Friday 08 August 2003 14:16, Nicholas Clark wrote:
 On Fri, Aug 08, 2003 at 01:48:17PM -0300, Daniel Grunblatt wrote:
  Now Exec works exactly like the jit, I have checked in the missing
  restart, fixed some bugs at Parrot_jit_store_retval and make exec_start
  call runops instead of calling run_compiled directly, so now all test are
  successful.

 Woohoo!

 Does this mean that you've delivered your grant deliverables?

I think so, yes.


 Nicholas Clark

Daniel.


Re: assign opcodes

2003-08-11 Thread Benjamin Goldberg


Brent Dax wrote:
 
 TOGoS:
 # Personally, I would like = to mean 'set', and
 # maybe - do 'assign'.
 
 I usually think of registers as variables with fixed names, so the Perl
 6 part of my brain suggests:
 
 $P0  = $P1  #assign
 $P0 := $P1  #set

Which is why I suggested, when proposing renaming assign, set, and clone
to alias, mutate, create, that shorthand for alias (which is today's set
Px, Py and set Sx, Sy) be :=, and shorthand for mutate (which is
today's assign) be =.


-- 
$a=24;split//,240513;s/\B/ = /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print [EMAIL PROTECTED]
]\n;((6=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))redo;}


XGameStation

2003-08-11 Thread Ask Bjoern Hansen

We totally need to have Parrot running on this thing when it comes
out.  :-)

  http://www.xgamestation.com/


  - ask

-- 
ask bjoern hansen, http://www.askbjoernhansen.com/ !try; do();


Re: [perl #23252] [PATCH] IO seek/tell refactoring

2003-08-11 Thread Juergen Boemmels
Vladimir Lipskiy [EMAIL PROTECTED] writes:

Thanks for the testing

 t/pmc/io...NOK 3# Failed test (t/pmc/io.t at line 37)
 #  got: 'fdopen failed
 # '
 # expected: 'ok
 # '
 t/pmc/io...NOK 4# Failed test (t/pmc/io.t at line 51)
 #  got: 'fdopen failed
 # '
 # expected: 'ok
 # '

This is a missing implementation of fdopen on windows.
Its not clear to me how this call should behave. PIO_win32_fdopen
takes a Parrot_WIN32_Handle which is actually a void*.

Using the numbers 0,1,2 in this call does not seem right
here. Especially since we decided to drop the integer file handles
(perl #22899).

 t/pmc/io...NOK 5# Failed test (t/pmc/io.t at line 66)
 #  got: 'ok 1
 # ok 2
 # not ok 3
 # ok 4
 # ok 5
 # ok 6
 # '
 # expected: 'ok 1
 # ok 2
 # ok 3
 # ok 4
 # ok 5
 # ok 6
 # '

get_bool calls PIO_eof, which only checks io-flags  PIO_F_EOF. The
win32 read function does not seem to set this flag correct. It looks
correct but without win32 I cant debugg this.

Can you run parrot t/pmc/io_5.pasm in the debugger, break on
PIO_win32_read and look if the line 
  io-flags |= PIO_F_EOF;
is reached?

 t/pmc/io...NOK 19# Failed test (t/pmc/io.t at line 274)
 #  got: 'Can't spawn .\parrot.exe --gc-debug t/pmc/io_15.pasm: Bad
 fil
 e descriptor at lib/Parrot/Test.pm line 61.
 # '
 # expected: 'ok 1
 # Hello Parrot!
 # '
 # '.\parrot.exe --gc-debug t/pmc/io_15.pasm' failed with exit code 255

why can't it spawn .\parrot.exe only in this test all other tests seem
to have no problem with spawning. Try to run this test by hand
.\parrot.exe t/pmc/io_15.pasm

 # Looks like you failed 4 tests of 19.
 t/pmc/io...dubious
 Test returned status 4 (wstat 1024, 0x400)
 DIED. FAILED tests 3-5, 19
 Failed 4/19 tests, 78.95% okay (less 1 skipped test: 14 okay,
 73.68%)

bye
boe
-- 
Juergen Boemmels[EMAIL PROTECTED]
Fachbereich Physik  Tel: ++49-(0)631-205-2817
Universitaet Kaiserslautern Fax: ++49-(0)631-205-3906
PGP Key fingerprint = 9F 56 54 3D 45 C1 32 6F  23 F6 C7 2F 85 93 DD 47