class_linker: Change allocation of MethodType dex_cache entries.
We allocate them regardless of the value of the runtime flag to
avoid needing changes to the compiler etc. The memory hit can be
mitigated in production systems that don't use MethodHandles by
setting kDexCacheMethodTypeCacheSize to 0.
Also, add DCHECKS in the interpreter to make sure the runtime
never executes an invoke-polymorphic instruction when method handles
are disabled.
Test: make test-art-host
Bug: 30550796
Change-Id: Id4b2065d99dc13625a51037b7d1a9f0ac5ff6121
diff --git a/runtime/interpreter/interpreter_switch_impl.cc b/runtime/interpreter/interpreter_switch_impl.cc
index 43bc9bd..243ed57 100644
--- a/runtime/interpreter/interpreter_switch_impl.cc
+++ b/runtime/interpreter/interpreter_switch_impl.cc
@@ -1558,6 +1558,7 @@
}
case Instruction::INVOKE_POLYMORPHIC: {
PREAMBLE();
+ DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
bool success = DoInvokePolymorphic<false, do_access_check>(
self, shadow_frame, inst, inst_data, &result_register);
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);
@@ -1565,6 +1566,7 @@
}
case Instruction::INVOKE_POLYMORPHIC_RANGE: {
PREAMBLE();
+ DCHECK(Runtime::Current()->IsMethodHandlesEnabled());
bool success = DoInvokePolymorphic<true, do_access_check>(
self, shadow_frame, inst, inst_data, &result_register);
POSSIBLY_HANDLE_PENDING_EXCEPTION(!success, Next_4xx);