Thread overview | ||||||||
---|---|---|---|---|---|---|---|---|
|
January 17, 2008 Indirect jumps | ||||
---|---|---|---|---|
| ||||
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. |
January 17, 2008 Re: Indirect jumps | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christian | > I would like to implement a direct threaded interpreter and I need support for indirect jumps > does 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 |
January 17, 2008 Re: Indirect jumps | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christian | 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 |
January 18, 2008 Re: Indirect jumps | ||||
---|---|---|---|---|
| ||||
Posted in reply to DQNOK | > 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.
|
January 18, 2008 Re: Indirect jumps | ||||
---|---|---|---|---|
| ||||
Posted in reply to Paul Findlay |
> Unfortunately no. Past conversation: http://www.digitalmars.com/d/archives/digitalmars/D/Feature_request_First_class_labels_53208.html
Thanks, 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.
|
January 18, 2008 Re: Indirect jumps | ||||
---|---|---|---|---|
| ||||
Posted in reply to Christian | 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 |
Copyright © 1999-2021 by the D Language Foundation