diff --git a/compilers/imcc/pbc.c b/compilers/imcc/pbc.c index 1500ceb..09f535a 100644 --- a/compilers/imcc/pbc.c +++ b/compilers/imcc/pbc.c @@ -1410,6 +1410,8 @@ add_const_pmc_sub(PARROT_INTERP, ARGMOD(SymReg *r), size_t offs, size_t end) else sub->ns_entry_name = sub->name; } + else if (unit->is_method || unit->is_vtable_method) + sub->ns_entry_name = Parrot_str_new_constant(interp, ""); else sub->ns_entry_name = sub->name; diff --git a/compilers/pge/PGE/Exp.pir b/compilers/pge/PGE/Exp.pir index 3342260..b324f17 100644 --- a/compilers/pge/PGE/Exp.pir +++ b/compilers/pge/PGE/Exp.pir @@ -163,7 +163,7 @@ tree as a PIR code object that can be compiled. .local string returnop returnop = '.yield' code.'emit'(<<" CODE", name, pirflags, namecorou, .INTERPINFO_CURRENT_SUB) - .sub %0 :method %1 + .sub %0 :nsentry(%0) :method %1 .param pmc adverbs :slurpy :named .local pmc mob .const 'Sub' corou = %2 @@ -192,7 +192,7 @@ tree as a PIR code object that can be compiled. ## Initial code for a rule that cannot be backtracked into. returnop = '.return' code.'emit'(<<" CODE", name, pirflags) - .sub %0 :method %1 + .sub %0 :nsentry(%0) :method %1 .param pmc adverbs :unique_reg :slurpy :named .local pmc mob .local string target :unique_reg diff --git a/compilers/pge/PGE/Regex.pir b/compilers/pge/PGE/Regex.pir index 81a375b..0a94a60 100644 --- a/compilers/pge/PGE/Regex.pir +++ b/compilers/pge/PGE/Regex.pir @@ -37,7 +37,7 @@ Match an identifier. =cut -.sub 'ident' :method +.sub 'ident' :method :nsentry .param pmc adverbs :slurpy :named .local string target .local pmc mob, mfrom, mpos diff --git a/runtime/parrot/library/Stream/Base.pir b/runtime/parrot/library/Stream/Base.pir index 622312a..8d9452e 100644 --- a/runtime/parrot/library/Stream/Base.pir +++ b/runtime/parrot/library/Stream/Base.pir @@ -65,7 +65,7 @@ END: =cut -.sub close :method +.sub close :method :nsentry .local pmc temp # reset source diff --git a/runtime/parrot/library/pcore.pir b/runtime/parrot/library/pcore.pir index a64cb02..ac78cec 100644 --- a/runtime/parrot/library/pcore.pir +++ b/runtime/parrot/library/pcore.pir @@ -7,7 +7,7 @@ .namespace [ 'Sub' ] # implementation Sub.get_lexenv :method -.sub get_lexenv :method +.sub get_lexenv :method :nsentry .local pmc env, pad, interp env = new 'ResizablePMCArray' .local int level diff --git a/src/global.c b/src/global.c index 1c181c5..1e726fe 100644 --- a/src/global.c +++ b/src/global.c @@ -757,7 +757,10 @@ store_sub_in_multi(PARROT_INTERP, ARGIN(PMC *sub_pmc), ARGIN(PMC *ns)) PMC *multisub; PMC_get_sub(interp, sub_pmc, sub); - ns_entry_name = sub->ns_entry_name; + ns_entry_name = Parrot_str_equal(interp, sub->method_name, CONST_STRING(interp, "")) + ? sub->ns_entry_name + : sub->method_name; + multisub = VTABLE_get_pmc_keyed_str(interp, ns, ns_entry_name); /* is there an existing MultiSub PMC? or do we need to create one? */ diff --git a/t/compilers/imcc/syn/subflags.t b/t/compilers/imcc/syn/subflags.t index db7bb85..82473b8 100644 --- a/t/compilers/imcc/syn/subflags.t +++ b/t/compilers/imcc/syn/subflags.t @@ -67,7 +67,7 @@ t/compilers/imcc/syn/subflags.t - test flags on PIR subs isa_ok($P30, 'Sub', ":method sub found w/.const") $P0 = get_global 'method1' $I0 = isnull $P0 - todo($I0, ":method sub not found in namespace") + ok($I0, ":method sub not found in namespace") ## :subid subs .const 'Sub' $P40 = 'subid1' diff --git a/t/library/p6object.t b/t/library/p6object.t index 20a3e13..aed4d44 100644 --- a/t/library/p6object.t +++ b/t/library/p6object.t @@ -404,7 +404,7 @@ diagnostic message). .namespace ['ABC'] -.sub 'foo' :method +.sub 'foo' :method :nsentry .return ('ABC::foo') .end diff --git a/t/oo/composition.t b/t/oo/composition.t index 0f9fbcb..3561123 100644 --- a/t/oo/composition.t +++ b/t/oo/composition.t @@ -34,16 +34,16 @@ Tests role composition in the OO implementation. multi_composition() .end -.sub badger :method +.sub badger :method :nsentry .return('Badger!') .end -.sub badger2 :method +.sub badger2 :method :nsentry .return('Second Badger!') .end -.sub mushroom :method +.sub mushroom :method :nsentry .return('Mushroom!') .end -.sub snake :method +.sub snake :method :nsentry .return('Snake!') .end .sub fire diff --git a/t/oo/mro-c3.t b/t/oo/mro-c3.t index f42c632..d972753 100644 --- a/t/oo/mro-c3.t +++ b/t/oo/mro-c3.t @@ -27,19 +27,19 @@ Tests the C3 Method Resolution order for the OO implementation. diamond_inheritance() .end -.sub method_A :method +.sub method_A :method :nsentry .return('Method from A') .end -.sub method_B :method +.sub method_B :method :nsentry .return('Method from B') .end -.sub method_C :method +.sub method_C :method :nsentry .return('Method from C') .end -.sub method_D :method +.sub method_D :method :nsentry .return('Method from D') .end diff --git a/t/oo/proxy.t b/t/oo/proxy.t index 315d092..ba93906 100644 --- a/t/oo/proxy.t +++ b/t/oo/proxy.t @@ -93,7 +93,7 @@ Tests OO features related to creating and using class proxies. .end .namespace ['Complex'] -.sub 'Complex' :method +.sub 'Complex' :method :nsentry .return (self) .end diff --git a/t/op/calling.t b/t/op/calling.t index 9d3531c..ba4343b 100644 --- a/t/op/calling.t +++ b/t/op/calling.t @@ -991,13 +991,13 @@ pir_output_is( <<'CODE', <<'OUTPUT', "OO argument passing" ); f(o, "ok 4\n") .end .namespace ["Foo"] -.sub bar :method +.sub bar :method :nsentry .param string s print self print " " print s .end -.sub baz :method +.sub baz :method :nsentry .param string s print self print " " diff --git a/t/op/gc.t b/t/op/gc.t index 972297b..56bdaad 100755 --- a/t/op/gc.t +++ b/t/op/gc.t @@ -182,7 +182,7 @@ GC related bugs. ok(1, "leaving do_inc") .end -.sub __increment :method +.sub 'increment' :vtable :method ok(1, "in __increment") sweep 1 .end diff --git a/t/pmc/class.t b/t/pmc/class.t index 7731c36..8915640 100644 --- a/t/pmc/class.t +++ b/t/pmc/class.t @@ -458,7 +458,7 @@ t_class_meth: is(result, 42, 'new() added method returns expected value') .end -.sub add :method +.sub add :method :nsentry $P0 = getattribute self, "x" $P1 = getattribute self, "y" $P2 = new ['Integer'] diff --git a/t/pmc/freeze.t b/t/pmc/freeze.t index b8156ac..838ae1a 100644 --- a/t/pmc/freeze.t +++ b/t/pmc/freeze.t @@ -765,7 +765,7 @@ pir_output_is( <<'CODE', <<'OUTPUT', "freeze/thaw a Conure" ); .end .namespace ['Conure'] -.sub __init :method +.sub 'init' :method :vtable $P0 = new ['Integer'] $P0 = 37 setattribute self, 'temperature', $P0 diff --git a/t/pmc/objects.t b/t/pmc/objects.t index 8d96d9c..e605e5a 100644 --- a/t/pmc/objects.t +++ b/t/pmc/objects.t @@ -1390,7 +1390,7 @@ l1: .namespace [ 'Foo41' ] -.sub '__get_string' :method +.sub 'get_string' :method :vtable .return('Hello world') .end diff --git a/t/pmc/pmcproxy.t b/t/pmc/pmcproxy.t index cb07de7..a23adad 100644 --- a/t/pmc/pmcproxy.t +++ b/t/pmc/pmcproxy.t @@ -190,7 +190,7 @@ Tests the PMCProxy PMC. is($P3, 42, "the magic overriding sub was called") ok(1, 'Called non-overridden method, which called overridden vtable method') .end -.sub always42 :method +.sub always42 :method :nsentry .param string what $P0 = new ['Integer'] $P0 = 42