ANN: C Compiler Update Available

C

cr88192

well, this is a general announce. I have sent it to which groups I think
might be appropriate for this announce...

here is a site with some generic info:
http://cr88192.dyndns.org/bscc.html

and here is the updated compiler (essentially, a project dump):
http://cr88192.dyndns.org/2009-06-02_bscc.zip


it has been a while, but hopefully this is interesting.
note: I make no claims that this is "rock solid" or anything of the sort,
none the less, it could be useful, or at least maybe interesting to look
at...


basic quick summary:
it is a huge mass of code and libraries basically for something amounting to
a C-based VM, but with some work underway to support additional languages
(C++, C#, Java, and ECMAScript at present...). it differs from traditional
compilers in that it does all of the compiling and linking at runtime (and
so, it is possible to compile and run programmatically generated source
fragments, ...).

it also aims to try to avoid what I see as inherent limitations with many
existing VM efforts (such as the JVM and .NET), primarily their tendency to
create centralized and closed worlds (as well as not giving so much
"freedom" as to how the features of the VM itself may be used, ...). so, it
may be compared to a reflective VM, where the code in the VM has access to
all the same machinery making up the VM itself, as well as the mass of
"everything that exists" in good old C land.

it is neither my desire, nor ideal, that people should have to sit around
rewriting or wrapping huge masses of code and libraries to work with some
framework. rather, the framework should be open to a point that none of this
is needed.


a few key poinys:
it is written in C;
the intent is to be modular, and retain compatibility where possible with
existing technologies (as such, ASM, COFF, and ELF, are supported
input/output formats, and GNU-AR is supported for input).
x86 generally works, x86-64 is mostly untested, no other archs at present;
it has a runtime library with many "useful" features;
note that, since the language is C, and the runtimes are all C, all the
runtime stuff can be freely (and typically is) used from good old
statically-compiled C.

I have also been "trying" to keep the code clean (granted, this is secondary
to "make it work"). where appropriate, I have put effort in trying to create
clean and general-purpose APIs. I will comment that both POSIX and OpenGL,
among others, have been notable influences on my API design philosophy...

(secondarily, I want to keep the backend code, at least theoretically,
easily replacable without breaking whatever depends on it...).


it can be noted that the framework gains some ability (via header mining) to
use "reflective" capabilities on good old statically-compiled C, such as
dynamic lookups and access, and the ability to make use of metadata to
perform tasks, such as automatically doing argument marshelling for (mostly)
arbitrary function pointers (similar to a LISP style "apply"), ...

(header mining is used to fill propagate metadata in the "metadata manager",
which at present uses a structure roughly comparable to the 'Windows System
Registry'...).

an object system is provided which is simultaneously capable of:
Multiple Inheritence; Interfaces (different mechanisms from MI); and
Prototype-OO (ability to add fields and methods to individual object
instances). note that the Class/Instance Single-Inheritence + Interfaces is
presently the most optimized (MI and P-OO are not free, and will impact the
objects in question, as well as attempting to dynamically modify runtime
object layout, ...).


as can be noted, it is all "a work in progress".
I have started some work on a new IL, essentially an adapted and highly
stripped-down variant of GIMPLE, for which it could be possible later to
make a GIMPLE bridge (which could allow, among other things, the option of
eventually using LLVM as the backend code generator, ...).
(though uncertain, GIMPLE may be an eventual option for frontend compiler
output, just as is, it is still too high-level for direct use by my codegen
and so would require writing additional "middle end" machinery...).

the new IL would also help clear up some issues thus far preventing my use
of JBC (Java ByteCode), and CIL (.NET's 'Common IL'...).
note that my Java and C# frontends are, at present, being implemented as
full compiler frontends, and not as bytecode bridges.

or such...
 
C

cr88192

cr88192 said:
well, this is a general announce. I have sent it to which groups I think
might be appropriate for this announce...

here is a site with some generic info:
http://cr88192.dyndns.org/bscc.html

and here is the updated compiler (essentially, a project dump):
http://cr88192.dyndns.org/2009-06-02_bscc.zip

apparently I have already gotten a few hits...

however, for unrelated reasons (a sudden "emergency" needing to get a
network printer working again) I just had to change some of my internal
network settings, requiring a router restart, which resulted in a new IP
from the ISP, and a stale DNS...

so, please wait (maybe a few hours or so), for the DNS to flush and
everything to work again...
 
C

cr88192

cr88192 said:
well, this is a general announce. I have sent it to which groups I think
might be appropriate for this announce...

here is a site with some generic info:
http://cr88192.dyndns.org/bscc.html

and here is the updated compiler (essentially, a project dump):
http://cr88192.dyndns.org/2009-06-02_bscc.zip

well, for now at least, things "should" (hopefully) be back up...
oh well, the great pain of dynamic IP addresses sometimes...

(it is working through a web proxy at least...).
 
C

cr88192

cr88192 said:
well, this is a general announce. I have sent it to which groups I think
might be appropriate for this announce...

here is a site with some generic info:
http://cr88192.dyndns.org/bscc.html

and here is the updated compiler (essentially, a project dump):
http://cr88192.dyndns.org/2009-06-02_bscc.zip

I have added a spec to the site:
http://cr88192.dyndns.org/2009-06-02_Meta0.html


this spec basically describes some stuff about the metadata, signature
strings, and linker-level stuff (or, essentially, those things I consider
most relevant to the "architecture"...).

mostly, this info is derived from bunches of text files I have laying
around, where I mostly just grabbed a bunch of stuff and edited it together
into a semi-cohesive spec...
 
J

jacob navia

cr88192 said:
I have added a spec to the site:
http://cr88192.dyndns.org/2009-06-02_Meta0.html


this spec basically describes some stuff about the metadata, signature
strings, and linker-level stuff (or, essentially, those things I consider
most relevant to the "architecture"...).

mostly, this info is derived from bunches of text files I have laying
around, where I mostly just grabbed a bunch of stuff and edited it together
into a semi-cohesive spec...

Mmmmm
"The registers xmm0-xmm7 are free for use and do not need to be preserved."

This is incompatible with Microsoft and lcc-win. Only xmm0-5 are free...
Maybe you should change this?
 
C

cr88192

Boon said:
In the System V ABI, xmm0-xmm15 are NOT preserved across function calls.

http://www.x86-64.org/documentation.html

this statement was specific to my x86 section (not my x86-64 section).
but, yes, the info I had seen was that xmm0-xmm7 were free for use (note
that x86 does not have access to xmm8-xmm15).

IMHO, you're betting on the wrong horse.

yeah, I would have to check MSVC on x86...


I am aware of there being a free/must-preserve disctinction on x86-64, but
it seems for whatever reason my spec failed to document it (though I do
remember specifically implementing this feature in the compiler's
reg-allocator/...).

then again, a lot of this stuff was originally thrown together, and it is
reasonable that there may be holes. one thing (I doubt anyone has noticed),
was that I had not yet documented the exception handling machinery, ...
(then again, I don't think I ever really finished implementing EH
either...).

note, FWIW, XCall on x86-64 is a different calling convention than either
SysV or Win64, and in this case it is allowed (via the powers of stubbing)
that they may disagree on caller/callee save issues...


or such...
 
C

cr88192

jacob navia said:
Mmmmm
"The registers xmm0-xmm7 are free for use and do not need to be
preserved."

This is incompatible with Microsoft and lcc-win. Only xmm0-5 are free...
Maybe you should change this?

I checked, this is only the case with Win64, whereas the relevant statement
is from the section on x86 (AKA, good old 32-bit x86...).

it seems xmm0-xmm7 are freely available in both Windows and Linux on x86
(and xmm8-xmm15 don't exist...).


xmm0-xmm5 are free on Win64, where xmm6-xmm15 are callee preserve.
on AMD64/SysV, xmm0-xmm15 are free...

I am left either option, or custom, for XCall (since either way, stubs are
involved in C/C transfer...).


a quick thought here is that, since the idea of having (some) callee
preserve XMM regs sounds nice, I could make it like this:
xmm0-xmm11 are free;
xmm12-xmm15 are callee preserve...

otherwise, I could probably just leave them all free (my alternative
leaning, IMO Win64 has too many callee preserve regs, which could hurt
pretty bad in computationally-intensive code, since any non-trivial vector
code could easily exhaust the free regs...).

having them all free will leave leave minimal transfer overhead in the
XCall->SysV case;
having some callee preserve regs could allow a little better performance
(for pure XCall code), but could involve a little extra cost in the
XCall->SysV case (namely, needing to preserve the regs in the stub...).


any thoughts, anyone?...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top