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 gDvm.nativeDebuggerActive = true; 56#endif 57 58 /* Codegen-specific assumptions */ 59 assert(offsetof(ClassObject, vtable) < 128 && 60 (offsetof(ClassObject, vtable) & 0x3) == 0); 61 assert(offsetof(ArrayObject, length) < 128 && 62 (offsetof(ArrayObject, length) & 0x3) == 0); 63 assert(offsetof(ArrayObject, contents) < 256); 64 65 /* Up to 5 args are pushed on top of FP - sizeofStackSaveArea */ 66 assert(sizeof(StackSaveArea) < 236); 67 68 /* 69 * EA is calculated by doing "Rn + imm5 << 2", make sure that the last 70 * offset from the struct is less than 128. 71 */ 72 assert((offsetof(InterpState, jitToInterpEntries) + 73 sizeof(struct JitToInterpEntries)) <= 128); 74 return true; 75} 76 77int dvmCompilerTargetOptHint(int key) 78{ 79 int res; 80 switch (key) { 81 case kMaxHoistDistance: 82 res = 7; 83 break; 84 default: 85 LOGE("Unknown target optimization hint key: %d",key); 86 res = 0; 87 } 88 return res; 89} 90 91void dvmCompilerGenMemBarrier(CompilationUnit *cUnit) 92{ 93#if ANDROID_SMP != 0 94 ArmLIR *dmb = newLIR1(cUnit, kThumb2Dmb, kSY); // Full system DMB 95 dmb->defMask = ENCODE_ALL; 96#endif 97} 98