@@ -1709,7 +1709,7 @@ public void visitINVOKEINTERFACE(final INVOKEINTERFACE o) {
17091709 }
17101710 }
17111711
1712- private Type visitInvokeInternals (final InvokeInstruction o ) throws ClassNotFoundException {
1712+ private int visitInvokeInternals (final InvokeInstruction o ) throws ClassNotFoundException {
17131713 final Type t = o .getType (cpg );
17141714 if (t instanceof ObjectType ) {
17151715 final String name = ((ObjectType ) t ).getClassName ();
@@ -1745,8 +1745,7 @@ private Type visitInvokeInternals(final InvokeInstruction o) throws ClassNotFoun
17451745 }
17461746 }
17471747 }
1748-
1749- return stack ().peek (nargs );
1748+ return nargs ;
17501749 }
17511750
17521751 /**
@@ -1766,7 +1765,8 @@ public void visitINVOKESPECIAL(final INVOKESPECIAL o) {
17661765
17671766 // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).
17681767
1769- Type objref = visitInvokeInternals (o );
1768+ final int nargs = visitInvokeInternals (o );
1769+ Type objref = stack ().peek (nargs );
17701770 if (objref == Type .NULL ) {
17711771 return ;
17721772 }
@@ -1811,42 +1811,7 @@ public void visitINVOKESPECIAL(final INVOKESPECIAL o) {
18111811 public void visitINVOKESTATIC (final INVOKESTATIC o ) {
18121812 try {
18131813 // Method is not native, otherwise pass 3 would not happen.
1814-
1815- final Type t = o .getType (cpg );
1816- if (t instanceof ObjectType ) {
1817- final String name = ((ObjectType ) t ).getClassName ();
1818- final Verifier v = VerifierFactory .getVerifier (name );
1819- final VerificationResult vr = v .doPass2 ();
1820- if (vr .getStatus () != VerificationResult .VERIFIED_OK ) {
1821- constraintViolated (o , "Class '" + name + "' is referenced, but cannot be loaded and resolved: '" + vr + "'." );
1822- }
1823- }
1824-
1825- final Type [] argtypes = o .getArgumentTypes (cpg );
1826- final int nargs = argtypes .length ;
1827-
1828- for (int i = nargs - 1 ; i >= 0 ; i --) {
1829- final Type fromStack = stack ().peek (nargs - 1 - i ); // 0 to nargs-1
1830- Type fromDesc = argtypes [i ];
1831- if (fromDesc == Type .BOOLEAN || fromDesc == Type .BYTE || fromDesc == Type .CHAR || fromDesc == Type .SHORT ) {
1832- fromDesc = Type .INT ;
1833- }
1834- if (!fromStack .equals (fromDesc )) {
1835- if (fromStack instanceof ReferenceType && fromDesc instanceof ReferenceType ) {
1836- final ReferenceType rFromStack = (ReferenceType ) fromStack ;
1837- final ReferenceType rFromDesc = (ReferenceType ) fromDesc ;
1838- // TODO: This check can possibly only be done using Staerk-et-al's "set of object types"
1839- // instead of a "wider cast object type" created during verification.
1840- if (!rFromStack .isAssignmentCompatibleWith (rFromDesc )) {
1841- constraintViolated (o ,
1842- "Expecting a '" + fromDesc + "' but found a '" + fromStack + "' on the stack (which is not assignment compatible)." );
1843- }
1844- referenceTypeIsInitialized (o , rFromStack );
1845- } else {
1846- constraintViolated (o , "Expecting a '" + fromDesc + "' but found a '" + fromStack + "' on the stack." );
1847- }
1848- }
1849- }
1814+ visitInvokeInternals (o );
18501815 } catch (final ClassNotFoundException e ) {
18511816 // FIXME: maybe not the best way to handle this
18521817 throw new AssertionViolatedException ("Missing class: " + e , e );
@@ -1861,7 +1826,8 @@ public void visitINVOKEVIRTUAL(final INVOKEVIRTUAL o) {
18611826 try {
18621827 // the o.getClassType(cpg) type has passed pass 2; see visitLoadClass(o).
18631828
1864- Type objref = visitInvokeInternals (o );
1829+ final int nargs = visitInvokeInternals (o );
1830+ Type objref = stack ().peek (nargs );
18651831 if (objref == Type .NULL ) {
18661832 return ;
18671833 }
0 commit comments