libjit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Libjit] RFC: type safety


From: Aleksey Demakov
Subject: Re: [Libjit] RFC: type safety
Date: Thu, 28 Feb 2013 13:15:07 +0300

Hi Alexey,

I appreciate your finding these problems in the memory manager interface
use. It looks like you were the first who started seriously use libjit after I
added it. Actually I left it last November somewhat unfinished with the
intent to get back to it eventually and after getting feedback on its design
from the people who wanted such functionality. But I have not got any
feedback so far.

Thanks to your and a couple of other people requests I am going to resume
my work on it now.

Concerning your proposal for introducing fake struct declarations I think that
having these types declared as void* more clearly states their purpose -
to be defined by the concrete memory plugin. Any kind of misuse would be
detected quickly on first tests. The sad fact that you had to spend few days
on debugging is because this was a new interface that was not yet fully
tested.

Then again I appreciate your feedback and being the one who finally tested it.

Regards,
Aleksey

On Thu, Feb 28, 2013 at 11:47 AM, Alexey Galakhov <address@hidden> wrote:
> Hi,
>
> Ok, there have been issues in cache memory manager due to unsafe
> typecasts. The worst one was _jit_cache_extend which was declared
> returning void but used as returning int. Fortunately its return value
> was unused.
>
> I removed virtually all unsafe type handling in cache manager. The patch
> is attached. Now there are no more untyped pointers so that the compiler
> is able to generate warnings/errors.
>
> I used the following technique:
>
> typedef struct _interface_fake *interface_t;
>
> typedef struct _implementation *implementation_t;
> struct _implementation {
>    // ...
> };
>
> static inline interface_t to_interface(implementation_t x);
> static inline implementation_t to_implementation(interface_t x);
>
> Regards,
> Alex



reply via email to

[Prev in Thread] Current Thread [Next in Thread]