[lworld] Type confusion with InlineKlassFixedBlock fields

XMLWordPrintable

      The InlineKlassFixedBlock class has the following fields:
      ```
      class InlineKlassFixedBlock {
        Array<SigEntry>** _extended_sig;
        Array<VMRegPair>** _return_regs;
        address* _pack_handler;
        address* _pack_handler_jobject;
        address* _unpack_handler;
        int* _null_reset_value_offset;
      ```

      with associated functions that all look something like this:
        address adr_extended_sig() const {
          assert(_adr_inlineklass_fixed_block != nullptr, "Should have been initialized");
          return ((address)_adr_inlineklass_fixed_block) + in_bytes(byte_offset_of(InlineKlassFixedBlock, _extended_sig));
        }

      Given the name of the function you would expect that it returned the address of the _extended_sig field, and the implementation seems to support this observation. So, the type above should be `Array<SigEntry>***`. However, callers of this function expects the type to be `Array<SigEntry>**` and casts it as such.

      This all seems to work because we erase the type by casting to `address` and then it doesn't matter what types the InlineKlassFixedBlock fields have, as long as they are pointer fields.

      I propose that we restructure the code to reduce the casting and fix the type confusion.

            Assignee:
            Stefan Karlsson
            Reporter:
            Stefan Karlsson
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: