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 void reset() { 168 init(); //leave _patch_overflow because it points to CodeBuffer. 169 } 170 }; 171 172 // A NearLabel must be bound to a location near its users. Users can 173 // optimize on this information, e.g. generate short branches. 174 class NearLabel : public Label { 175 public: 176 NearLabel() : Label() { _is_near = true; } 177 }; 178 179 // A union type for code which has to assemble both constant and 180 // non-constant operands, when the distinction cannot be made 181 // statically. 182 class RegisterOrConstant { 183 private: 184 Register _r; 185 intptr_t _c; 186 187 public: 188 RegisterOrConstant(): _r(noreg), _c(0) {} 189 RegisterOrConstant(Register r): _r(r), _c(0) {} |