equal
deleted
inserted
replaced
365 |
365 |
366 void NativeCallTrampolineStub::set_destination(address new_destination) { |
366 void NativeCallTrampolineStub::set_destination(address new_destination) { |
367 set_ptr_at(data_offset, new_destination); |
367 set_ptr_at(data_offset, new_destination); |
368 OrderAccess::release(); |
368 OrderAccess::release(); |
369 } |
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 } |