texmacs-dev
[Top][All Lists]
Advanced

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

Re: [Texmacs-dev] How to mark/copy objects in C++


From: Joris van der Hoeven
Subject: Re: [Texmacs-dev] How to mark/copy objects in C++
Date: Tue, 25 May 2004 10:18:28 +0200 (CEST)

On 24 May 2004, Gabriel Dos Reis wrote:
> Joris van der Hoeven <address@hidden> writes:
> | A question for Gabriel: would there be an easy way to implement
> | type-safe marking/copying routines in C++ for all TeXmacs types.
> | Of course, we can manually write such routines for each type,
> | but there might be a more automatic way. What do you think?
>
> The type-safest way I can see at the moment is to make those routines
> part of the types, i.e. virtual functions that must be overriden.  But
> from what I understand you do have lots of those types?

Yes. We especially have many derived types (scrollable_widget,
stack_box, etc.). Of course, we could implement methods "mark"
for all these classes, but that really is cumbersome.

> Alternatively, you can have your compiler dumps the class hierarchies and
> use the ABI to accurately locate objects (not necessary the easiest
> way). For example, if your compiler is GCC, then the ABI is documented
> here
>
>     http://www.codesourery.com/cxx-abi/
>
> (the document unfortunately refers to Itanium 64, but most of the ABI
> is non-specific to that processor).  I do not have an idea about MS
> compilers.  But I suppose, that is a harder option than the previous
> method.

I do not really understand how this works.

> I've seen some TeXmacs fragments that say "new T(...)" -- I just wanted
> to say that allocation of large chuncks are frequently cheeper than
> allocation of lots of small chunks.  Someone would probably have to
> audit that for TeXmacs (the primary reason being that in
> multi-threaded environment -- if you're windowing, then you get such
> beasts -- mutext locks/unlocks are expensive operations).

We have a global new operator which should be very efficient for
small objects (it uses a linked list for each size <= 256 bytes).





reply via email to

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