Mercurial > hg > truffle
diff src/share/vm/asm/assembler.hpp @ 4766:40c2484c09e1
7110832: ctw/.../org_apache_avalon_composition_util_StringHelper crashes the VM
Summary: Distance is too large for one short branch in string_indexofC8().
Reviewed-by: iveresov
author | kvn |
---|---|
date | Fri, 23 Dec 2011 15:24:36 -0800 |
parents | 6729bbc1fcd6 |
children | 1d7922586cf6 |
line wrap: on
line diff
--- a/src/share/vm/asm/assembler.hpp Fri Dec 23 09:36:23 2011 +0100 +++ b/src/share/vm/asm/assembler.hpp Fri Dec 23 15:24:36 2011 -0800 @@ -241,6 +241,33 @@ // Make it return true on platforms which need to verify // instruction boundaries for some operations. inline static bool pd_check_instruction_mark(); + + // Add delta to short branch distance to verify that it still fit into imm8. + int _short_branch_delta; + + int short_branch_delta() const { return _short_branch_delta; } + void set_short_branch_delta() { _short_branch_delta = 32; } + void clear_short_branch_delta() { _short_branch_delta = 0; } + + class ShortBranchVerifier: public StackObj { + private: + AbstractAssembler* _assm; + + public: + ShortBranchVerifier(AbstractAssembler* assm) : _assm(assm) { + assert(assm->short_branch_delta() == 0, "overlapping instructions"); + _assm->set_short_branch_delta(); + } + ~ShortBranchVerifier() { + _assm->clear_short_branch_delta(); + } + }; + #else + // Dummy in product. + class ShortBranchVerifier: public StackObj { + public: + ShortBranchVerifier(AbstractAssembler* assm) {} + }; #endif // Label functions