< prev index next >

src/hotspot/share/asm/assembler.hpp

Print this page
rev 50906 : JDK-8206075: Cdd an assertion stmt for Assembler's Label

Check all labels and catch unbound labels. Fix a problem for x86.


 142    * @param branch_loc the locator of the branch instruction in the code buffer
 143    */
 144   void add_patch_at(CodeBuffer* cb, int branch_loc);
 145 
 146   /**
 147    * Iterate over the list of patches, resolving the instructions
 148    * Call patch_instruction on each 'branch_loc' value
 149    */
 150   void patch_instructions(MacroAssembler* masm);
 151 
 152   void init() {
 153     _loc = -1;
 154     _patch_index = 0;
 155     _patch_overflow = NULL;
 156     _is_near = false;
 157   }
 158 
 159   Label() {
 160     init();
 161   }




 162 };
 163 
 164 // A NearLabel must be bound to a location near its users. Users can
 165 // optimize on this information, e.g. generate short branches.
 166 class NearLabel : public Label {
 167  public:
 168   NearLabel() : Label() { _is_near = true; }
 169 };
 170 
 171 // A union type for code which has to assemble both constant and
 172 // non-constant operands, when the distinction cannot be made
 173 // statically.
 174 class RegisterOrConstant {
 175  private:
 176   Register _r;
 177   intptr_t _c;
 178 
 179  public:
 180   RegisterOrConstant(): _r(noreg), _c(0) {}
 181   RegisterOrConstant(Register r): _r(r), _c(0) {}




 142    * @param branch_loc the locator of the branch instruction in the code buffer
 143    */
 144   void add_patch_at(CodeBuffer* cb, int branch_loc);
 145 
 146   /**
 147    * Iterate over the list of patches, resolving the instructions
 148    * Call patch_instruction on each 'branch_loc' value
 149    */
 150   void patch_instructions(MacroAssembler* masm);
 151 
 152   void init() {
 153     _loc = -1;
 154     _patch_index = 0;
 155     _patch_overflow = NULL;
 156     _is_near = false;
 157   }
 158 
 159   Label() {
 160     init();
 161   }
 162 
 163   ~Label() {
 164     assert(is_bound() || is_unused(), "Label was never bound to a location, but it was used as a jmp target");
 165   }
 166 };
 167 
 168 // A NearLabel must be bound to a location near its users. Users can
 169 // optimize on this information, e.g. generate short branches.
 170 class NearLabel : public Label {
 171  public:
 172   NearLabel() : Label() { _is_near = true; }
 173 };
 174 
 175 // A union type for code which has to assemble both constant and
 176 // non-constant operands, when the distinction cannot be made
 177 // statically.
 178 class RegisterOrConstant {
 179  private:
 180   Register _r;
 181   intptr_t _c;
 182 
 183  public:
 184   RegisterOrConstant(): _r(noreg), _c(0) {}
 185   RegisterOrConstant(Register r): _r(r), _c(0) {}


< prev index next >