ArchVariant.c revision fd7e221cce6d3c63fd26599d58e0a35db7f5d1fa
1/* 2 * Copyright (C) 2009 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/* 18 * Determine the initial instruction set to be used for this trace. 19 * Later components may decide to change this. 20 */ 21JitInstructionSetType dvmCompilerInstructionSet(void) 22{ 23 return DALVIK_JIT_THUMB2; 24} 25 26/* Architecture-specific initializations and checks go here */ 27bool dvmCompilerArchVariantInit(void) 28{ 29 /* First, declare dvmCompiler_TEMPLATE_XXX for each template */ 30#define JIT_TEMPLATE(X) extern void dvmCompiler_TEMPLATE_##X(); 31#include "../../../template/armv5te-vfp/TemplateOpList.h" 32#undef JIT_TEMPLATE 33 34 int i = 0; 35 extern void dvmCompilerTemplateStart(void); 36 37 /* 38 * Then, populate the templateEntryOffsets array with the offsets from the 39 * the dvmCompilerTemplateStart symbol for each template. 40 */ 41#define JIT_TEMPLATE(X) templateEntryOffsets[i++] = \ 42 (intptr_t) dvmCompiler_TEMPLATE_##X - (intptr_t) dvmCompilerTemplateStart; 43#include "../../../template/armv5te-vfp/TemplateOpList.h" 44#undef JIT_TEMPLATE 45 46 /* Target-specific configuration */ 47 gDvmJit.jitTableSize = 1 << 12; // 4096 48 gDvmJit.jitTableMask = gDvmJit.jitTableSize - 1; 49 gDvmJit.threshold = 40; 50 gDvmJit.codeCacheSize = 1024*1024; 51 52#if defined(WITH_SELF_VERIFICATION) 53 /* Force into blocking */ 54 gDvmJit.blockingMode = true; 55#endif 56 57 /* Codegen-specific assumptions */ 58 assert(offsetof(ClassObject, vtable) < 128 && 59 (offsetof(ClassObject, vtable) & 0x3) == 0); 60 assert(offsetof(ArrayObject, length) < 128 && 61 (offsetof(ArrayObject, length) & 0x3) == 0); 62 assert(offsetof(ArrayObject, contents) < 256); 63 64 /* Up to 5 args are pushed on top of FP - sizeofStackSaveArea */ 65 assert(sizeof(StackSaveArea) < 236); 66 67 /* 68 * EA is calculated by doing "Rn + imm5 << 2", and there are 5 entry points 69 * that codegen may access, make sure that the offset from the top of the 70 * struct is less than 108. 71 */ 72 assert(offsetof(InterpState, jitToInterpEntries) < 108); 73 return true; 74} 75 76int dvmCompilerTargetOptHint(int key) 77{ 78 int res; 79 switch (key) { 80 case kMaxHoistDistance: 81 res = 7; 82 break; 83 default: 84 LOGE("Unknown target optimization hint key: %d",key); 85 res = 0; 86 } 87 return res; 88} 89