--- old/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java 2018-05-18 03:24:14.239889473 -0400 +++ new/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java 2018-05-18 03:24:12.675798870 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -126,6 +126,7 @@ genCrt = options.isSet(XJCOV); debugCode = options.isSet("debug.code"); allowBetterNullChecks = target.hasObjects(); + disableVirtualizedPrivateInvoke = options.isSet("disableVirtualizedPrivateInvoke"); pool = new Pool(types); // ignore cldc because we cannot have both stackmap formats @@ -140,6 +141,7 @@ private final boolean genCrt; private final boolean debugCode; private final boolean allowBetterNullChecks; + private boolean disableVirtualizedPrivateInvoke; /** Code buffer, set by genMethod. */ @@ -2064,10 +2066,17 @@ } else { items.makeThisItem().load(); sym = binaryQualifier(sym, env.enclClass.type); - result = items.makeMemberItem(sym, (sym.flags() & PRIVATE) != 0); + result = items.makeMemberItem(sym, nonVirtualForPrivateAccess(sym)); } } + //where + private boolean nonVirtualForPrivateAccess(Symbol sym) { + boolean useVirtual = target.hasVirtualPrivateInvoke() && + !disableVirtualizedPrivateInvoke; + return !useVirtual && ((sym.flags() & PRIVATE) != 0); + } + public void visitSelect(JCFieldAccess tree) { Symbol sym = tree.sym; @@ -2124,7 +2133,7 @@ } else { result = items. makeMemberItem(sym, - (sym.flags() & PRIVATE) != 0 || + nonVirtualForPrivateAccess(sym) || selectSuper || accessSuper); } }