• Seth Brenith's avatar
    [torque] Get rid of @generatePrint annotation · 267b067b
    Seth Brenith authored
    I'm trying to remove annotations and make behavior more consistent. For
    @generatePrint, there are two options: either generate printers for
    every extern class, or never generate printers for extern classes. This
    change implements the option of always generating printers. Classes that
    require custom printing can easily hide the generated printer by using
    DECL_PRINTER. This causes the generated file
    gen/torque-generated/objects-printer.cc to grow to 1600 lines, including
    many functions that are never used, but I think the consistency benefit
    outweighs a little more compilation time on one file. This change also
    removes custom printers in cases where the generated printer includes
    all of the same content.
    
    If folks would prefer the option to never generate printers, I'm open to
    doing that instead. I like the notion that generating more code could
    reduce the friction of adding new classes and thereby encourage people
    to define precise types rather than using FixedArrays, but the current
    implementation of generated printers is limited, and many printers have
    been customized to show the data that matters the most. Unlike verifiers
    and body descriptors, there are no correctness or safety concerns with
    hand-written printers.
    
    Some bugs showed up once we start generating printers for everything,
    and this change fixes them:
    - Printers incorrectly included ungettable fields like padding
    - Printers called getters which might be hidden by hand-written classes
    - The generated getter for Map::instance_type used
      ReadField<InstanceType>, which is not an arithmetic type since it's an
      enum
    
    One more tiny drive-by fix: added a missing newline in the printers for
    JSMap and JSSet.
    
    Bug: v8:7793
    Change-Id: Ib9e9575fbcb57879935ff18bf4db49fe276d2966
    Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3172190Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
    Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
    Commit-Queue: Seth Brenith <seth.brenith@microsoft.com>
    Cr-Commit-Position: refs/heads/main@{#77152}
    267b067b
api-callbacks.tq 1.92 KB