Feature request: First class labels

Hasan Aljudy hasan.aljudy at gmail.com
Sat May 5 22:30:50 PDT 2007



Paul Findlay wrote:
> First-class labels (or "labels as values" [1]) would make D a much better
> platform for implementing interpreters. Is there any chance of having
> something like this?

I'm not sure I understand ..
Do you mean like, being able to "increment" labels and move them around?

> 
> It would mean virtual machine execution could be implemented using direct
> threading [2] and make possible all sorts of tricks including using D
> compiler generated executable code for JIT [3]. Direct threading often has
> less branch mis-prediction than using switches to dispatch VM intructions
> [2].
> 
> I don't know the cost of implementing this for DMD, but it needn't introduce
> a new basic type or keywords to the language.. (perhaps labels could be
> typdef'd in std.intrinsics)
> 
> Hope this makes sense (both what I've written and as a feature :) )
> 
>  - Paul Findlay
> 
> 1: http://gcc.gnu.org/onlinedocs/gcc/Labels-as-Values.html
> 2; http://www.complang.tuwien.ac.at/forth/threaded-code.html
> 3: M. Anton Ertl and David Gregg, Retargeting JIT compilers using C-compiler
> generated executable code, in Proceedings of the International Conference
> on Parallel Architectures and Compilation Techniques (PACT 04), pp. 7-14,
> Antibes Juan les Pins, Septmber 2004
> (http://www.complang.tuwien.ac.at/papers/ertl%26gregg04pact.ps.gz)



More information about the Digitalmars-d mailing list