D, Java? To D or not to D?
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Fri Jan 5 14:33:41 PST 2007
Walter Bright wrote:
> TPJ wrote:
>> 1) In order to run a program written in D I have to compile it on the
>> target OS.
>
> I haven't talked about this much, but it is technically feasible to
> create a D runtime that enables "compile once, run everywhere". It is
> not necessary to have a VM to do it.
How would you implement a garbage collector in an
architecture-independent way?
Or are you talking about using version(arch_1) to version(arch_N)? [1]
Because I'm pretty sure the garbage collector has to know some
architecture-specific things. Start of stack, direction of stack,
location of static data, threading API (if any), that sort of thing.
So you'd need to perform at least _some_ porting to get it to run on a
new architecture, if only to tell the GC what its properties are.
Though I guess stack direction could be experimentally determined at
runtime/install time, as could endianness... Threading API is going to
be hard to determine in that way, I'd think.
[1] or "version(StackGrowsUp), version(BigEndian), version(HasFeatureX),
version(HasFeatureY), ..." or something like that.
More information about the Digitalmars-d
mailing list