Currently you can't do that with macros, but in theory you could crate
a wrapper macro to declare all your functions which works similarly to
the externfn! macro. It could debug entry/exit and otherwise just be a
wrapper around an internally declared function.

On Mon, Sep 30, 2013 at 1:35 PM, Jason E. Aten <[email protected]> wrote:
>
> I'm wondering if much of this couldn't be prototyped with macros.  Is there
> a way for a macro to refer to the return value of a function?
>
>
> On Mon, Sep 30, 2013 at 1:13 PM, Jason E. Aten <[email protected]> wrote:
>>
>> Interesting idea, the self-modifying code.  Is that codable in rust
>> currently?
>>
>>
>> On Mon, Sep 30, 2013 at 1:06 PM, Keegan McAllister
>> <[email protected]> wrote:
>>>
>>> > surely global_tracking_flag could be persuaded to live in a register,
>>> > no?
>>>
>>> Reserving a register will slow down the whole program.  I'd expect a
>>> serious hit on 32-bit x86, and modest but measurable slowdown elsewhere.  It
>>> might be worth doing a quick experiment, if there's a way to convince LLVM
>>> to just set aside a register.
>>>
>>> The Linux kernel uses self-modifying code for this sort of thing.
>>> Functions are compiled with logging / tracing code, which is then NOP'd out
>>> until it's needed.  This is tricky to get right, especially in a concurrent
>>> setting, but it might be worth considering if we want Rust to have really
>>> good production-compatible monitoring (which I agree is a worthwhile goal).
>>>
>>> keegan
>>
>>
>
>
> _______________________________________________
> Rust-dev mailing list
> [email protected]
> https://mail.mozilla.org/listinfo/rust-dev
>
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to