Hacker News new | past | comments | ask | show | jobs | submit login
Java on Playstation 2 (mikekohn.net)
98 points by pjmlp on Sept 17, 2018 | hide | past | favorite | 22 comments



> Java Grinder itself has some.. quirks and some things just missing, kind of mostly due to the fact that I was originally targetting the MSP430 as more of an experimental thing. One thing that was missing was the ability to do memory allocation of objects. I added the ability to instantiate some objects on Playstation 2, mostly with the Draw3D API. I didn't write any kind of memory allocator or garbage collector, so all calls to "new" are being done on the stack. I thought about doing some kind of heap memory allocator thing, but decided in the end to just keep it simple.

!

> I also added more "float" support for Playstation 2 (there was already some support in the Epiphany / Parallella code). Some other things such as "long" and "double" types are still not supported.

!!

Bloody well works though, doesn't it!


> ”it disassembles into assembly source code for real CPUs.”

Another way to describe this functionality is: “compiler”.


more transpiler than compiler...but close enough!


Loved the demo, ended up headbanging to the music.

Java is truly a heavy metal language.


I always felt it was the "elevator musak" of languages.


This makes me want to boot up my PS2 which has an official Sony Linux install. Yep, they did that. They made a Redhat distrib that runs off of DVDs (with a bootable disc), hard disk, ethernet controller, and video that could connect to a monitor. Super fun. I'm not sure I ever accomplished much - you could program the EE, but not run any retail games. Still so neat though! I wish more platforms would have official linux support!


I have one of those as well. Haven't turned it on in almost forever.


I'm not particularly familiar with the Playstation 2, but what's stopping you from running the JVM on it directly?


https://github.com/kaffe/kaffe/blob/master/FAQ/FAQ.ps2linux

Nothing really. It's basically a MIPS CPU with some custom additional SIMD hardware. There's at least one open source JVM implementation that works on PS2 Linux. Sun announced plans to release an official JVM for the PS2 but it never happened. The Dreamcast had a web browser that could run Java applets though.


Just going to throw out there that the Dreamcast didn't have a MIPS, but instead an SH4. You didn't really say that it was, but I just wanted people passing by to know that.


The SH3/4 were cool little chips and had a surprising number of JVMs. Aside from the planetweb implementation on the Dreamcast, IBM had one, there was a cleanroom implementation called Kaffe project, and I had an optimizing JIT in SH4 assembly. Sadly the architecture is little used anymore.


> Sadly the architecture is little used anymore.

It's headed for a resurgence though. See here: https://www.vimore.org/watch/lZGHbMS882w/building-a-cpu-from...


I never knew that the Dreamcast's browser (Phantom) could run Java applets. Looking into this more, it looks like Phantom itself was written in Java.

Fascinating! I had no idea about either back in the day.


I'm guessing the JVM not being implemented for it


My guess is because there is not a JVM for the 'Emotion Engine' used in the PS2

https://en.wikipedia.org/wiki/Emotion_Engine


It'd be neat if someone ported Minecraft


300MHz CPU and 32MB RAM - it's not going to look great or have much draw distance.


Minecraft style games are not really that demanding. Even the DS, with a 67Mhz CPU and 4MB RAM, can run a semi-decent one.

https://github.com/smealum/dscraft


Probably not using a Java VM, but a Minecraft-like game would be doable e.g. using GNU gcj (Java to native code). E.g. the PS2 (32MB RAM + 4MB VRAM, 294MHz R5900 2-way IoE w/ SIMD + 2 x VLIW VUs @294MHz, with massive fillrate capabilities) is more powerful than the PSP (32MB RAM -plus 32MB extra for disc cache in some models- + 2MB VRAM, 2 x R4000 1-way @133-333MHz 1-way IoE -main and aux-), and there is a Minecraft clone for it called "Lamecraft" [1] :-)

[1] https://www.youtube.com/watch?v=J9zIb0zVFfQ&t=1m


gcj does not do what you think it does. It compiles ahead of time, so you get rid of the startup time and the warm-up time that plagues Java applications. But the code produced is just as GC-happy and memory-intensive as before. So the steady-state performance of gcj binaries vs JVM-run .class files are about the same (or somewhat worse for gcj binaries).


The performance of gcj would have to be equal or worse than the jvm almost by definition as it would lack the ability to do optimization at runtime in the way the HotSpot VM does.


Except for AFAIK there is no HotSpot VM port to MIPS, and gcj was well supported there.




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: