On 12-Oct-12 22:49, Tyler Jameson Little wrote:

That would work too. If scope() is disallowed, it doesn't matter where
the stack comes from. It's only slightly cheaper to reuse the current
stack (CPU), but making a new one would be lighter on memory.

I see nice staff. My use case is optimizing virtual machine, the one
inside std.regex primarily.

Yeah, that is a great example! I've read some bug reports about
std.regex using a ton of memory, especially with CTFE.

Hey, that's dmd (compiler) using a ton of memory,  not std.regex :(
It actually flies with only a modest set of ram after CTFE (or rather 'if') succeeds that is :)

Since regex is by
definition a state machine, this would be a particularly elegant fit
(granted, backreferences et al break that model, but it's still a nice
metaphor).

Yeah, without backreferences it's a state machine. Still it's NFA (non-deterministic) as no DFA would do if you want to get things like captures of sub matches etc. Either way the remarkable giant switch is present ;)


The main problem I see is working with other compilers like GCC/LLVM. If
this can be done on those compilers, I don't see any major hurdle to
getting this implemented.

Perhaps the biggest one would be convincing GCC/LLVM devs to accept patches :)

--
Dmitry Olshansky

Reply via email to