MIDLC IDL Compiler

Michael B Allen mba2000 at ioplex.com
Fri Jan 14 07:42:02 GMT 2005


On Fri, 14 Jan 2005 16:23:33 +1100
Andrew Tridgell <tridge at osdl.org> wrote:

> we don't decode it in pieces. You can't do that with signing and sealing.

Good point!

>  > Why not just wait until you have all the data and then run your
>  > marshalling routine once?
> 
> we've been talking at complete cross purposes here. We do only run the
> decoder once. The comment I made was in regard to the limit pointer
> you described in an earlier email. That limit pointer implied to me
> that you had to pre-allocate maximum possible sized buffer.

Oh, duh. Yes, I misunderstood. So by "pre-allocate maximum possible sized
buffer" you mean some arbirary fixed size. No, the limit pointer is just the
end of the data. Or it could be the end of some fixed size buffer if the end
of the data isn't known (which I believe will be the case w/ RPC as the
"Allocation Hint" field isn't terribly useful). The limit pointer is just a
"fence post".

This is good. This means I don't need to do any serious refactoring.

>  > Sure. Actually it should be no surprise that I'm planning on using my
>  > own garbage collection here. I can't be dragging around talloc.
> 
> It's 1k lines of C, and I would be very surprised if it didn't save
> you a lot more than that in generated code size and complexity in the
> compiler.
> 
> I'm afraid that not using talloc would kill any possibility of using
> your compiler in Samba. Converting our code to the hierarchical memory
> model in talloc has reduced the complexity of Samba4 by an _enormous_
> amount, and having to copy all the complex data structures that come
> from unmarshalling a 2nd time to convert all the pointer elements to
> talloc would be an unacceptable burden.

Why would you need to copy objects?

Actually I haven't really thought about freeing objects too much. Right now
I have objects being malloc'd in the decoding rountines and free'd in the
encoding rountines but of course that's not going to work if you bail out
(or choke) in the middle of the call so I need to think about this.

What I should really do is just use user-supplied functions. After all
that's what MIDL does and MIDLC is the "MIDL compatible" IDL compiler. If I
used the following functions could you supply some talloc versions these?
Would that do the trick for you?

    void *rpc_user_allocate(void *context, size_t size, int flags);
    void *rpc_user_reallocate(void *context, void *obj, size_t size);
    int rpc_user_free(void *context, void *obj);

>  > Man I'm just trying to get echo.idl going here. Don't try to sell me
>  > extensions :->
> 
> I'm just trying to save you having to rework stuff later. Pidl would
> have been a lot neater internally if we'd built in the extensions in
> the beginning instead of retrofitting them.

I'm not going to retrofit anything. It's not my style. I believe that what I
have right now will handle a wide variety of IDLs. If it turns out that I'm
wrong then I'll either have to implement the extensions (totally rewriting
the emitter if necessary) or you'll just keep using PIDL.

Mike

-- 
Greedo shoots first? Not in my Star Wars.


More information about the samba-technical mailing list