Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8279301

c1 getObjectSize intrinsic should guard round mask constant

    XMLWordPrintable

Details

    • arm
    • generic

    Description

      The issue was found during the test of arm32 (see JDK-8279300). getObjectSize intrinsic generates logic_and operation with constant that is not acceptable by arm32 instruction.
      1412 │ #else
      1413 │ __ add(length_int, header_size, length_int);
      1414 │ if (round_mask != 0) {
      1415 │ __ logical_and(length_int, LIR_OprFact::intConst(~round_mask), length_int); // <<------ ~round mask (-8) can't be encoded into and instruction
      1416 │ }
      1417 │ __ convert(Bytecodes::_i2l, length_int, result_reg);
      1418 │ #endif

      Hence for arm32 the constant should be preloaded to a register by separate instruction. Suggest fix is a safer way to generate AND op, it still allows to encode the mask into instruction where it is possible (x86?), and generate load instruction for other platforms.
        __ add(length_int, header_size, length_int);
        if (round_mask != 0) {
          // generate LIR_Const if mask fits instruction requirement
          LIR_Opr round_mask_opr = load_immediate((~round_mask), T_INT);
          __ logical_and(length_int, round_mask_opr, length_int);
        }
        __ convert(Bytecodes::_i2l, length_int, result_reg);

      Attachments

        Issue Links

          Activity

            People

              snazarki Sergey Nazarkin
              snazarki Sergey Nazarkin
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: