From 8ee96437f8cd24e1eb0b2adc6cef3346ed4b6a98 Mon Sep 17 00:00:00 2001 From: Mathieu Chartier Date: Tue, 25 Nov 2014 18:36:01 -0800 Subject: [PATCH] Add a way to change the IMT size Useful for having smaller imts on memory constrainted devices. Setting ART_IMT_SIZE=x will change the size of the IMT. Bug: 17643507 Change-Id: Ia6bcfcb067c7e21c7f3003cf6254e4b2666ef169 --- build/Android.common_build.mk | 8 ++++++++ runtime/mirror/class.h | 6 +++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/build/Android.common_build.mk b/build/Android.common_build.mk index 07c1f1eae..8f3e1efbb 100644 --- a/build/Android.common_build.mk +++ b/build/Android.common_build.mk @@ -173,6 +173,14 @@ ART_TARGET_CLANG_CFLAGS_arm64 += \ -DNVALGRIND \ -Wno-unused-value + +ifdef ART_IMT_SIZE + art_cflags += -DIMT_SIZE=$(ART_IMT_SIZE) +else + # Default is 64 + art_cflags += -DIMT_SIZE=64 +endif + ifeq ($(ART_SMALL_MODE),true) art_cflags += -DART_SMALL_MODE=1 endif diff --git a/runtime/mirror/class.h b/runtime/mirror/class.h index 5f21c3584..7ef423925 100644 --- a/runtime/mirror/class.h +++ b/runtime/mirror/class.h @@ -62,6 +62,10 @@ #define CLASS_OFFSET_FROM_CLZ(rshift) \ MemberOffset((static_cast(rshift) * CLASS_OFFSET_ALIGNMENT)) +#ifndef IMT_SIZE +#error IMT_SIZE not defined +#endif + namespace art { struct ClassOffsets; @@ -83,7 +87,7 @@ class MANAGED Class FINAL : public Object { // Interface method table size. Increasing this value reduces the chance of two interface methods // colliding in the interface method table but increases the size of classes that implement // (non-marker) interfaces. - static constexpr size_t kImtSize = 64; + static constexpr size_t kImtSize = IMT_SIZE; // imtable entry embedded in class object. struct MANAGED ImTableEntry { -- 2.11.0