7153771: array bound check elimination for c1

When possible optimize out array bound checks, inserting predicates when needed.

Reviewed-by: never, kvn, twisti
This commit is contained in:
Thomas Wuerthinger 2013-03-21 09:27:54 +01:00 committed by Roland Westrelin
parent 2f4ecb86a2
commit 06ef4cddf7
40 changed files with 2861 additions and 153 deletions

View file

@ -26,8 +26,10 @@
#define SHARE_VM_C1_C1_COMPILATION_HPP
#include "ci/ciEnv.hpp"
#include "ci/ciMethodData.hpp"
#include "code/exceptionHandlerTable.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/deoptimization.hpp"
class CompilationResourceObj;
class XHandlers;
@ -85,6 +87,7 @@ class Compilation: public StackObj {
LinearScan* _allocator;
CodeOffsets _offsets;
CodeBuffer _code;
bool _has_access_indexed;
// compilation helpers
void initialize();
@ -140,6 +143,7 @@ class Compilation: public StackObj {
C1_MacroAssembler* masm() const { return _masm; }
CodeOffsets* offsets() { return &_offsets; }
Arena* arena() { return _arena; }
bool has_access_indexed() { return _has_access_indexed; }
// Instruction ids
int get_next_id() { return _next_id++; }
@ -154,6 +158,7 @@ class Compilation: public StackObj {
void set_has_fpu_code(bool f) { _has_fpu_code = f; }
void set_has_unsafe_access(bool f) { _has_unsafe_access = f; }
void set_would_profile(bool f) { _would_profile = f; }
void set_has_access_indexed(bool f) { _has_access_indexed = f; }
// Add a set of exception handlers covering the given PC offset
void add_exception_handlers_for_pco(int pco, XHandlers* exception_handlers);
// Statistics gathering
@ -233,6 +238,14 @@ class Compilation: public StackObj {
return env()->comp_level() == CompLevel_full_profile &&
C1UpdateMethodData && C1ProfileCheckcasts;
}
// will compilation make optimistic assumptions that might lead to
// deoptimization and that the runtime will account for?
bool is_optimistic() const {
return !TieredCompilation &&
(RangeCheckElimination || UseLoopInvariantCodeMotion) &&
method()->method_data()->trap_count(Deoptimization::Reason_none) == 0;
}
};