350
351 a.mov(rscratch1, entry);
352 a.br(rscratch1);
353
354 ICache::invalidate_range(code_pos, instruction_size);
355 }
356
357 // MT-safe patching of a long jump instruction.
358 void NativeGeneralJump::replace_mt_safe(address instr_addr, address code_buffer) {
359 ShouldNotCallThis();
360 }
361
362 address NativeCallTrampolineStub::destination(nmethod *nm) const {
363 return ptr_at(data_offset);
364 }
365
366 void NativeCallTrampolineStub::set_destination(address new_destination) {
367 set_ptr_at(data_offset, new_destination);
368 OrderAccess::release();
369 }
|
350
351 a.mov(rscratch1, entry);
352 a.br(rscratch1);
353
354 ICache::invalidate_range(code_pos, instruction_size);
355 }
356
357 // MT-safe patching of a long jump instruction.
358 void NativeGeneralJump::replace_mt_safe(address instr_addr, address code_buffer) {
359 ShouldNotCallThis();
360 }
361
362 address NativeCallTrampolineStub::destination(nmethod *nm) const {
363 return ptr_at(data_offset);
364 }
365
366 void NativeCallTrampolineStub::set_destination(address new_destination) {
367 set_ptr_at(data_offset, new_destination);
368 OrderAccess::release();
369 }
370
371 // Generate a trampoline for a branch to dest. If there's no need for a
372 // trampoline, simply patch the call directly to dest.
373 address NativeCall::trampoline_jump(CodeBuffer &cbuf, address dest) {
374 MacroAssembler a(&cbuf);
375 address stub = NULL;
376
377 if (a.far_branches()
378 && ! is_NativeCallTrampolineStub_at(instruction_address() + displacement())) {
379 stub = a.emit_trampoline_stub(instruction_address() - cbuf.insts()->start(), dest);
380 }
381
382 if (stub == NULL) {
383 // If we generated no stub, patch this call directly to dest.
384 // This will happen if we don't need far branches or if there
385 // already was a trampoline.
386 set_destination(dest);
387 }
388
389 return stub;
390 }
|