News for hackers. Stuff that matters.
Re:Symbolics Genera - The Best Software Environment Available by ScottBurson on Sunday November 07, 2010 @12:13AM (#1878645)
Alas, porting Zeta-C to Common Lisp is not nearly as easy as one might expect. The problem is that a lot of C code makes assumptions about how the compiler is laying stuff out in memory -- for example, code might write a word through an int pointer, then read it back as bytes through a byte pointer. To support this kind of thing, Zeta-C used displaced arrays with different element types onto the same memory locations, which the Symbolics hardware supported but which can't be done in Common Lisp. (It didn't even quite work on the CADR and Lambda, as they were 32-bit machines; it requires that the tag bits be in addition to the low-order 32 bits of a word, as they were on the 36- and 40- bit Symbolics hardware, rather than borrowed from them.)

I suppose, though, that if there's only one chunk of C code you care about compiling this way, there is a chance you could get lucky, in that the code might not do anything that wouldn't work in CL.

Re:Symbolics Genera - The Best Software Environment Available by sedachv on Sunday November 07, 2010 @12:27AM (#1878681)
Yeah, I think you mentioned that before on TUNES or somewhere else. If ints and bytes is the biggest problem, I don't see how that is a big deal - pull the int out of the array and shift/mask it to get the byte. Or am I missing something here? What I was thinking was going to be hard was structs (although most C code tends not to abuse those too much because padding issues tend to be pretty visible disincentives, but then again there's tons of code that does stupid shit that's unknowingly targeted to GCC exclusively).
Re:Symbolics Genera - The Best Software Environment Available by ScottBurson on Sunday November 07, 2010 @12:50AM (#1878724)
pull the int out of the array and shift/mask it to get the byte

The problem is, you would have to be prepared to do this anytime you're dereferencing a byte pointer. You wouldn't know at compile time whether the pointer points into byte-organized or word-organized memory.

You're right about structs, too.

Re:Symbolics Genera - The Best Software Environment Available by sedachv on Sunday November 07, 2010 @01:08AM (#1878751)
I still don't see what the problem is - you know the type of memory array you're referencing into (int, byte, whatever), you know the type of pointer you're dereferencing (byte). So is the problem going to be that it will be slow? In portable CL, yes, but there's always ways to get at the implementation's array-accessing internals and fake type-displaced arrays (esp. if you have control over the internals, as this hypothetical project would).
Re:Symbolics Genera - The Best Software Environment Available by ScottBurson on Sunday November 07, 2010 @01:20AM (#1878837)
Well, that's a good point. In these days of high-quality open-source implementations, games can be played under the covers that would be impossible in portable CL.