blob: 5801b367400d2f9a4aa3e6cdfe25d2c1e4519848 [file] [log] [blame]
Nicolas Geoffraya42363f2015-12-17 14:57:09 +00001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#include "art_method.h"
18#include "jit/jit.h"
19#include "jit/jit_code_cache.h"
20#include "oat_quick_method_header.h"
21#include "scoped_thread_state_change.h"
22#include "stack_map.h"
23
24namespace art {
25
26static void do_checks(jclass cls, const char* method_name) {
27 ScopedObjectAccess soa(Thread::Current());
28 mirror::Class* klass = soa.Decode<mirror::Class*>(cls);
29 jit::Jit* jit = Runtime::Current()->GetJit();
30 jit::JitCodeCache* code_cache = jit->GetCodeCache();
31 ArtMethod* method = klass->FindDeclaredDirectMethodByName(method_name, sizeof(void*));
32 OatQuickMethodHeader* header = OatQuickMethodHeader::FromEntryPoint(
33 method->GetEntryPointFromQuickCompiledCode());
34 CHECK(code_cache->ContainsPc(header->GetCode()));
35
36 CodeInfo info = header->GetOptimizedCodeInfo();
37 CHECK(info.HasInlineInfo());
38}
39
40extern "C" JNIEXPORT void JNICALL Java_Main_ensureJittedAndPolymorphicInline(JNIEnv*, jclass cls) {
41 jit::Jit* jit = Runtime::Current()->GetJit();
42 if (jit == nullptr) {
43 return;
44 }
45
46 do_checks(cls, "testInvokeVirtual");
47 do_checks(cls, "testInvokeInterface");
48}
49
50} // namespace art