Shop OBEX P1 Docs P2 Docs Learn Events
Redundant Object Removal — Parallax Forums

Redundant Object Removal

WhaleyWhaley Posts: 6
edited 2010-07-14 12:24 in Propeller 1
In the propellor spin tool, if I go to the RUN/COMPILE TOP/VIEW INFO menu, and then click or hover over my top object, I sometimes see a tool hint pop up that says "Redundant Object Removal Saved xxx Longs"

Does anyone know in what circumstances the spin compiler removes redundant code. I have done a test by inserting a large uncalled function, and it seems to grow the code size as a result, regardless of if it is called or not. So I don't think the compiler is removing uncalled functions.

I'm trying to work out whether my (half written) application will fit when it is completely written, and am trying to avoid any surprises due to code being optimised out etc, so am trying to get some confidence in the figures reported in the free/used stats in this dialog box.

Thanks.

David.
·

Comments

  • heaterheater Posts: 3,370
    edited 2010-07-13 22:21
    I think if you include an object "A" from two other objects "B" and "C" then the code for "A" is only inserted once into the finished binary.

    The BST compiler can also be configured to remove uncalled methods.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    For me, the past is not over yet.
  • Mike GreenMike Green Posts: 23,101
    edited 2010-07-13 22:45
    Anytime you include the same object more than once, there's only one copy of the object's code that's included. That includes two OBJ declarations from the same OBJ. The Propeller Tool compares the binary code used, so, even if the objects have different file names, as long as their code is identical down to the byte level, only one copy is included.
  • WhaleyWhaley Posts: 6
    edited 2010-07-14 12:24
    Great thanks, that does answer my question. My code does have multiple copies of the same OBJ, so this is clearly what is going on.

    Thanks for the replies, it gives me confidence that the used space figures are an accurate measure of whether my app will fit when it is twice as big, if you know what I mean.
Sign In or Register to comment.