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

4.10.1.9 invokespecial: rewrittenUninitializedType has wrong result type

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P4 P4
    • 25
    • 8, 24
    • specification
    • vm

      rewrittenUninitializedType(uninitializedThis, Environment,
                                 MethodClass, MethodClass) :-
          MethodClass = class(MethodClassName, CurrentLoader),
          thisClass(Environment, class(thisClassName, thisLoader)),
          superclassChain(thisClassName, thisLoader, [MethodClass | Rest]).

      This says that, for an invokespecial of a superclass <init> method, the type 'unintializedThis' should be replaced with 'MethodClass', the type of the *superclass*. But that's incorrect: the new type should be the type of the *current class*.

      This bug appears to have been introduced by JDK-7160765, which recognized the need to constrain the invocation to the current class or the superclass. But it inadvertently changed the result type at the same time.

      Ever since JDK-8138821, which spun off the 'uninitializedThis' case separately, there hasn't really been a need for a 'rewrittenUninitializedType' predicate that works on all uninitialized types. It may make sense to strip this check down to a simpler 'validInvokespecialTarget' or something like that, and leave it to the 'instructionIsTypeSafe' rule to always map 'uninitializedThis' to 'CurrentClass'.

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: