43 // - NativeCallTrampolineStub
44
45 // The base class for different kinds of native instruction abstractions.
46 // It provides the primitive operations to manipulate code relative to this.
47 class NativeInstruction {
48 friend class Relocation;
49
50 public:
51 bool is_jump() { return Assembler::is_b(long_at(0)); } // See NativeGeneralJump.
52
53 bool is_sigtrap_ic_miss_check() {
54 assert(UseSIGTRAP, "precondition");
55 return MacroAssembler::is_trap_ic_miss_check(long_at(0));
56 }
57
58 bool is_sigtrap_null_check() {
59 assert(UseSIGTRAP && TrapBasedNullChecks, "precondition");
60 return MacroAssembler::is_trap_null_check(long_at(0));
61 }
62
63 // We use a special trap for marking a method as not_entrant or zombie
64 // iff UseSIGTRAP.
65 bool is_sigtrap_zombie_not_entrant() {
66 assert(UseSIGTRAP, "precondition");
67 return MacroAssembler::is_trap_zombie_not_entrant(long_at(0));
68 }
69
70 // We use an illtrap for marking a method as not_entrant or zombie
71 // iff !UseSIGTRAP.
72 bool is_sigill_zombie_not_entrant() {
73 assert(!UseSIGTRAP, "precondition");
74 // Work around a C++ compiler bug which changes 'this'.
75 return NativeInstruction::is_sigill_zombie_not_entrant_at(addr_at(0));
76 }
77 static bool is_sigill_zombie_not_entrant_at(address addr);
78
79 #ifdef COMPILER2
80 // SIGTRAP-based implicit range checks
81 bool is_sigtrap_range_check() {
82 assert(UseSIGTRAP && TrapBasedRangeChecks, "precondition");
83 return MacroAssembler::is_trap_range_check(long_at(0));
84 }
85 #endif
86
87 // 'should not reach here'.
88 bool is_sigtrap_should_not_reach_here() {
89 return MacroAssembler::is_trap_should_not_reach_here(long_at(0));
90 }
91
92 bool is_safepoint_poll() {
93 // Is the current instruction a POTENTIAL read access to the polling page?
94 // The current arguments of the instruction are not checked!
95 if (USE_POLL_BIT_ONLY) {
96 int encoding = SafepointMechanism::poll_bit();
97 return MacroAssembler::is_tdi(long_at(0), Assembler::traptoGreaterThanUnsigned | Assembler::traptoEqual,
98 -1, encoding);
99 }
100 return MacroAssembler::is_load_from_polling_page(long_at(0), NULL);
101 }
102
103 address get_stack_bang_address(void *ucontext) {
104 // If long_at(0) is not a stack bang, return 0. Otherwise, return
105 // banged address.
106 return MacroAssembler::get_stack_bang_address(long_at(0), ucontext);
107 }
108
109 protected:
110 address addr_at(int offset) const { return address(this) + offset; }
|
43 // - NativeCallTrampolineStub
44
45 // The base class for different kinds of native instruction abstractions.
46 // It provides the primitive operations to manipulate code relative to this.
47 class NativeInstruction {
48 friend class Relocation;
49
50 public:
51 bool is_jump() { return Assembler::is_b(long_at(0)); } // See NativeGeneralJump.
52
53 bool is_sigtrap_ic_miss_check() {
54 assert(UseSIGTRAP, "precondition");
55 return MacroAssembler::is_trap_ic_miss_check(long_at(0));
56 }
57
58 bool is_sigtrap_null_check() {
59 assert(UseSIGTRAP && TrapBasedNullChecks, "precondition");
60 return MacroAssembler::is_trap_null_check(long_at(0));
61 }
62
63 int get_stop_type() {
64 return MacroAssembler::tdi_get_si16(long_at(0), Assembler::traptoUnconditional, 0);
65 }
66
67 // We use an illtrap for marking a method as not_entrant or zombie.
68 bool is_sigill_zombie_not_entrant() {
69 // Work around a C++ compiler bug which changes 'this'.
70 return NativeInstruction::is_sigill_zombie_not_entrant_at(addr_at(0));
71 }
72 static bool is_sigill_zombie_not_entrant_at(address addr);
73
74 #ifdef COMPILER2
75 // SIGTRAP-based implicit range checks
76 bool is_sigtrap_range_check() {
77 assert(UseSIGTRAP && TrapBasedRangeChecks, "precondition");
78 return MacroAssembler::is_trap_range_check(long_at(0));
79 }
80 #endif
81
82 bool is_safepoint_poll() {
83 // Is the current instruction a POTENTIAL read access to the polling page?
84 // The current arguments of the instruction are not checked!
85 if (USE_POLL_BIT_ONLY) {
86 int encoding = SafepointMechanism::poll_bit();
87 return MacroAssembler::is_tdi(long_at(0), Assembler::traptoGreaterThanUnsigned | Assembler::traptoEqual,
88 -1, encoding);
89 }
90 return MacroAssembler::is_load_from_polling_page(long_at(0), NULL);
91 }
92
93 address get_stack_bang_address(void *ucontext) {
94 // If long_at(0) is not a stack bang, return 0. Otherwise, return
95 // banged address.
96 return MacroAssembler::get_stack_bang_address(long_at(0), ucontext);
97 }
98
99 protected:
100 address addr_at(int offset) const { return address(this) + offset; }
|