[lworld] Foreign API in VM should not use objArrayOop->obj_at(int)

XMLWordPrintable

      With the introduction of flat arrays, it is strongly recommended to not use the method objArrayOop->obj_at(int) anymore. When this method is called with a flat array, the JVM has to buffer the element before returning it, which means performing an allocation in the Java heap, which can trigger an OOM. The method has no way to handle this OOM situation and would simply crash the whole JVM.

      The recommended fixes are:
        - use objArrayOop->obj_at(int, TRAPS) instead and add handling of a potential OOM error
        - or ensure and enforce that the code is operating on non-flat arrays, by using refArrayKlass/refArrayOop types and calling refArrayOop->obj_at(int)

      The support for the Foreign API in the JVM is using the problematic objArrayOop->obj_at(int) method in the following methods:

      ABIDescriptor ForeignGlobals::parse_abi_descriptor(jobject jabi);
      const CallRegs ForeignGlobals::parse_call_regs(jobject jconv);

            Assignee:
            Chen Liang
            Reporter:
            Frederic Parain
            Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: