374 data_offset = 1,
375 next_instruction_offset = 5
376 };
377
378 address instruction_address() const { return addr_at(instruction_offset); }
379 address next_instruction_address() const { return addr_at(next_instruction_offset); }
380 address jump_destination() const {
381 address dest = (int_at(data_offset)+next_instruction_address());
382 // 32bit used to encode unresolved jmp as jmp -1
383 // 64bit can't produce this so it used jump to self.
384 // Now 32bit and 64bit use jump to self as the unresolved address
385 // which the inline cache code (and relocs) know about
386
387 // return -1 if jump to self
388 dest = (dest == (address) this) ? (address) -1 : dest;
389 return dest;
390 }
391
392 void set_jump_destination(address dest) {
393 intptr_t val = dest - next_instruction_address();
394 #ifdef AMD64
395 assert((labs(val) & 0xFFFFFFFF00000000) == 0 || dest == (address)-1, "must be 32bit offset or -1");
396 #endif // AMD64
397 set_int_at(data_offset, (jint)val);
398 }
399
400 // Creation
401 inline friend NativeJump* nativeJump_at(address address);
402
403 void verify();
404
405 // Unit testing stuff
406 static void test() {}
407
408 // Insertion of native jump instruction
409 static void insert(address code_pos, address entry);
410 // MT-safe insertion of native jump at verified method entry
411 static void check_verified_entry_alignment(address entry, address verified_entry);
412 static void patch_verified_entry(address entry, address verified_entry, address dest);
413 };
|
374 data_offset = 1,
375 next_instruction_offset = 5
376 };
377
378 address instruction_address() const { return addr_at(instruction_offset); }
379 address next_instruction_address() const { return addr_at(next_instruction_offset); }
380 address jump_destination() const {
381 address dest = (int_at(data_offset)+next_instruction_address());
382 // 32bit used to encode unresolved jmp as jmp -1
383 // 64bit can't produce this so it used jump to self.
384 // Now 32bit and 64bit use jump to self as the unresolved address
385 // which the inline cache code (and relocs) know about
386
387 // return -1 if jump to self
388 dest = (dest == (address) this) ? (address) -1 : dest;
389 return dest;
390 }
391
392 void set_jump_destination(address dest) {
393 intptr_t val = dest - next_instruction_address();
394 if (dest == (address) -1) {
395 val = -5; // jump to self
396 }
397 #ifdef AMD64
398 assert((labs(val) & 0xFFFFFFFF00000000) == 0 || dest == (address)-1, "must be 32bit offset or -1");
399 #endif // AMD64
400 set_int_at(data_offset, (jint)val);
401 }
402
403 // Creation
404 inline friend NativeJump* nativeJump_at(address address);
405
406 void verify();
407
408 // Unit testing stuff
409 static void test() {}
410
411 // Insertion of native jump instruction
412 static void insert(address code_pos, address entry);
413 // MT-safe insertion of native jump at verified method entry
414 static void check_verified_entry_alignment(address entry, address verified_entry);
415 static void patch_verified_entry(address entry, address verified_entry, address dest);
416 };
|