# New Ticket Created by  chromatic 
# Please include the string:  [perl #50684]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=50684 >


I recompiled Parrot with the -march and -O2 flags, to see what kind of speed 
boosts we get from optimization (modest improvements in IMCC, about 20% 
overall).  Unfortunately, several tests failed with segfaults, due to a 
problem somewhere in string handling:

t/op/globals.t
  Failed test number(s):  2, 7
t/op/string.t
  Failed test number(s):  71, 73
t/op/string_cs.t
  Failed test number(s):  32
t/pmc/coroutine.t
  Failed test number(s):  3-6
t/pmc/threads.t
  Failed test number(s):  2-3, 5, 10, 12, 15-16

Here are some sample backtraces.

(gdb) run -G t/op/string_73.pasm 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212299056 (LWP 10213)]
0xb7ce5376 in string_length (interp_unused=0x804f008, s=0x0)
    at src/string.c:746
746     {
(gdb) bt
#0  0xb7ce5376 in string_length (interp_unused=0x804f008, s=0x0)
    at src/string.c:746
#1  0xb7ce55e6 in string_ord (interp=0x804f008, s=0x0, idx=0)
    at src/string.c:832
#2  0xb7cfa7bf in Parrot_ord_i_s_ic (cur_opcode=0x8256918, interp=0x804f008)
    at src/ops/string.ops:47
#3  0xb7d67259 in runops_slow_core (interp=0x804f008, pc=0x8256918)
    at src/runops_cores.c:213
#4  0xb7d3f323 in runops_int (interp=0x804f008, offset=0)
    at src/interpreter.c:878
#5  0xb7d3fc95 in runops (interp=0x804f008, offs=0) at src/inter_run.c:104
#6  0xb7d3fecf in runops_args (interp=0x804f008, sub=0x81e5a60, 
    obj=<value optimized out>, meth_unused=0x0, sig=0xb7eeb2af "vP", 
    ap=0xbfb6693c "HZ\036\b") at src/inter_run.c:230
#7  0xb7d40481 in Parrot_runops_fromc_args (interp=0x804f008, sub=0x81e5a60, 
    sig=0xb7eeb2af "vP") at src/inter_run.c:299
#8  0xb7d2cf4c in Parrot_runcode (interp=0x804f008, argc=1, argv=0xbfb66a9c)
    at src/embed.c:912
#9  0xb7ece85d in imcc_run (interp=0x804f008, 
    sourcefile=0xbfb6789f "t/op/string_73.pasm", argc=1, argv=0xbfb66a9c)
    at compilers/imcc/main.c:794
#10 0x0804889d in main (argc=1, argv=0xbfb66a9c) at src/main.c:56

(gdb) run -G t/op/globals_7.pasm 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212774192 (LWP 10219)]
key_hash_STRING (interp=0x804f008, s=0x0, seed=3793) at src/hash.c:134
134         if (s->hashval) {
(gdb) bt
#0  key_hash_STRING (interp=0x804f008, s=0x0, seed=3793) at src/hash.c:134
#1  0xb7cc46a4 in parrot_hash_get_bucket (interp=0x804f008, hash=0x8095850, 
    key=0x0) at src/hash.c:976
#2  0xb7cc470b in parrot_hash_get (interp=0x804f008, hash=0x8095850, key=0x0)
    at src/hash.c:1006
#3  0xb7e0fe5e in Parrot_NameSpace_get_pointer_keyed_str (interp=0x804f008, 
    pmc=0x808fb90, key=0x0) at ./src/pmc/namespace.pmc:449
#4  0xb7cc3907 in Parrot_find_global_n (interp=0x804f008, ns=0x808fb90, 
    globalname=0x0) at src/global.c:380
#5  0xb7cc3aeb in Parrot_find_global_op (interp=0x804f008, ns=0x808fb90, 
    globalname=0x0, next=0x825692c) at src/global.c:604
#6  0xb7c8050a in Parrot_find_global_p_s (cur_opcode=0x8256920, 
    interp=0x804f008) at src/ops/var.ops:449
#7  0xb7cf3259 in runops_slow_core (interp=0x804f008, pc=0x8256920)
    at src/runops_cores.c:213
#8  0xb7ccb323 in runops_int (interp=0x804f008, offset=0)
    at src/interpreter.c:878
#9  0xb7ccbc95 in runops (interp=0x804f008, offs=0) at src/inter_run.c:104
#10 0xb7ccbecf in runops_args (interp=0x804f008, sub=0x81e5a60, 
    obj=<value optimized out>, meth_unused=0x0, sig=0xb7e772af "vP", 
    ap=0xbffc3d8c "HZ\036\b") at src/inter_run.c:230
#11 0xb7ccc481 in Parrot_runops_fromc_args (interp=0x804f008, sub=0x81e5a60, 
    sig=0xb7e772af "vP") at src/inter_run.c:299
#12 0xb7cb8f4c in Parrot_runcode (interp=0x804f008, argc=1, argv=0xbffc3eec)
    at src/embed.c:912
#13 0xb7e5a85d in imcc_run (interp=0x804f008, 
    sourcefile=0xbffc489f "t/op/globals_7.pasm", argc=1, argv=0xbffc3eec)
    at compilers/imcc/main.c:794
#14 0x0804889d in main (argc=1, argv=0xbffc3eec) at src/main.c:56

(gdb) run -G t/op/string_cs_32.pasm 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211823920 (LWP 10221)]
0xb7e68a57 in Parrot_reallocate_string (interp=0x804f008, str=0x0, tosize=6)
    at src/gc/resources.c:751
751                 : interp->arena_base->memory_pool;
(gdb) bt
#0  0xb7e68a57 in Parrot_reallocate_string (interp=0x804f008, str=0x0, 
    tosize=6) at src/gc/resources.c:751
#1  0xb7e6a3ab in to_charset (interp=0x804f008, src=0x8234768, dest=0x0)
    at src/charset/iso-8859-1.c:168
#2  0xb7d59942 in Parrot_string_trans_charset (interp=0x804f008, 
    src=0x8234768, charset_nr=1, dest=0x0) at src/string.c:2796
#3  0xb7d6c6b6 in Parrot_trans_charset_s_i (cur_opcode=0x825699c, 
    interp=0x804f008) at src/ops/string.ops:555
#4  0xb7ddb259 in runops_slow_core (interp=0x804f008, pc=0x825699c)
    at src/runops_cores.c:213
#5  0xb7db3323 in runops_int (interp=0x804f008, offset=0)
    at src/interpreter.c:878
#6  0xb7db3c95 in runops (interp=0x804f008, offs=0) at src/inter_run.c:104
#7  0xb7db3ecf in runops_args (interp=0x804f008, sub=0x81e5a60, 
    obj=<value optimized out>, meth_unused=0x0, sig=0xb7f5f2af "vP", 
    ap=0xbfe82c4c "HZ\036\b") at src/inter_run.c:230
#8  0xb7db4481 in Parrot_runops_fromc_args (interp=0x804f008, sub=0x81e5a60, 
    sig=0xb7f5f2af "vP") at src/inter_run.c:299
#9  0xb7da0f4c in Parrot_runcode (interp=0x804f008, argc=1, argv=0xbfe82dac)
    at src/embed.c:912
#10 0xb7f4285d in imcc_run (interp=0x804f008, 
    sourcefile=0xbfe8389c "t/op/string_cs_32.pasm", argc=1, argv=0xbfe82dac)
    at compilers/imcc/main.c:794
#11 0x0804889d in main (argc=1, argv=0xbfe82dac) at src/main.c:56

(gdb) run -G t/pmc/coroutine_3.pasm 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212659504 (LWP 10222)]
key_hash_STRING (interp=0x804f008, s=0x0, seed=3793) at src/hash.c:134
134         if (s->hashval) {
(gdb) bt
#0  key_hash_STRING (interp=0x804f008, s=0x0, seed=3793) at src/hash.c:134
#1  0xb7ce06a4 in parrot_hash_get_bucket (interp=0x804f008, hash=0x8095850, 
    key=0x0) at src/hash.c:976
#2  0xb7ce070b in parrot_hash_get (interp=0x804f008, hash=0x8095850, key=0x0)
    at src/hash.c:1006
#3  0xb7e2be5e in Parrot_NameSpace_get_pointer_keyed_str (interp=0x804f008, 
    pmc=0x808fb90, key=0x0) at ./src/pmc/namespace.pmc:449
#4  0xb7cdf907 in Parrot_find_global_n (interp=0x804f008, ns=0x808fb90, 
    globalname=0x0) at src/global.c:380
#5  0xb7cdfaeb in Parrot_find_global_op (interp=0x804f008, ns=0x808fb90, 
    globalname=0x0, next=0x825696c) at src/global.c:604
#6  0xb7c9d23a in Parrot_get_global_p_s (cur_opcode=0x8256960, 
    interp=0x804f008) at src/ops/var.ops:201
#7  0xb7d0f259 in runops_slow_core (interp=0x804f008, pc=0x8256960)
    at src/runops_cores.c:213
#8  0xb7ce7323 in runops_int (interp=0x804f008, offset=0)
    at src/interpreter.c:878
#9  0xb7ce7c95 in runops (interp=0x804f008, offs=0) at src/inter_run.c:104
#10 0xb7ce7ecf in runops_args (interp=0x804f008, sub=0x81e5a60, 
    obj=<value optimized out>, meth_unused=0x0, sig=0xb7e932af "vP", 
    ap=0xbfc66a2c "0Z\036\b") at src/inter_run.c:230
#11 0xb7ce8481 in Parrot_runops_fromc_args (interp=0x804f008, sub=0x81e5a60, 
    sig=0xb7e932af "vP") at src/inter_run.c:299
#12 0xb7cd4f4c in Parrot_runcode (interp=0x804f008, argc=1, argv=0xbfc66b8c)
    at src/embed.c:912
#13 0xb7e7685d in imcc_run (interp=0x804f008, 
    sourcefile=0xbfc6789c "t/pmc/coroutine_3.pasm", argc=1, argv=0xbfc66b8c)
    at compilers/imcc/main.c:794
#14 0x0804889d in main (argc=1, argv=0xbfc66b8c) at src/main.c:56

(gdb) run -G t/pmc/threads_3.pir 

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1212032816 (LWP 10224)]
0xb7dafa09 in pt_thread_run (interp=0x804f008, dest_interp=0x826f888, 
    sub=0x81e5a30, arg=0x0) at src/thread.c:232
232         old_size = VTABLE_get_integer(old_interp, args);
(gdb) bt
#0  0xb7dafa09 in pt_thread_run (interp=0x804f008, dest_interp=0x826f888, 
    sub=0x81e5a30, arg=0x0) at src/thread.c:232
#1  0xb7e5b26e in do_thread_run (interp=0x804f008, thread=0x826f888, 
    clone_flags=127, sub=0x81e5a30, args=0x0) at ./src/pmc/parrotthread.pmc:69
#2  0xb7e5b31e in do_thread_run_clone_default (interp=0x804f008, 
    thread=0x826f888, sub=0x81e5a30, args=0x0) 
at ./src/pmc/parrotthread.pmc:82
#3  0xb7d953e2 in pcf_I_JOPxAT_ (interp=0x804f008, self=0x808d628)
    at src/nci.c:5586
#4  0xb7e6d5cb in Parrot_NCI_invoke (interp=0x804f008, pmc=0x84450a8, 
    next=0x8267f24) at ./src/pmc/nci.pmc:206
#5  0xb7d3392a in Parrot_callmethodcc_p_sc (cur_opcode=0x8267f18, 
    interp=0x804f008) at src/ops/object.ops:74
#6  0xb7da8259 in runops_slow_core (interp=0x804f008, pc=0x8267f18)
    at src/runops_cores.c:213
#7  0xb7d80323 in runops_int (interp=0x804f008, offset=0)
    at src/interpreter.c:878
#8  0xb7d80c95 in runops (interp=0x804f008, offs=0) at src/inter_run.c:104
#9  0xb7d80ecf in runops_args (interp=0x804f008, sub=0x81e5a60, 
    obj=<value optimized out>, meth_unused=0x0, sig=0xb7f2c2af "vP", 
    ap=0xbfb4d11c "\030Z\036\b") at src/inter_run.c:230
#10 0xb7d81481 in Parrot_runops_fromc_args (interp=0x804f008, sub=0x81e5a60, 
    sig=0xb7f2c2af "vP") at src/inter_run.c:299
#11 0xb7d6df4c in Parrot_runcode (interp=0x804f008, argc=1, argv=0xbfb4d27c)
    at src/embed.c:912
#12 0xb7f0f85d in imcc_run (interp=0x804f008, 
    sourcefile=0xbfb4e89f "t/pmc/threads_3.pir", argc=1, argv=0xbfb4d27c)
    at compilers/imcc/main.c:794
#13 0x0804889d in main (argc=1, argv=0xbfb4d27c) at src/main.c:56

Anyone who wants to look into these is plenty welcome.  I'll get to them 
*eventually*, but here's a fun spot for someone with C and GDB fu.

-- c

Reply via email to