Ticket #993 (closed bug: duplicate)

Opened 5 years ago

Last modified 4 years ago

attempt to access code outside of current code segment in vtable init death

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

Description

I wrote this code to test that vtable init happens at the correct time, while trying to translate a test in t/pmc/parrotobject.t :

.sub main
    .include 'test_more.pir'
    throws_like(<<'CODE','init','vtable init happens at the correct time')
    .sub main :main
        $P0 = newclass [ "Test" ]
        $P1 = new [ "Test" ]
        die '42'
    .end

.namespace [ "Test" ]

.sub init :method :vtable
    die 'init'
.end
CODE

.end

causes this:

ok 5 - vtable init happens at the correct time
src/call/context.c:523: failed assertion 'ctx'
Backtrace - Obtained 16 stack frames (max trace depth is 32).
0   libparrot.dylib                     0x00484bed Parrot_do_check_events + 173
1   libparrot.dylib                     0x00484d57 Parrot_confess + 151
2   libparrot.dylib                     0x004a80a9 Parrot_pcc_get_handlers + 89
3   libparrot.dylib                     0x004fffa1 Parrot_cx_find_handler_local + 561
4   libparrot.dylib                     0x004853e0 Parrot_ex_throw_from_c + 128
5   libparrot.dylib                     0x00485c40 Parrot_ex_throw_from_op_args + 0
6   libparrot.dylib                     0x004fcf01 enable_event_checking + 4289
7   libparrot.dylib                     0x004fb4aa Parrot_runcore_switch + 3802
8   libparrot.dylib                     0x004a6135 new_runloop_jump_point + 389
9   libparrot.dylib                     0x004a6477 new_runloop_jump_point + 1223
10  libparrot.dylib                     0x004a718a Parrot_runops_fromc_args + 186
11  libparrot.dylib                     0x00481a61 Parrot_runcode + 337
12  libparrot.dylib                     0x006ad507 imcc_initialize + 471
13  libparrot.dylib                     0x006ae1b9 imcc_run + 873
14  parrot                              0x00002559 start + 297
15  parrot                              0x00002466 start + 54

Attachments

vtable_init.pir Download (305 bytes) - added by dukeleto 5 years ago.
example file that exhibits the bug

Change History

Changed 5 years ago by dukeleto

example file that exhibits the bug

Changed 5 years ago by whiteknight

  • owner set to whiteknight

Okay, this is an easy one to diagnose. It's a duplicate of #883. The problem is that you cannot currently throw an unhandled exception in a vtable override. Vtable overrides are executed in a secondary runloop function that appears further down on the C system stack. See #883 for a more complete description of the problem.

Changed 5 years ago by dukeleto

Whiteknight, that is the wrong TT number, which is the correct one?

Changed 5 years ago by whiteknight

Sorry about the typo. The necessary ticket is #833

Changed 4 years ago by whiteknight

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

I'm closing this ticket as a duplicate of #833

Note: See TracTickets for help on using tickets.