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

:init Where should we put the flag?

5 views
Skip to first unread message

Kevin Tew

unread,
Oct 29, 2006, 3:25:25 PM10/29/06
to parrot-...@perl.org
I've had :init implemented for a couple of weeks now, but I can't check
it in because it needs its own flag.
Currently I'm using PObj_private7_FLAG to indicate a :init sub, but I
stole PObj_private7_FLAG from SUB_FLAG_PF_POSTCOMP.
Leo suggested using PObj_private2_FLAG, but when I did tons of tests
broke. The :init flag is used at loadtime which is part of runtime. So
that might explain the conflict.

Ok enough history. I'd like to get this feature checked in. The
question is where should the flag go?
As things sit now we've run out of space in PObj_private.

Kevin

SUB_FLAG_PF_INIT

/*
* Subroutine flags
*/
typedef enum {
/* runtime usage flags */
SUB_FLAG_CORO_FF = PObj_private0_FLAG,
SUB_FLAG_C_HANDLER = PObj_private0_FLAG, /* C exceptions only */
SUB_FLAG_TAILCALL = PObj_private2_FLAG,
SUB_FLAG_GENERATOR = PObj_private3_FLAG, /* unused old python pmcs */

/* compile/loadtime usage flags */
/* from packfile */
SUB_FLAG_IS_OUTER = PObj_private1_FLAG,
SUB_FLAG_PF_INIT = PObj_private7_FLAG,
SUB_FLAG_PF_ANON = PObj_private3_FLAG,
SUB_FLAG_PF_MAIN = PObj_private4_FLAG,
SUB_FLAG_PF_LOAD = PObj_private5_FLAG,
SUB_FLAG_PF_IMMEDIATE = PObj_private6_FLAG,
SUB_FLAG_PF_POSTCOMP = PObj_private7_FLAG,

SUB_FLAG_PF_MASK = 0xfe /* anon ... postcomp, is_outer*/
} sub_flags_enum;

Jonathan Worthington

unread,
Oct 29, 2006, 3:58:02 PM10/29/06
to Kevin Tew, parrot-...@perl.org
Kevin Tew wrote:
> I've had :init implemented for a couple of weeks now, but I can't
> check it in because it needs its own flag.
>
> <snip>

>
> SUB_FLAG_GENERATOR = PObj_private3_FLAG, /* unused old python
> pmcs */
Have you tried this one? It's labeled unused, and I find no references
to it at all in src or include, meaning it's not used in core Parrot
(yes, two old unused Python PMCs use it; I'm sure they can be re-written
not to use it without too much trouble, if they are used in the future -
apologies if someone is actually maintaining these, I'm just going on
the source comment)

Jonathan

Leopold Toetsch

unread,
Oct 29, 2006, 4:05:11 PM10/29/06
to perl6-i...@perl.org, Kevin Tew
Am Sonntag, 29. Oktober 2006 21:25 schrieb Kevin Tew:
> I've had :init implemented for a couple of weeks now, but I can't check
> it in because it needs its own flag.

I think I've answered that already. Again:

    SUB_FLAG_CORO_FF      = PObj_private0_FLAG,
    SUB_FLAG_C_HANDLER    = PObj_private0_FLAG, /* C exceptions only */

is/are runtime flags/s( and usuable as well as:

    SUB_FLAG_TAILCALL     = PObj_private2_FLAG,

leo

Kevin Tew

unread,
Oct 29, 2006, 6:21:50 PM10/29/06
to Leopold Toetsch, perl6-i...@perl.org
Using either of those flags ( PObj_private0_FLAG or PObj_private2_FLAG
) break other tests.

I'm up for more suggestions.
Kevin

SUB_FLAG_PF_INIT = PObj_private2_FLAG

Failed Test Stat Wstat Total Fail Failed List of
Failed
-------------------------------------------------------------------------------
t/codingstd/c_code_coda.t 2 512 2 2 100.00% 1-2
t/codingstd/cuddled_else.t 1 256 1 1 100.00% 1
t/codingstd/tabs.t 1 256 1 1 100.00% 1
t/compilers/imcc/reg/spill.t 1 256 9 1 11.11% 5
t/compilers/imcc/syn/objects.t 11 2816 11 11 100.00% 1-11
t/compilers/imcc/syn/tail.t 1 256 6 1 16.67% 6
t/compilers/pge/p6regex/01-regex. 495 1 0.20% 324
t/compilers/tge/grammar.t 2 512 3 2 66.67% 1-2
t/dynpmc/subclass_with_pir_method 2 512 2 2 100.00% 1-2
t/examples/pir.t 1 256 19 1 5.26% 5
t/examples/streams.t 4 1024 12 4 33.33% 3 5 7-8
t/library/dumper.t 2 512 26 2 7.69% 12 26
t/library/mime_base64.t 1 256 552 5 0.91% 550-552
t/library/pg.t 0 6 43 77 179.07% 5-43
t/library/streams.t 5 1280 20 5 25.00% 9-10
15-16 19
t/op/calling.t 7 1792 96 7 7.29% 39-41 54 64
95-96
t/op/gc.t 2 512 22 2 9.09% 10 13
t/op/sprintf.t 308 37 12.01% 32-33
37-43 56
64 144
153 187
191 194-196
216-223
225-
232 304-306
t/op/string.t 1 256 160 1 0.62% 144
t/pmc/delegate.t 2 512 9 2 22.22% 8-9
t/pmc/freeze.t 2 512 25 2 8.00% 24-25
t/pmc/mmd.t 3 768 39 3 7.69% 29-31
t/pmc/object-meths.t 15 3840 34 15 44.12% 13-15 21-25
28-34
t/pmc/objects.t 15 3840 78 15 19.23% 17
50-51 53-55
59 64 68-71
75-77
t/pmc/parrotobject.t 3 768 5 3 60.00% 2-3 5
t/pmc/resizablestringarray.t 173 10 5.78% 65-68 75-76
83-84 91-92
t/pmc/sub.t 1 256 58 1 1.72% 58
t/pmc/threads.t 2 512 20 2 10.00% 13-14
t/stm/queue.t 3 768 4 3 75.00% 1-3
t/stm/runtime.t 2 512 5 2 40.00% 4-5
t/tools/smartlinks.t 255 65280 65 129 198.46% 1-65
8 tests and 532 subtests skipped.
Failed 31/260 test scripts, 88.08% okay. 246/8079 subtests failed,
96.96% okay.
make: *** [test] Error 1


SUB_FLAG_PF_INIT = PObj_private0_FLAG
Failed Test Stat Wstat Total Fail Failed List of
Failed
-------------------------------------------------------------------------------
t/codingstd/c_code_coda.t 2 512 2 2 100.00% 1-2
t/codingstd/cuddled_else.t 1 256 1 1 100.00% 1
t/codingstd/tabs.t 1 256 1 1 100.00% 1
t/compilers/pge/p6regex/01-regex. 495 1 0.20% 324
t/dynpmc/dynlexpad.t 4 1024 6 4 66.67% 2-5
t/dynpmc/subclass_with_pir_method 1 256 2 1 50.00% 2
t/library/mime_base64.t 1 256 552 5 0.91% 550-552
t/library/pg.t 0 6 43 77 179.07% 5-43
t/op/calling.t 2 512 96 2 2.08% 95-96
t/op/debuginfo.t 1 256 6 1 16.67% 4
t/op/lexicals.t 1 256 41 1 2.44% 22
t/op/sprintf.t 308 37 12.01% 32-33
37-43 56
64 144
153 187
191 194-196
216-223
225-
232 304-306
t/pmc/resizablestringarray.t 173 10 5.78% 65-68 75-76
83-84 91-92
t/tools/smartlinks.t 255 65280 65 129 198.46% 1-65
8 tests and 532 subtests skipped.
Failed 14/260 test scripts, 94.62% okay. 168/8079 subtests failed,
97.92% okay.

SUB_FLAG_PF_INIT = PObj_private7_FLAG
Failed Test Stat Wstat Total Fail Failed List of
Failed
-------------------------------------------------------------------------------
t/codingstd/c_code_coda.t 2 512 2 2 100.00% 1-2
t/codingstd/cuddled_else.t 1 256 1 1 100.00% 1
t/codingstd/tabs.t 1 256 1 1 100.00% 1
t/compilers/pge/p6regex/01-regex. 495 1 0.20% 324
t/dynpmc/subclass_with_pir_method 1 256 2 1 50.00% 2
t/library/mime_base64.t 1 256 552 5 0.91% 550-552
t/library/pg.t 0 6 43 77 179.07% 5-43
t/op/calling.t 2 512 96 2 2.08% 95-96
t/op/sprintf.t 308 37 12.01% 32-33
37-43 56
64 144
153 187
191 194-196
216-223
225-
232 304-306
t/pmc/resizablestringarray.t 173 10 5.78% 65-68 75-76
83-84 91-92
t/tools/smartlinks.t 255 65280 65 129 198.46% 1-65

Kevin Tew

unread,
Oct 30, 2006, 4:58:59 PM10/30/06
to Leopold Toetsch, parrot-...@perl.org
Using either of those flags ( PObj_private0_FLAG or PObj_private2_FLAG
) break other tests.

I'm up for more suggestions.
Kevin

Leopold Toetsch

unread,
Nov 6, 2006, 5:47:16 PM11/6/06
to perl6-i...@perl.org, Kevin Tew, parrot-...@perl.org
Am Montag, 30. Oktober 2006 22:58 schrieb Kevin Tew:
> Using either of those flags ( PObj_private0_FLAG or  PObj_private2_FLAG
> ) break other tests.
>
> I'm up for more suggestions.

Sorry for the very delayed answer.

Reusing these compile-time flags isn't really safe obviously, as running the
code of course might need the reused flags for runtime. I should have thought
of that in the first place.

Therefore we need:
- a new field in the struct Parrot_sub / struct Parrot_coro: UINTVAL
comp_flags [1]
- it's usable as PMC_sub(pmc)->comp_flags then
- all the compile time flags should go there (moving the new one first as a
test is of course ok)
- the flags can then be defined in sub.h and imcc can just reuse these defines
(using the current imcc bits, which are more restricted)

leo

[1] include/parrot/sub.h
please regard the common order of fields in these 2 structs

0 new messages