diff options
author | buzbee <buzbee@google.com> | 2010-09-17 16:01:49 -0700 |
---|---|---|
committer | buzbee <buzbee@google.com> | 2010-09-20 09:58:59 -0700 |
commit | 7520ee7ff226e12e06818561b15741d2575072e3 (patch) | |
tree | 0d6710d2def21ab8a12b9895ab762a476f0998c2 /vm/compiler/codegen/x86/ia32 | |
parent | 4a3698d64f14e8694ad11d1b6c2c133bca911826 (diff) | |
download | android_dalvik-7520ee7ff226e12e06818561b15741d2575072e3.tar.gz android_dalvik-7520ee7ff226e12e06818561b15741d2575072e3.tar.bz2 android_dalvik-7520ee7ff226e12e06818561b15741d2575072e3.zip |
Add source code skeletons for x86 work. No actual JIT'ng yet.
Change-Id: Ic94a916e777e9bc5163cf205899daf9c18dcafe1
Diffstat (limited to 'vm/compiler/codegen/x86/ia32')
-rw-r--r-- | vm/compiler/codegen/x86/ia32/ArchVariant.c | 98 | ||||
-rw-r--r-- | vm/compiler/codegen/x86/ia32/ArchVariant.h | 34 | ||||
-rw-r--r-- | vm/compiler/codegen/x86/ia32/CallingConvention.S | 32 | ||||
-rw-r--r-- | vm/compiler/codegen/x86/ia32/Codegen.c | 46 |
4 files changed, 210 insertions, 0 deletions
diff --git a/vm/compiler/codegen/x86/ia32/ArchVariant.c b/vm/compiler/codegen/x86/ia32/ArchVariant.c new file mode 100644 index 000000000..2c0dfcba6 --- /dev/null +++ b/vm/compiler/codegen/x86/ia32/ArchVariant.c @@ -0,0 +1,98 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * This file is included by Codegen-x86.c, and implements architecture + * variant-specific code. + */ + +/* + * Determine the initial instruction set to be used for this trace. + * Later components may decide to change this. + */ +JitInstructionSetType dvmCompilerInstructionSet(void) +{ + return DALVIK_JIT_IA32; +} + +/* Architecture-specific initializations and checks go here */ +bool dvmCompilerArchVariantInit(void) +{ + /* First, declare dvmCompiler_TEMPLATE_XXX for each template */ +#define JIT_TEMPLATE(X) extern void dvmCompiler_TEMPLATE_##X(); +#include "../../../template/ia32/TemplateOpList.h" +#undef JIT_TEMPLATE + + int i = 0; + extern void dvmCompilerTemplateStart(void); + + /* + * Then, populate the templateEntryOffsets array with the offsets from the + * the dvmCompilerTemplateStart symbol for each template. + */ +#define JIT_TEMPLATE(X) templateEntryOffsets[i++] = \ + (intptr_t) dvmCompiler_TEMPLATE_##X - (intptr_t) dvmCompilerTemplateStart; +#include "../../../template/ia32/TemplateOpList.h" +#undef JIT_TEMPLATE + + /* Target-specific configuration */ + gDvmJit.jitTableSize = 1 << 9; // 512 + gDvmJit.jitTableMask = gDvmJit.jitTableSize - 1; + gDvmJit.threshold = 200; + gDvmJit.codeCacheSize = 512*1024; + +#if defined(WITH_SELF_VERIFICATION) + /* Force into blocking mode */ + gDvmJit.blockingMode = true; + gDvm.nativeDebuggerActive = true; +#endif + + /* Codegen-specific assumptions */ + assert(offsetof(ClassObject, vtable) < 128 && + (offsetof(ClassObject, vtable) & 0x3) == 0); + assert(offsetof(ArrayObject, length) < 128 && + (offsetof(ArrayObject, length) & 0x3) == 0); + assert(offsetof(ArrayObject, contents) < 256); + + /* Up to 5 args are pushed on top of FP - sizeofStackSaveArea */ + assert(sizeof(StackSaveArea) < 236); + + /* + * EA is calculated by doing "Rn + imm5 << 2", make sure that the last + * offset from the struct is less than 128. + */ + assert((offsetof(InterpState, jitToInterpEntries) + + sizeof(struct JitToInterpEntries)) <= 128); + return true; +} + +int dvmCompilerTargetOptHint(int key) +{ + int res; + switch (key) { + case kMaxHoistDistance: + res = 2; + break; + default: + LOGE("Unknown target optimization hint key: %d",key); + res = 0; + } + return res; +} + +void dvmCompilerGenMemBarrier(CompilationUnit *cUnit) +{ +} diff --git a/vm/compiler/codegen/x86/ia32/ArchVariant.h b/vm/compiler/codegen/x86/ia32/ArchVariant.h new file mode 100644 index 000000000..ac4293f0f --- /dev/null +++ b/vm/compiler/codegen/x86/ia32/ArchVariant.h @@ -0,0 +1,34 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef _DALVIK_VM_COMPILER_CODEGEN_X86_IA32_ARCHVARIANT_H +#define _DALVIK_VM_COMPILER_CODEGEN_X86_IA32_ARCHVARIANT_H + +/* Create the TemplateOpcode enum */ +#define JIT_TEMPLATE(X) TEMPLATE_##X, +typedef enum { +#include "../../../template/ia32/TemplateOpList.h" +/* + * For example, + * TEMPLATE_CMP_LONG, + * TEMPLATE_RETURN, + * ... + */ + TEMPLATE_LAST_MARK, +} TemplateOpCode; +#undef JIT_TEMPLATE + +#endif /* _DALVIK_VM_COMPILER_CODEGEN_X86_IA32_ARCHVARIANT_H */ diff --git a/vm/compiler/codegen/x86/ia32/CallingConvention.S b/vm/compiler/codegen/x86/ia32/CallingConvention.S new file mode 100644 index 000000000..cc4187a40 --- /dev/null +++ b/vm/compiler/codegen/x86/ia32/CallingConvention.S @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Save & restore for callee-save FP registers. + * On entry: + * tos : pointer to save area of JIT_CALLEE_SAVE_WORD_SIZE + */ + .text + .align 2 + .global dvmJitCalleeSave + .type dvmJitCalleeSave, %function +dvmJitCalleeSave: + ret + + .global dvmJitCalleeRestore + .type dvmJitCalleeRestore, %function +dvmJitCalleeRestore: + ret diff --git a/vm/compiler/codegen/x86/ia32/Codegen.c b/vm/compiler/codegen/x86/ia32/Codegen.c new file mode 100644 index 000000000..e86baccdb --- /dev/null +++ b/vm/compiler/codegen/x86/ia32/Codegen.c @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +#define _CODEGEN_C +#define _IA32 + +#include "Dalvik.h" +#include "interp/InterpDefs.h" +#include "libdex/OpCode.h" +#include "libdex/OpCodeNames.h" +#include "compiler/CompilerInternals.h" +#include "compiler/codegen/x86/X86LIR.h" +#include "mterp/common/FindInterface.h" +//#include "compiler/codegen/x86/Ralloc.h" +#include "compiler/codegen/x86/Codegen.h" +#include "compiler/Loop.h" +#include "ArchVariant.h" + +/* Architectural independent building blocks */ +//#include "../CodegenCommon.c" + +/* Architectural independent building blocks */ +//#include "../Thumb/Factory.c" +/* Factory utilities dependent on arch-specific features */ +//#include "../CodegenFactory.c" + +/* ia32 register allocation */ +//#include "../ia32/Ralloc.c" + +/* MIR2LIR dispatcher and architectural independent codegen routines */ +#include "../CodegenDriver.c" + +/* Architecture manifest */ +#include "ArchVariant.c" |