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

[Verifier:New] Correct Prolog code for invokespecial

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8
    • 7
    • specification
    • None
    • vm
    • Verified

    Description

      JSR 202 gave the following rule:

      instructionIsTypeSafe(invokespecial(CP), Environment, _Offset, StackFrame, NextStackFrame, ExceptionStackFrame) :-
        ...
        thisClass(Environment, CurrentClass),
        reverse([CurrentClass | OperandArgList], StackArgList),
        ...
        currentClassLoader(Environment, L),
        reverse([class(MethodClassName, L) | OperandArgList], StackArgList2),
        ...
        isAssignable(class(CurrentClassName, L), class(MethodClassName, L)).

      The last line is erroneous because CurrentClassName is undefined. We can't say class(CurrentClass, L) because CurrentClass is not a string but rather a class(...) term obtained from thisClass. But observe that currentClassLoader(Environment, L) is just a wrapper for thisClass, so we can just modify the call to thisClass and then simplify and correct the remainder:

      instructionIsTypeSafe(invokespecial(CP), Environment, _Offset, StackFrame, NextStackFrame, ExceptionStackFrame) :-
        ...
        thisClass(Environment, class(CurrentClassName, L)),
        reverse([class(CurrentClassName, L) | OperandArgList], StackArgList),
        ...
        // No more currentClassLoader call. L is in scope thanks to thisClass.
        reverse([class(MethodClassName, L) | OperandArgList], StackArgList2),
        ...
        isAssignable(class(CurrentClassName, L), class(MethodClassName, L)).

      Attachments

        Activity

          People

            abuckley Alex Buckley
            abuckley Alex Buckley
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: