Ticket #926 (closed todo: fixed)

Opened 5 years ago

Last modified 5 years ago

Kill Parrot_cont structure

Reported by: bacek Owned by: whiteknight
Priority: normal Milestone:
Component: core Version: 1.4.0
Severity: medium Keywords:
Cc: Language:
Patch status: Platform:

Description

«Continuation PMC has a Parrot_cont structure as an attribute. I suggest that we should kill these structures and store their members as ATTRs directly in the PMC.»

Copy from #795.

Attachments

cont-pmc.patch Download (35.1 KB) - added by jrtayloriv 5 years ago.
(buggy) patch to kill Parrot_cont struct
rm-newcont.patch Download (1.9 KB) - added by jrtayloriv 5 years ago.
patch to remove unused new_continuation() and new_ret_continuation() functions from src/sub.c
fix_gc_bug.patch Download (0.7 KB) - added by jrtayloriv 5 years ago.
fixes gc error in original patch

Change History

Changed 5 years ago by jrtayloriv

(buggy) patch to kill Parrot_cont struct

Changed 5 years ago by jrtayloriv

I have added a patch to kill the Parrot_cont struct. It is failing several tests at this point, and probably contains a few errors on my part, but it is building without any errors/warnings and at least makes it through the test suite without segfaulting.

Changed 5 years ago by jrtayloriv

Currently, it looks like it is dying around test 24 of t/ops/sprintf.t. Here is the template for that test from t/ops/sprintf_tests

%P                      ''                              %P INVALID 

I do not know if it is the test itself that is causing the error, or something that is happening before that test is run.

Here is a backtrace:

jrt4@localhost ~/code/kill_parrot_cont-branch $ gdb --args ./parrot t/op/sprintf.t 
GNU gdb 6.8
This GDB was configured as "x86_64-pc-linux-gnu"...
(gdb) break Parrot_callmethodcc_p_sc
Function "Parrot_callmethodcc_p_sc" not defined.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (Parrot_callmethodcc_p_sc) pending.
(gdb) run
Starting program: /home/jrt4/code/kill_parrot_cont-branch/parrot t/op/sprintf.t
[Thread debugging using libthread_db enabled]
warning: Lowest section in /usr/lib64/libicudata.so.42 is .hash at 0000000000000190
[New Thread 0x7f401319a700 (LWP 7007)]
[Switching to Thread 0x7f401319a700 (LWP 7007)]

Breakpoint 1, Parrot_callmethodcc_p_sc (cur_opcode=0x7f4013193350, interp=0x2073080) at src/ops/object.ops:50
50        PMC      * const object     = $1;
(gdb) cont 353
Will ignore next 352 crossings of breakpoint 1.  Continuing.

1..308
ok 1 - [%6. 6s] (See use of $w in code above) (skipped on this platform)
ok 2 - [%6 .6s] 
ok 3 - [%6.6 s] 
ok 4 - [%A] 
ok 5 #skip parrot extension (%B)
ok 6 - [%C] 
ok 7 #skip perl5-specific extension (%D)
ok 8 - [%E] Like %e, but using upper-case "E" (skipped on this platform)
ok 9 #skip perl5-specific extension (%F)
ok 10 - [%G] Like %g, but using upper-case "E" (skipped on this platform)
ok 11 - [%G] 
ok 12 - [%G] 
ok 13 - [%G] 
ok 14 - [%G] exponent too big (skipped on this platform)
ok 15 - [%G] exponent too small (skipped on this platform)
ok 16 #skip parrot extension (%H)
ok 17 - [%I] 
ok 18 - [%J] 
ok 19 - [%K] 
ok 20 #skip parrot extension (%L)
ok 21 - [%M] 
ok 22 - [%N] 
ok 23 #skip perl5-specific extension (%O)

Breakpoint 1, Parrot_callmethodcc_p_sc (cur_opcode=0x21b5038, interp=0x2073080) at src/ops/object.ops:50
50        PMC      * const object     = $1;
(gdb) n 4
56        PMC      * const method_pmc = VTABLE_find_method(interp, object, meth);
(gdb) n

Program received signal SIGSEGV, Segmentation fault.
0x0000000000000000 in ?? ()
(gdb) bt
#0  0x0000000000000000 in ?? ()
#1  0x00007f4012a75159 in Parrot_callmethodcc_p_sc (cur_opcode=0x21b5038, interp=0x2073080) at src/ops/object.ops:56
#2  0x00007f4012b536b8 in runops_slow_core (interp=0x2073080, pc=0x21b5038) at src/runcore/cores.c:462
#3  0x00007f4012b52399 in runops_int (interp=0x2073080, offset=366) at src/runcore/main.c:987
#4  0x00007f4012afac2c in runops (interp=0x2073080, offs=0) at src/call/ops.c:119
#5  0x00007f4012afb013 in runops_args (interp=0x2073080, sub=0x2140820, obj=0x2111f50, meth_unused=0x0, sig=0x7f4012d1f4df "vP", ap=0x7fff36768c00) at src/call/ops.c:269
#6  0x00007f4012afc3cc in Parrot_runops_fromc_args (interp=0x2073080, sub=0x2140820, sig=0x7f4012d1f4df "vP") at src/call/ops.c:338
#7  0x00007f4012ad3c70 in Parrot_runcode (interp=0x2073080, argc=1, argv=0x7fff36768f00) at src/embed.c:983
#8  0x00007f4012cf3dbd in imcc_run_pbc (interp=0x2073080, obj_file=0, output_file=0x0, argc=1, argv=0x7fff36768f00) at compilers/imcc/main.c:801
#9  0x00007f4012cf4a21 in imcc_run (interp=0x2073080, sourcefile=0x7fff3676a2de "t/op/sprintf.t", argc=1, argv=0x7fff36768f00) at compilers/imcc/main.c:1092
#10 0x0000000000400c64 in main (argc=1, argv=0x7fff36768f00) at src/main.c:60

I didn't know where to go from here ... any ideas?

Changed 5 years ago by jrtayloriv

Adding a patch to remove the unused new_continuation() and new_ret_continuation() functions from src/sub.c.

Changed 5 years ago by jrtayloriv

patch to remove unused new_continuation() and new_ret_continuation() functions from src/sub.c

Changed 5 years ago by jrtayloriv

Figured out the problem -- bacek++ for helping me find the error. I'm attaching a new patch (fix_gc_bug.patch) that fixes it.

All tests pass on x86_64 linux now.

Changed 5 years ago by jrtayloriv

fixes gc error in original patch

Changed 5 years ago by whiteknight

  • owner set to whiteknight

Changed 5 years ago by whiteknight

both patches are applied to the branch now in r40916 and r40917 respectively. All tests pass on my system.

Changed 5 years ago by whiteknight

  • status changed from new to closed
  • resolution set to fixed

This should be resolved following the merge of the kill_parrot_cont branch this morning. Followup tickets, bug reports, or additional refactors can get their own tickets.

Note: See TracTickets for help on using tickets.