Ticket #1932 (new bug)

Opened 4 years ago

Last modified 4 years ago

rakudo on parrot RELEASE_2_11_0-656-g27c0799 executes main body twice

Reported by: moritz Owned by:
Priority: normal Milestone:
Component: none Version: 2.11.0
Severity: release Keywords:
Cc: Language:
Patch status: Platform:

Description

$ ./perl6 -e 'say 3'
3
3

likewise all test files confuse the test harness.

This didn't happen on RELEASE_2_11_0-478-gd69dbbc for example, and in the mean time rakudo didn't change signficantly.

Change History

  Changed 4 years ago by bacek

Hello.

My bisect showing commits related to #1704. Unfortunatelly branch (?) was merged without "--no-ff" param and can't be easily reverted.

-- Bacek

  Changed 4 years ago by pmichaud

On Tue, Jan 04, 2011 at 11:14:43AM -0000, Parrot wrote:
> #1932: rakudo on parrot RELEASE_2_11_0-656-g27c0799 executes main body twice
>  {{{
>  $ ./perl6 -e 'say 3'
>  3
>  3
>  }}}
> 
>  likewise all test files confuse the test harness.
> 
>  This didn't happen on RELEASE_2_11_0-478-gd69dbbc for example, and in the
>  mean time rakudo didn't change signficantly.

NQP-rx exhibits a similar (same?) problem with RELEASE_2_11_0-663-g7cc276c -- 
many tests end up running twice and confusing the test harness.

It appears to be the same set of tests that were suffering from the
implicit :main issues discussed in TT #1704, so I suggest that's a likely
starting point for tracking down this problem.

Pm

follow-up: ↓ 4   Changed 4 years ago by pmichaud

Part of the problem may be that :load subs are being executed even when being loaded outside of the load_bytecode opcode (which goes against PDD 19).

$ cat x.pir
.sub 'first'
    say 'first'
.end

.sub 'load' :load
    say ':load'
.end

$ ./parrot x.pir
:load
first
$ 

Here we can see that the :load sub is being invoked even when not loaded via load_bytecode.

NQP and Rakudo have to generate :load subs at the end of each module to automatically invoke the module's mainline when the module is loaded via load_bytecode. Since :load subs are now being invoked even for the initial program file or when compiled in memory (which is the province of the :init flag), the mainline gets executed "twice".

Pm

in reply to: ↑ 3   Changed 4 years ago by plobsing

Replying to pmichaud: should be remedied at 9dda543

  Changed 4 years ago by jkeenan

As of commit b9e9c3cb8ad4c84853edaa3114bda8456f0783cc, I believe this problem is fixed.

1.

[parrot@W5028539] 516 $ cat ../rakudo/parrot/x.pir
.sub 'first'
    say 'first'
.end

.sub 'load' :load
    say ':load'
.end

[parrot@W5028539] 517 $ ./parrot ../rakudo/parrot/x.pir 
first

2.

[rakudo@W5028539] 520 $ ./perl6 -e 'say 3'
3

3. I have both NQP-RX and Rakudo passing their respective make test suites.

moritz/pmichaud: Can you verify and close the ticket? Thank you very much.

kid51

  Changed 4 years ago by moritz

This problem is indeed fixed, so the ticket can be closed as soon as there is test coverage in the parrot test suite.

Note: See TracTickets for help on using tickets.