digitalmars.D - Indirect jumps
- Christian (12/12) Jan 17 2008 Hi,
- Paul Findlay (3/6) Jan 17 2008 Unfortunately no. Past conversation:
- Christian (3/5) Jan 18 2008 Thanks, I have read this conversation.
- DQNOK (5/5) Jan 17 2008 And nested functions won't do the trick? I kind of thought that
- Christian (2/6) Jan 18 2008 I will study this possibility. But I think that it is not possible, beca...
- bearophile (4/4) Jan 18 2008 Christian Wrote>I think that it is not possible, because the functions a...
Hi, I would like to implement a direct threaded interpreter and I need support for indirect jumps. I know how to make this in gcc using label references (operator &&): void interp() { void *labelref = &&mylabel; goto *labelref; mylabel: ... } does dmd or gdc support this ? I can't use delegates or function pointers since i need the best performance possible (without using assembler). Thanks in advance, Christian.
Jan 17 2008
I would like to implement a direct threaded interpreter and I need support for indirect jumpsdoes dmd or gdc support this ?Unfortunately no. Past conversation: http://www.digitalmars.com/d/archives/digitalmars/D/Feature_request_First_class_labels_53208.html - Paul
Jan 17 2008
Unfortunately no. Past conversation: http://www.digitalmars.com/d/archives/digitalmars/D/Feature_request_First_class_labels_53208.htmlThanks, I have read this conversation. I don't understand how a modern language like D don't support first class labels or something like this that permits make portable interpreters or dynamic recompilation using inlined direct threading. Christian.
Jan 18 2008
And nested functions won't do the trick? I kind of thought that is what nested functions were for: the ability to access local variables without the overhead of pushing pointers to all of them onto the stack. david
Jan 17 2008
And nested functions won't do the trick? I kind of thought that is what nested functions were for: the ability to access local variables without the overhead of pushing pointers to all of them onto the stack.I will study this possibility. But I think that it is not possible, because the functions are called through indirection. The pointer to the function would be saved to memory and then would be called using this pointer, then how know the compiler that this call is for a nested function?. Christian.
Jan 18 2008
Christian Wrote>I think that it is not possible, because the functions are called through indirection. The pointer to the function would be saved to memory and then would be called using this pointer, then how know the compiler that this call is for a nested function?< I think D delegates may help. And true closures of D 2.x may solve other problems left. Bye, bearophile
Jan 18 2008