199 // The Assembler is generating code into a CodeBuffer. 200 class AbstractAssembler : public ResourceObj { 201 friend class Label; 202 203 protected: 204 CodeSection* _code_section; // section within the code buffer 205 OopRecorder* _oop_recorder; // support for relocInfo::oop_type 206 207 // Code emission & accessing 208 address addr_at(int pos) const { return code_section()->start() + pos; } 209 210 211 // This routine is called with a label is used for an address. 212 // Labels and displacements truck in offsets, but target must return a PC. 213 address target(Label& L) { return code_section()->target(L, pc()); } 214 215 bool is8bit(int x) const { return -0x80 <= x && x < 0x80; } 216 bool isByte(int x) const { return 0 <= x && x < 0x100; } 217 bool isShiftCount(int x) const { return 0 <= x && x < 32; } 218 219 void emit_long(jint x) { emit_int32(x); } // deprecated 220 221 // Instruction boundaries (required when emitting relocatable values). 222 class InstructionMark: public StackObj { 223 private: 224 AbstractAssembler* _assm; 225 226 public: 227 InstructionMark(AbstractAssembler* assm) : _assm(assm) { 228 assert(assm->inst_mark() == NULL, "overlapping instructions"); 229 _assm->set_inst_mark(); 230 } 231 ~InstructionMark() { 232 _assm->clear_inst_mark(); 233 } 234 }; 235 friend class InstructionMark; 236 #ifdef ASSERT 237 // Make it return true on platforms which need to verify 238 // instruction boundaries for some operations. 239 static bool pd_check_instruction_mark(); 240 | 199 // The Assembler is generating code into a CodeBuffer. 200 class AbstractAssembler : public ResourceObj { 201 friend class Label; 202 203 protected: 204 CodeSection* _code_section; // section within the code buffer 205 OopRecorder* _oop_recorder; // support for relocInfo::oop_type 206 207 // Code emission & accessing 208 address addr_at(int pos) const { return code_section()->start() + pos; } 209 210 211 // This routine is called with a label is used for an address. 212 // Labels and displacements truck in offsets, but target must return a PC. 213 address target(Label& L) { return code_section()->target(L, pc()); } 214 215 bool is8bit(int x) const { return -0x80 <= x && x < 0x80; } 216 bool isByte(int x) const { return 0 <= x && x < 0x100; } 217 bool isShiftCount(int x) const { return 0 <= x && x < 32; } 218 219 // Instruction boundaries (required when emitting relocatable values). 220 class InstructionMark: public StackObj { 221 private: 222 AbstractAssembler* _assm; 223 224 public: 225 InstructionMark(AbstractAssembler* assm) : _assm(assm) { 226 assert(assm->inst_mark() == NULL, "overlapping instructions"); 227 _assm->set_inst_mark(); 228 } 229 ~InstructionMark() { 230 _assm->clear_inst_mark(); 231 } 232 }; 233 friend class InstructionMark; 234 #ifdef ASSERT 235 // Make it return true on platforms which need to verify 236 // instruction boundaries for some operations. 237 static bool pd_check_instruction_mark(); 238 |