Compiling Java for the Propeller
My spare time is pretty limited these days -- work takes up a lot of it. On the up-side, I got promoted.
Over the past few months, some of my spare time has been spent designing a Java compiler that targets the Parallax Propeller. A few hand-coded mockups have convinced me that it's feasible -- the only thing between that and making it a reality are the past 50 years of compiler research, which I never learned. :-)
So, I've spent time surfing Citeseer and gathering data. Between what I've learned and my Propeller experience, I've set some parameters for the first version: it will compile to Large Memory Model code rather than a custom interpreter, and will consume Java class files.
As of this evening I've got a prototype working, and have compiled/assembled/uploaded my first binary. The bullet points are as follows:
Here's sample input and output from one of my test suites
And the output, in propasm syntax (a superset of Parallax):
The "call #prim_foo" instructions are calls to LMM kernel traps; plenty of other people have explained Propeller LMM in detail elsewhere, I won't repeat it. My code generator inlines LMM primitives in some cases, as it's done with jump here.
Some details of the calling conventions are apparent in the output: incoming arguments start at r0, and the returned value comes back in r0. These registers are real-live Propeller registers inside the LMM kernel, and I suspect I'll have room for a lot of them -- 32 or more -- so I'm using a RISC-like register calling convention, with link register.
Assuming work doesn't interfere, I'll post more as it develops.
Over the past few months, some of my spare time has been spent designing a Java compiler that targets the Parallax Propeller. A few hand-coded mockups have convinced me that it's feasible -- the only thing between that and making it a reality are the past 50 years of compiler research, which I never learned. :-)
So, I've spent time surfing Citeseer and gathering data. Between what I've learned and my Propeller experience, I've set some parameters for the first version: it will compile to Large Memory Model code rather than a custom interpreter, and will consume Java class files.
As of this evening I've got a prototype working, and have compiled/assembled/uploaded my first binary. The bullet points are as follows:
- Converts Java 6 JVML to n-address linear IR using abstract evaluation. Assumes input is verifiable, which lets me skip some checking. (Why Java 6? Because it generates nice frame attributes and doesn't use jsr.)
- Operates almost exclusively in SSA (actually CSSA).
- Performs register allocation in SSA form, using a crippled-but-developing version of Pereira's algorithm. I've modified it to deal more gracefully with the Propeller's CISC-like two-address architecture.
- Provides limited scalar optimizations -- the ones I've gotten around to writing. Copy folding, constant propagation, jump-to-flow-control elimination, etc.
- Fantastically crappy code generator for now -- literally
printf
-based with no intelligent layout or peephole optimizations, as you'll see in the samples below. - None of the fun stuff, like garbage collection, works yet.
Here's sample input and output from one of my test suites
public class Input0 {
public int function(int x) {
int y = 0;
while (y < x) {
y ++;
}
return y;
}
}
And the output, in propasm syntax (a superset of Parallax):
method_function
L12893404
mov r2, #0
rdlong PC, PC ' inlined jmp
long @@L23063136
L26210109
add r2, #1
rdlong PC, PC ' inlined jmp
long @@L23063136
L23063136
' [int r2:1] <- phi ssa.BasicBlock@c4bcdc:[int c0:0] ssa.BasicBlock@18fef3d:[int r2:2]
cmps r2, r1 wc wz
call #prim_lt
long @@L26210109
long @@L25763215
L25763215
mov r0, r2
call #prim_return
The "call #prim_foo" instructions are calls to LMM kernel traps; plenty of other people have explained Propeller LMM in detail elsewhere, I won't repeat it. My code generator inlines LMM primitives in some cases, as it's done with jump here.
Some details of the calling conventions are apparent in the output: incoming arguments start at r0, and the returned value comes back in r0. These registers are real-live Propeller registers inside the LMM kernel, and I suspect I'll have room for a lot of them -- 32 or more -- so I'm using a RISC-like register calling convention, with link register.
Assuming work doesn't interfere, I'll post more as it develops.
5 Comments:
This comment has been removed by the author.
By
Register web domain, at 2:23 AM
I personally thought this was one of the top 1 million blog posts that I have ever read, keep up the fabulous work.vietnamese brides
By
chinese girl, at 10:26 PM
penyebab kemaluan keluar cairan nanah cara mengobati kemaluan keluar nanah kemaluan keluar nanah di sertai perih saat kencing mengobati kemaluan keluar nanah pada pria mengobati kemaluan keluar cairan nanah pada pria mengobati kelamin keluar nanah mengobati kemaluan pria yang keluar nanah nanah keluar dari kemaluan cairan nanah keluar dari kemaluan obat cairan nanah keluar dari kemaluan obat untuk cairan nanah yang keluar dari kemaluan obat ujung kemaluan keluar nanah obat ujung kemaluan keluar cairan nanah cara mengobati ujung kemaluan keluar nanah ujung kemaluan keluar nanah di sertai perih saat kencing penis keluar cairan nanah dan kencing perih penyebab penis keluar nanah cara mengobati penis keluar nanah obat alat kelamin keluar nanah obat cairan nanah keluar dari kemaluan obat cairan nanah keluar dari kemaluan mengapa kemaluan keluar nanah cara mengobati kemaluan keluar nanah obat kemaluan keluar nanah
By
wasirdenature, at 9:50 PM
This information is impressive; I am inspired with your post writing style & how continuously you describe this topic.
Pawn Shop
Pawn Loans
Pawn Shops
Pawn Loan
Pawn Shop near me
By
Isabella Olivia, at 11:47 AM
This article is very helpfull. I was looking for this info and it will help me on my business. thanks a lot
Hadoop Training Institute in Noida
By
CIIT Noida, at 12:23 AM
Post a Comment
<< Home