75 assert(is_call(), "not a call");
76 if (NativeImmCall::is_at(addr())) {
77 NativeImmCall::from(addr())->set_destination(dest);
78 } else if (NativeMovConstReg::is_at(addr())) {
79 NativeMovConstReg::from(addr())->set_data((uintptr_t) dest);
80 } else if (NativeTrampolineCall::is_at(addr())) {
81 NativeTrampolineCall::from(addr())->set_destination(dest);
82 } else {
83 ShouldNotReachHere();
84 }
85 }
86
87 void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
88 assert(is_call(), "not a call");
89
90 // patching should be not only safe (i.e. this call could be executed by some thread),
91 // but it also should be atomic (some other thread could call NativeCall::destination()
92 // and see valid destination value)
93
94 if (NativeImmCall::is_at(addr())) {
95 assert(false, "could be patched mt_safe way, but should not be requested to. "
96 "Known mt_safe requests have arbitrary destination offset. "
97 "Use trampoline_call for this.");
98 ShouldNotCallThis();
99 } else if (NativeTrampolineCall::is_at(addr())) {
100 NativeTrampolineCall::from(addr())->set_destination_mt_safe(dest);
101 } else {
102 ShouldNotReachHere();
103 }
104 }
105
106 void NativeCall::insert(address code_pos, address entry) {
107 Unimplemented();
108 }
109
110 bool NativeCall::is_call_before(address return_address) {
111 return is_at(return_address - NativeImmCall::instruction_size) ||
112 is_at(return_address - NativeCall::instruction_size);
113 }
114
115 address NativeCall::next_instruction_address() const {
116 assert(is_call(), "not a call");
117 if (NativeImmCall::is_at(addr())) {
118 return NativeImmCall::from(addr())->next_instruction_address();
|
75 assert(is_call(), "not a call");
76 if (NativeImmCall::is_at(addr())) {
77 NativeImmCall::from(addr())->set_destination(dest);
78 } else if (NativeMovConstReg::is_at(addr())) {
79 NativeMovConstReg::from(addr())->set_data((uintptr_t) dest);
80 } else if (NativeTrampolineCall::is_at(addr())) {
81 NativeTrampolineCall::from(addr())->set_destination(dest);
82 } else {
83 ShouldNotReachHere();
84 }
85 }
86
87 void NativeCall::set_destination_mt_safe(address dest, bool assert_lock) {
88 assert(is_call(), "not a call");
89
90 // patching should be not only safe (i.e. this call could be executed by some thread),
91 // but it also should be atomic (some other thread could call NativeCall::destination()
92 // and see valid destination value)
93
94 if (NativeImmCall::is_at(addr())) {
95 NativeImmCall::from(addr())->set_destination(dest);
96 ICache::invalidate_word(addr());
97 } else if (NativeTrampolineCall::is_at(addr())) {
98 NativeTrampolineCall::from(addr())->set_destination_mt_safe(dest);
99 } else {
100 ShouldNotReachHere();
101 }
102 }
103
104 void NativeCall::insert(address code_pos, address entry) {
105 Unimplemented();
106 }
107
108 bool NativeCall::is_call_before(address return_address) {
109 return is_at(return_address - NativeImmCall::instruction_size) ||
110 is_at(return_address - NativeCall::instruction_size);
111 }
112
113 address NativeCall::next_instruction_address() const {
114 assert(is_call(), "not a call");
115 if (NativeImmCall::is_at(addr())) {
116 return NativeImmCall::from(addr())->next_instruction_address();
|