Ticket #1542 (new bug)

Opened 12 years ago

Last modified 11 years ago

HLLs sometimes leak into loaded modules

Reported by: sorear Owned by: whiteknight
Priority: normal Milestone:
Component: core Version: 2.2.0
Severity: medium Keywords:
Cc: Language: blizkost
Patch status: new Platform:

Description

stefan@stefans:~$ perl6 -e 'pir::load_bytecode("/usr/local/lib/parrot/2.2.0-devel/languages/nqp/nqp.pbc")'
Parent isn't a Class.
current instr.: 'parrot;P6metaclass;add_parent' pc 224 (runtime/parrot/library/P6object.pir:232)
called from Sub 'parrot;P6metaclass;register' pc 532 (runtime/parrot/library/P6object.pir:408)
called from Sub 'perl6;PCT;Grammar;onload' pc -1 ((unknown file):-1)
called from Sub 'perl6;PCT;__onload' pc 0 (compilers/pct/PCT.pir:18)
... call repeated 1 times

I'm not sure what's going on here or how to start debugging it. Austin thinks that Rakudo is redefining something somewhere, but that wouldn't explain the fact that PCT has somehow become loaded into the perl6 top level namespace. I suspect a Parrot bug somewhere.

Attachments

ns_abduction.patch Download (0.7 KB) - added by plobsing 11 years ago.
Only adopt Namespaces without parents.

Change History

Changed 12 years ago by particle

  • priority changed from normal to blocker

this is blocking Blizkost *.

Changed 12 years ago by particle

  • lang set to blizkost

Changed 12 years ago by sorear

Some more data points. This occurs with any module that loads PCT/Grammar.pbc, or loading PCT/Grammar.pbc itself. It does not occur with PCT/HLLCompiler.pbc. It was possible to make Blizkost load by narrowing the load_bytecode opcode to only load HLLCompiler; thus this is no longer a blocker. I am still curious what causes this though.

Changed 11 years ago by plobsing

  • priority changed from blocker to normal

Here's why PCT is in the perl6 HLL:

  • Rakudo exports PCT (among other things) into perl6 root namespace using Namespace.export_to
  • Namespace.export_to adds to the target namespace using Namespace.set_pmc_keyed_str
  • when Namespace.set_pmc_keyed_str detects that it is adding a Namespace to a Namespace, it reparents the child Namespace to SELF.

This means that PCT is available both as ['parrot';'PCT'] and ['perl6';'PCT'], but anything under PCT will think it is in ['perl6';'PCT'].

The good news is that the HLL associated with Namespaces, Subs, etc in this heirarchy should remain unchanged.

The bad news is that it appears we have yet another Namespace <=> Class mismatch occuring (which is why we get the 'Parrent isn't a Class' error).

A small patch to src/pmc/namespace.pmc is sufficient to fix *this* bug, but I think more important here is the overall insanity of the reparenting special case at all. Also the lingering Namespace/Class associations (which is the root of this as well as other bugs).

Changed 11 years ago by plobsing

Only adopt Namespaces without parents.

Changed 11 years ago by jkeenan

  • component changed from none to core
  • patch set to new

Changed 11 years ago by whiteknight

  • owner set to whiteknight
Note: See TracTickets for help on using tickets.