Update HInstruction::NeedsCurrentMethod.
HLoadString and HLoadClass when sharpened may not need it
anymore. Instead just rely on the HCurrentMethod being the
SSA dependency of those instructions.
Also save storing the current method in the stack if the
graph actually doesn't need it.
test: m test-art-host test-art-target
Change-Id: I235d8275230637cbbd38fc0d2f9b822f6d2a9c1e
diff --git a/compiler/optimizing/nodes.h b/compiler/optimizing/nodes.h
index 348f99d..426c4f1 100644
--- a/compiler/optimizing/nodes.h
+++ b/compiler/optimizing/nodes.h
@@ -2093,10 +2093,10 @@
// to the current method. Such instructions are:
// (1): Instructions that require an environment, as calling the runtime requires
// to walk the stack and have the current method stored at a specific stack address.
- // (2): Object literals like classes and strings, that are loaded from the dex cache
- // fields of the current method.
+ // (2): HCurrentMethod, potentially used by HInvokeStaticOrDirect, HLoadString, or HLoadClass
+ // to access the dex cache.
bool NeedsCurrentMethod() const {
- return NeedsEnvironment() || IsLoadClass() || IsLoadString();
+ return NeedsEnvironment() || IsCurrentMethod();
}
// Returns whether the code generation of the instruction will require to have access