Ticket #1914 (closed RFC: fixed)

Opened 11 years ago

Last modified 11 years ago

Dead code in src/pmc/Capture.pmc

Reported by: DavidCzech Owned by:
Priority: minor Milestone:
Component: core Version: master
Severity: low Keywords: pmc
Cc: Language:
Patch status: Platform:


The functions in src/pmc/Capture.pmc:


and respective setter functions


cannot be accessed by PIR code, and as such are dead code. A simple test that should call these functions calls get_number_keyed instead.

.sub 'test_set_keyed_str'
    .local pmc capt
    capt = new ['Capture']
    set capt["number test"], 2.23
    set capt["integer test"],1337
    set capt["string test"], "This is a test"
    $N0 = capt["number test"]
    say $N0
    is($N0, 2.23, "get/set_number_keyed_str works")
    $I0 = capt["integer test"]
    is($I0, 1337, "get/set_integer_keyed_str works")
    $S0 = capt["string test"]
    is($S0, "This is a test", "get/set_string_keyed_str works")

Removing these functions results in t/pmc/capture.t still passing, proof that they are not being used.

Change History

Changed 11 years ago by whiteknight

  • severity changed from medium to low
  • component changed from none to core
  • priority changed from normal to minor
  • version changed from 2.10.0 to master
  • keywords pmc added
  • type changed from bug to RFC

I don't know for a fact that all these vtables are dead code, but I suspect it. There's no way to access them from PIR that I can find, and I don't think parrot uses Capture PMC internally for anything. I can imagine HLLs making use of it somehow, like a subclass whose get_x_keyed_pmc vtable redirected to the get_x_keyed_str vtable of the parent type, but that's about it (and doesn't seem too compelling to me anyway).

I would really like to hear if anybody is using these vtables or, more generally, if anybody is using the Capture PMC for any purpose. I suspect Capture is being used, but I would not be surprised to hear that it is not.

Changed 11 years ago by Matt221

Radoku built fine and make test ran without any problems:  http://cl.ly/1x2F1z072u3T3s1s1k2V

Lua on Parrot built fine but there was one test failure, which happened regardless whether the VTABLE functions mentioned in the ticket were commented out or not.

Test Summary Report

t/standalone.t (Tests: 14 Failed: 1)

Failed test: 2

Files=58, Tests=1625, 54.390 wallclock secs Result: FAIL test fails current instr.: 'setup' pc 883 (runtime/parrot/library/distutils.pir:386)

Changed 11 years ago by cotto

This work is in the gci_capture_cleanup branch in parrot/parrot.

Changed 11 years ago by cotto

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

The branch was merged and the dead code is gone. I'm marking this ticket as fixed.

Changed 11 years ago by cotto

  • status changed from closed to reopened
  • resolution fixed deleted

It turns out that the merge needs to be reverted. The x_x_keyed_str calls aren't being generated because of an imcc bug. A proper PIR compiler (e.g. PIRATE) will likely make use of these VTABLE functions.

Changed 11 years ago by cotto

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

I reverted the removal of these functions in 572deb so that the PMC will continue to work when PIRATE generates code to call them.

Note: See TracTickets for help on using tickets.