< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Print this page
@@ -1,7 +1,7 @@
/*
- * 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
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
@@ -124,10 +124,11 @@
? options.isSet(G)
: options.isSet(G_CUSTOM, "vars");
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
this.stackMap = StackMapFormat.JSR202;
annotate = Annotate.instance(context);
@@ -138,10 +139,11 @@
private final boolean lineDebugInfo;
private final boolean varDebugInfo;
private final boolean genCrt;
private final boolean debugCode;
private final boolean allowBetterNullChecks;
+ private boolean disableVirtualizedPrivateInvoke;
/** Code buffer, set by genMethod.
*/
private Code code;
@@ -2062,14 +2064,21 @@
sym = binaryQualifier(sym, env.enclClass.type);
result = items.makeStaticItem(sym);
} 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;
if (tree.name == names._class) {
code.emitLdc(makeRef(tree.pos(), tree.selected.type));
@@ -2122,11 +2131,11 @@
code.emitop0(arraylength);
result = items.makeStackItem(syms.intType);
} else {
result = items.
makeMemberItem(sym,
- (sym.flags() & PRIVATE) != 0 ||
+ nonVirtualForPrivateAccess(sym) ||
selectSuper || accessSuper);
}
}
}
}
< prev index next >