Re: Making regex replace CTFE by removing malloc
Pierre Krafft via Digitalmars-d Mon, 06 Apr 2015 16:51:06 -0700
I got some help from the IRC, poked the code a bit and have some
details I can share. The code uses a reference counted memory
pool, that's the part I linked. It's possible to avoid the malloc
but that's not the hard part. For me it looks like memory pools
aren't compatible with CTFE. This is because CTFE disallows most
pointer casts.
Allocations and frees have fortunately been moved to common
functions so it should be possible to change the allocation code
without too much hassle. I would prefer to have the same code for
runtime and CTFE, but for performance reasons that might not be
possible if CTFE has a too limited feature set.
I think a good idea would be to extract the memory pool code out
of the regex module. It's not a core part of the problem and
could be reused elsewhere. Having something named memory pool
would also make the code clearer. It might be impossible to
implement memory pools at CTFE so we could hide that detail away
by simulating a memory pool (at CTFE) until it becomes possible.
The code in general is quite clear, but low level and more about
how to do it than what to do. This is not the D-style I know and
love, but it might be needed for performance. Therefore I
probably won't be the one that starts the implementation of this,
but I will try to help if someone more experienced in this kind
of code takes action.
- Making regex replace CTFE by removing m... Pierre Krafft via Digitalmars-d
- Re: Making regex replace CTFE by r... ketmar via Digitalmars-d
- Re: Making regex replace CTFE ... Pierre Krafft via Digitalmars-d
- Re: Making regex replace CTFE ... Pierre Krafft via Digitalmars-d
- Re: Making regex replace C... ketmar via Digitalmars-d
- Re: Making regex repla... Pierre Krafft via Digitalmars-d
- Re: Making regex ... ketmar via Digitalmars-d
- Re: Making regex ... Dmitry Olshansky via Digitalmars-d
- Re: Making regex replace CTFE ... Jakob Ovrum via Digitalmars-d
- Re: Making regex replace C... ketmar via Digitalmars-d
