summaryrefslogtreecommitdiffstats
path: root/compiler/optimizing
diff options
context:
space:
mode:
authorNicolas Geoffray <ngeoffray@google.com>2014-07-22 17:47:56 +0100
committerNicolas Geoffray <ngeoffray@google.com>2014-07-22 17:47:56 +0100
commit73e80c3ae76fafdb53afe3a85306dcb491fb5b00 (patch)
tree6c437ad0e24f0ed66251e8f37c13b6e6675db1f2 /compiler/optimizing
parent16fc9f617e395758eb95b5f2124c79a828186b55 (diff)
downloadart-73e80c3ae76fafdb53afe3a85306dcb491fb5b00.tar.gz
art-73e80c3ae76fafdb53afe3a85306dcb491fb5b00.tar.bz2
art-73e80c3ae76fafdb53afe3a85306dcb491fb5b00.zip
Make unit test tell if a method is a leaf.
The runtime is not initialized completely in gtests, so we cannot run code (such as explicit stack overflow checks) that look at tls values. Change-Id: I74a4449b01eb203f1b411dda700e9459878d0d55
Diffstat (limited to 'compiler/optimizing')
-rw-r--r--compiler/optimizing/code_generator.cc8
-rw-r--r--compiler/optimizing/code_generator.h2
-rw-r--r--compiler/optimizing/codegen_test.cc8
3 files changed, 10 insertions, 8 deletions
diff --git a/compiler/optimizing/code_generator.cc b/compiler/optimizing/code_generator.cc
index c0964e6481..bd8c27ec3e 100644
--- a/compiler/optimizing/code_generator.cc
+++ b/compiler/optimizing/code_generator.cc
@@ -30,16 +30,16 @@
namespace art {
-void CodeGenerator::CompileBaseline(CodeAllocator* allocator) {
+void CodeGenerator::CompileBaseline(CodeAllocator* allocator, bool is_leaf) {
const GrowableArray<HBasicBlock*>& blocks = GetGraph()->GetBlocks();
DCHECK(blocks.Get(0) == GetGraph()->GetEntryBlock());
DCHECK(GoesToNextBlock(GetGraph()->GetEntryBlock(), blocks.Get(1)));
block_labels_.SetSize(blocks.Size());
DCHECK_EQ(frame_size_, kUninitializedFrameSize);
- // The baseline compiler does not do graph analysis prior to generating
- // code.
- MarkNotLeaf();
+ if (!is_leaf) {
+ MarkNotLeaf();
+ }
ComputeFrameSize(GetGraph()->GetMaximumNumberOfOutVRegs()
+ GetGraph()->GetNumberOfLocalVRegs()
+ GetGraph()->GetNumberOfTemporaries()
diff --git a/compiler/optimizing/code_generator.h b/compiler/optimizing/code_generator.h
index 936ca28901..b31c3a3e83 100644
--- a/compiler/optimizing/code_generator.h
+++ b/compiler/optimizing/code_generator.h
@@ -70,7 +70,7 @@ class CodeGenerator : public ArenaObject {
public:
// Compiles the graph to executable instructions. Returns whether the compilation
// succeeded.
- void CompileBaseline(CodeAllocator* allocator);
+ void CompileBaseline(CodeAllocator* allocator, bool is_leaf = false);
void CompileOptimized(CodeAllocator* allocator);
static CodeGenerator* Create(ArenaAllocator* allocator,
HGraph* graph,
diff --git a/compiler/optimizing/codegen_test.cc b/compiler/optimizing/codegen_test.cc
index bfdc30f26b..d7ac10d164 100644
--- a/compiler/optimizing/codegen_test.cc
+++ b/compiler/optimizing/codegen_test.cc
@@ -76,19 +76,21 @@ static void TestCode(const uint16_t* data, bool has_result = false, int32_t expe
InternalCodeAllocator allocator;
CodeGenerator* codegen = CodeGenerator::Create(&arena, graph, kX86);
- codegen->CompileBaseline(&allocator);
+ // We avoid doing a stack overflow check that requires the runtime being setup,
+ // by making sure the compiler knows the methods we are running are leaf methods.
+ codegen->CompileBaseline(&allocator, true);
#if defined(__i386__)
Run(allocator, *codegen, has_result, expected);
#endif
codegen = CodeGenerator::Create(&arena, graph, kArm);
- codegen->CompileBaseline(&allocator);
+ codegen->CompileBaseline(&allocator, true);
#if defined(__arm__)
Run(allocator, *codegen, has_result, expected);
#endif
codegen = CodeGenerator::Create(&arena, graph, kX86_64);
- codegen->CompileBaseline(&allocator);
+ codegen->CompileBaseline(&allocator, true);
#if defined(__x86_64__)
Run(allocator, *codegen, has_result, expected);
#endif