Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: [perl #32466] [PATCH] Parrot m4 0.0.10 and "eval" changes

5 views
Skip to first unread message

Leopold Toetsch

unread,
Nov 17, 2004, 3:09:52 AM11/17/04
to perl6-i...@perl.org
Bernhard Schmalhofer <parrotbug...@parrotcode.org> wrote:

> The 'eval' compiler returns a bytecode segment without a constant table. The
> 'destroy' of the Eval PMC needs to handle that.

How that? Are there no constants? Anyway, switching to a new bytecode
segment does switch the constant table too, so all compiled code ought
to have a constant table.

leo

Leopold Toetsch

unread,
Nov 17, 2004, 4:24:45 AM11/17/04
to perl6-i...@perl.org
Bernhard Schmalhofer <parrotbug...@parrotcode.org> wrote:

> this patch brings Parrot m4 to terms with recent "eval" changes. The compile
> function of the 'eval' compiler now returns an Eval PMC. The m4 macro "eval"
> is a simple interpreter of integer arithmetic expressions.

Thanks, applied.
leo

Bernhard Schmalhofer

unread,
Nov 17, 2004, 9:30:42 AM11/17/04
to l...@toetsch.at, perl6-i...@perl.org

Yes, there are no constants. The only thing the generated sub does, is
to return an integer value, that was computed in the C-Code.
Thus the m4 macro "eval( 1 ^ 3 )" compiles into a sub that looks in PIR
like:

.sub generated_sub
.return( 3 )
.end

Of course it would be much more simle to use a plain NCI call for this
purpose.
But I wanted to play with 'compreg' when I implemented that.

CU, Bernhard

--
**************************************************
Dipl.-Physiker Bernhard Schmalhofer
Senior Developer
Biomax Informatics AG
Lochhamer Str. 11
82152 Martinsried, Germany
Tel: +49 89 895574-839
Fax: +49 89 895574-825
eMail: Bernhard.S...@biomax.com
Website: www.biomax.com
**************************************************

Leopold Toetsch

unread,
Nov 17, 2004, 10:57:49 AM11/17/04
to Bernhard Schmalhofer, perl6-i...@perl.org
Bernhard Schmalhofer <Bernhard.S...@biomax.de> wrote:

> Leopold Toetsch wrote:
>>
>> How that? Are there no constants?

> Yes, there are no constants. The only thing the generated sub does, is


> to return an integer value, that was computed in the C-Code.
> Thus the m4 macro "eval( 1 ^ 3 )" compiles into a sub that looks in PIR
> like:

> .sub generated_sub
> .return( 3 )
> .end

I see. And what about the equivalent of eval("ab" <concat> "cd") or
eval(1.3 + 2.5) ?

> CU, Bernhard

leo

0 new messages