2 * Copyright (C) 2009 The Android Open Source Project
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 extern "C" void dvmCompilerTemplateStart(void);
20 * This file is included by Codegen-armv5te-vfp.c, and implements architecture
21 * variant-specific code.
25 * Determine the initial instruction set to be used for this trace.
26 * Later components may decide to change this.
28 JitInstructionSetType dvmCompilerInstructionSet(void)
30 return DALVIK_JIT_THUMB;
33 /* First, declare dvmCompiler_TEMPLATE_XXX for each template */
34 #define JIT_TEMPLATE(X) extern "C" void dvmCompiler_TEMPLATE_##X();
35 #include "../../../template/armv5te-vfp/TemplateOpList.h"
38 /* Architecture-specific initializations and checks go here */
39 bool dvmCompilerArchVariantInit(void)
44 * Then, populate the templateEntryOffsets array with the offsets from the
45 * the dvmCompilerTemplateStart symbol for each template.
47 #define JIT_TEMPLATE(X) templateEntryOffsets[i++] = \
48 (intptr_t) dvmCompiler_TEMPLATE_##X - (intptr_t) dvmCompilerTemplateStart;
49 #include "../../../template/armv5te-vfp/TemplateOpList.h"
52 /* Target-specific configuration */
53 gDvmJit.jitTableSize = 1 << 9; // 512
54 gDvmJit.jitTableMask = gDvmJit.jitTableSize - 1;
55 if (gDvmJit.threshold == 0) {
56 gDvmJit.threshold = 200;
58 if (gDvmJit.codeCacheSize == DEFAULT_CODE_CACHE_SIZE) {
59 gDvmJit.codeCacheSize = 512 * 1024;
60 } else if ((gDvmJit.codeCacheSize == 0) && (gDvm.executionMode == kExecutionModeJit)) {
61 gDvm.executionMode = kExecutionModeInterpFast;
63 /* Hard limit for Arm of 2M */
64 assert(gDvmJit.codeCacheSize <= 2 * 1024 * 1024);
66 #if defined(WITH_SELF_VERIFICATION)
67 /* Force into blocking mode */
68 gDvmJit.blockingMode = true;
69 gDvm.nativeDebuggerActive = true;
72 /* Codegen-specific assumptions */
73 assert(OFFSETOF_MEMBER(ClassObject, vtable) < 128 &&
74 (OFFSETOF_MEMBER(ClassObject, vtable) & 0x3) == 0);
75 assert(OFFSETOF_MEMBER(ArrayObject, length) < 128 &&
76 (OFFSETOF_MEMBER(ArrayObject, length) & 0x3) == 0);
77 assert(OFFSETOF_MEMBER(ArrayObject, contents) < 256);
79 /* Up to 5 args are pushed on top of FP - sizeofStackSaveArea */
80 assert(sizeof(StackSaveArea) < 236);
83 * EA is calculated by doing "Rn + imm5 << 2". Make sure that the last
84 * offset from the struct is less than 128.
86 if ((offsetof(Thread, jitToInterpEntries) +
87 sizeof(struct JitToInterpEntries)) >= 128) {
88 ALOGE("Thread.jitToInterpEntries size overflow");
92 /* No method JIT for Thumb backend */
93 gDvmJit.disableOpt |= (1 << kMethodJit);
95 // Make sure all threads have current values
96 dvmJitUpdateThreadStateAll();
101 int dvmCompilerTargetOptHint(int key)
105 case kMaxHoistDistance:
109 ALOGE("Unknown target optimization hint key: %d",key);
115 void dvmCompilerGenMemBarrier(CompilationUnit *cUnit, int barrierKind)
118 #error armv5+smp not supported