summaryrefslogtreecommitdiff
path: root/src/compiler_llvm/method_compiler.cc
diff options
context:
space:
mode:
author TDYa127 <tdy@google.com> 2012-04-17 02:20:34 -0700
committer Shih-wei Liao <sliao@google.com> 2012-04-17 14:44:39 -0700
commit83bb6624fe370e7f8922471598adcd1f936e4b1a (patch)
tree4632b575849c78e911ad46b8d19bd71b93ef6dd5 /src/compiler_llvm/method_compiler.cc
parent2acf36d8cfeb5ddb293904148aa70f25ef6d8845 (diff)
Implement MarkGCCard.
Change-Id: Ic004750a303897d33a5459a41ac60ac552926e07
Diffstat (limited to 'src/compiler_llvm/method_compiler.cc')
-rw-r--r--src/compiler_llvm/method_compiler.cc18
1 files changed, 17 insertions, 1 deletions
diff --git a/src/compiler_llvm/method_compiler.cc b/src/compiler_llvm/method_compiler.cc
index 153d99a93b..fa8a827100 100644
--- a/src/compiler_llvm/method_compiler.cc
+++ b/src/compiler_llvm/method_compiler.cc
@@ -2252,6 +2252,12 @@ llvm::Value* MethodCompiler::EmitConditionResult(llvm::Value* lhs,
}
}
+void MethodCompiler::EmitMarkGCCard(llvm::Value* value, llvm::Value* target_addr) {
+ // Using runtime support, let the target can override by InlineAssembly.
+ llvm::Function* runtime_func = irb_.GetRuntime(MarkGCCard);
+
+ irb_.CreateCall2(runtime_func, value, target_addr);
+}
void
MethodCompiler::EmitGuard_ArrayIndexOutOfBoundsException(uint32_t dex_pc,
@@ -2354,12 +2360,14 @@ void MethodCompiler::EmitInsn_APut(uint32_t dex_pc,
llvm::Value* new_value = EmitLoadDalvikReg(dec_insn.vA, elem_jty, kArray);
- if (elem_jty == kObject) { // If put an object, check the type.
+ if (elem_jty == kObject) { // If put an object, check the type, and mark GC card table.
llvm::Function* runtime_func = irb_.GetRuntime(CheckPutArrayElement);
irb_.CreateCall2(runtime_func, new_value, array_addr);
EmitGuard_ExceptionLandingPad(dex_pc);
+
+ EmitMarkGCCard(new_value, array_addr);
}
irb_.CreateStore(new_value, array_elem_addr);
@@ -2488,6 +2496,10 @@ void MethodCompiler::EmitInsn_IPut(uint32_t dex_pc,
// TODO: Check is_volatile. We need to generate atomic store instruction
// when is_volatile is true.
irb_.CreateStore(new_value, field_addr);
+
+ if (field_jty == kObject) { // If put an object, mark the GC card table.
+ EmitMarkGCCard(new_value, object_addr);
+ }
}
irb_.CreateBr(GetNextBasicBlock(dex_pc));
@@ -2704,6 +2716,10 @@ void MethodCompiler::EmitInsn_SPut(uint32_t dex_pc,
// TODO: Check is_volatile. We need to generate atomic store instruction
// when is_volatile is true.
irb_.CreateStore(new_value, static_field_addr);
+
+ if (field_jty == kObject) { // If put an object, mark the GC card table.
+ EmitMarkGCCard(new_value, static_storage_addr);
+ }
}
irb_.CreateBr(GetNextBasicBlock(dex_pc));