From 5ea8413714ceec50a758df6614dc4a3ec6179112 Mon Sep 17 00:00:00 2001 From: Jeff Hao Date: Fri, 5 May 2017 16:59:29 -0700 Subject: Stop interpreter from accessing code items of compiled code. The ArtInterpreterToCompiledCodeBridge accesses the code item in a number of places to handle argument marshalling. However, the code item of a compiled method should have no need to be accessed by the runtime at all, since the code has been compiled. By removing these accesses, there is a drop in the memory footprint of the dex file, since these code items remain untouched by the runtime. Includes fixes for JIT and deopt. For Maps: Systrace vdex memory usage: 19.4/33.4MB -> 18.8/33.4MB Dumpsys meminfo vdex PSS: 9371kB -> 9275kB Bug: 35800981 Test: mm test-art-host Change-Id: I3bf17f8866287d9a8f127c16da23bebb801456dc --- runtime/interpreter/interpreter.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'runtime/interpreter/interpreter.cc') diff --git a/runtime/interpreter/interpreter.cc b/runtime/interpreter/interpreter.cc index bf49e84760..d2f5232de1 100644 --- a/runtime/interpreter/interpreter.cc +++ b/runtime/interpreter/interpreter.cc @@ -264,7 +264,11 @@ static inline JValue Execute( // Pop the shadow frame before calling into compiled code. self->PopShadowFrame(); - ArtInterpreterToCompiledCodeBridge(self, nullptr, code_item, &shadow_frame, &result); + // Calculate the offset of the first input reg. The input registers are in the high regs. + // It's ok to access the code item here since JIT code will have been touched by the + // interpreter and compiler already. + uint16_t arg_offset = code_item->registers_size_ - code_item->ins_size_; + ArtInterpreterToCompiledCodeBridge(self, nullptr, &shadow_frame, arg_offset, &result); // Push the shadow frame back as the caller will expect it. self->PushShadowFrame(&shadow_frame); -- cgit v1.2.3-59-g8ed1b