< prev index next >
src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/Gen.java
Print this page
rev 50604 : imported patch jep181-rev1
*** 1,7 ****
/*
! * Copyright (c) 1999, 2017, 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
--- 1,7 ----
/*
! * 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,133 ****
--- 124,134 ----
? 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,147 ****
--- 139,149 ----
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,2075 ****
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);
}
}
public void visitSelect(JCFieldAccess tree) {
Symbol sym = tree.sym;
if (tree.name == names._class) {
code.emitLdc(makeRef(tree.pos(), tree.selected.type));
--- 2064,2084 ----
sym = binaryQualifier(sym, env.enclClass.type);
result = items.makeStaticItem(sym);
} else {
items.makeThisItem().load();
sym = binaryQualifier(sym, env.enclClass.type);
! 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,2132 ****
code.emitop0(arraylength);
result = items.makeStackItem(syms.intType);
} else {
result = items.
makeMemberItem(sym,
! (sym.flags() & PRIVATE) != 0 ||
selectSuper || accessSuper);
}
}
}
}
--- 2131,2141 ----
code.emitop0(arraylength);
result = items.makeStackItem(syms.intType);
} else {
result = items.
makeMemberItem(sym,
! nonVirtualForPrivateAccess(sym) ||
selectSuper || accessSuper);
}
}
}
}
< prev index next >