Author Topic: nJava - Nspire JVM  (Read 17762 times)

0 Members and 1 Guest are viewing this topic.

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: nJava - Nspire JVM
« Reply #15 on: February 01, 2012, 02:21:05 am »
I think the point is that its very badly documented, making it much harder to do something with it :)

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nJava - Nspire JVM
« Reply #16 on: February 01, 2012, 02:24:04 am »
Exactly: hardly anybody uses Jazelle because it's badly documented :)

Java ME can be unpleasant to use: lots of Java 1.4, 5, 6 and 7 goodies (both in terms of language features and in terms of class library), which people have enjoyed for years on Java SE, are not available.
« Last Edit: February 01, 2012, 02:40:41 am by Lionel Debroux »
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline calc84maniac

  • eZ80 Guru
  • Coder Of Tomorrow
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2912
  • Rating: +471/-17
    • View Profile
    • TI-Boy CE
Re: nJava - Nspire JVM
« Reply #17 on: February 01, 2012, 02:30:58 am »
* calc84maniac points at http://ourl.ca/8791
"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nJava - Nspire JVM
« Reply #18 on: February 01, 2012, 02:45:37 am »
Oh yeah, forgot about that topic :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline DJ Omnimaga

  • Clacualters are teh gr33t
  • CoT Emeritus
  • LV15 Omnimagician (Next: --)
  • *
  • Posts: 55942
  • Rating: +3154/-232
  • CodeWalrus founder & retired Omnimaga founder
    • View Profile
    • Dream of Omnimaga Music
Re: nJava - Nspire JVM
« Reply #19 on: February 01, 2012, 02:48:22 am »
Java would be nice on the Nspire since a bunch of people know this language and this might increase the Nspire programmer audience considerably, although of course it won't be even close to Ndless (and maybe Lua?) performance.
Now active at https://discord.gg/cuZcfcF (CodeWalrus server)

Offline jwalker

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 660
  • Rating: +13/-0
  • Almost everything I have released includes a 'WZ'
    • View Profile
Re: nJava - Nspire JVM
« Reply #20 on: February 01, 2012, 08:04:46 am »
thats my only real worry
<a href="http://www.nerdtests.com/ft_cg.php?im">
<img src="http://www.nerdtests.com/images/ft/cg.php?val=9612" alt="My computer geek score is greater than 41% of all people in the world! How do you compare? Click here to find out!"> </a>

Support Casio-Scene against the attacks of matt @ matpac.co.uk ! For more information: Casio-Scene shuts down & Matt actions threads

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: nJava - Nspire JVM
« Reply #21 on: February 01, 2012, 09:24:52 am »
Hopefully the performance won't be too insufferable. As of right now, I just want Java to be an option one can choose for making programs and apps for the Nspire. Once that's accomplished we can work on optimizing and speeding up the JVM.

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline Goplat

  • LV5 Advanced (Next: 300)
  • *****
  • Posts: 289
  • Rating: +82/-0
    • View Profile
Re: nJava - Nspire JVM
« Reply #22 on: February 01, 2012, 03:04:00 pm »
Java would be nice on the Nspire since a bunch of people know this language and this might increase the Nspire programmer audience considerably, although of course it won't be even close to Ndless (and maybe Lua?) performance.
Running Java code is generally faster than running Lua code, because of the type information available to the JVM. Take object field accesses for example - in Java, if you have a variable "Rectangle r", the JVM knows at class-loading time that it points to a Rectangle object, and therefore can determine in advance what location within the object will be accessed in an expression like "r.width". In an untyped language like Lua, on the other hand, fields have to be looked up by name at run-time every time they're accessed, which is much slower.

The main problem with Java isn't its execution speed, it's its size. JamVM brags about its executable being only 200KB, but how much memory does it use, and how big is the required class library? Porting the class library could also be a lot of work. I was considering porting the CLDC reference implementation (a Java environment with a much smaller class library) a while ago, after I had found out about Jazelle, but never did anything substantial to that end.
Numquam te deseram; numquam te deficiam; numquam circa curram et te desolabo
Numquam te plorare faciam; numquam valedicam; numquam mendacium dicam et te vulnerabo

Offline Lionel Debroux

  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2135
  • Rating: +290/-45
    • View Profile
    • TI-Chess Team
Re: nJava - Nspire JVM
« Reply #23 on: February 01, 2012, 03:54:53 pm »
IIRC, the significantly incomplete GNU Classpath library is megabytes large, and the standard (OpenJDK) classpath, which JamVM is not supposed to support, is of course much worse.
CLDC, and J2ME are much smaller in general indeed... but also quite a bit less fun to program.
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TILP and TIEmu.
Co-admin of TI-Planet.

Offline willrandship

  • Omnimagus of the Multi-Base.
  • LV11 Super Veteran (Next: 3000)
  • ***********
  • Posts: 2953
  • Rating: +98/-13
  • Insert sugar to begin programming subroutine.
    • View Profile
Re: nJava - Nspire JVM
« Reply #24 on: February 04, 2012, 04:49:25 am »
A good analogy of what you could expect for performance would be:
For 84+, BASIC < Hybrid BASIC/BBC < Axe < Asm
For Nspire, BASIC < Lua < Java < C

(Java's limitations compared to C are different than Axe's compared to Asm, but they basically come to the same concept: Lower level programming is faster. Higher Level programs add bulk and slow stuff down. It's the ever-present trade-off in tech of work vs performance, but Java gains cross-compatibility as a bonus)

After all, that lua interpreter was written by TI. If anything it would be worse than the standard implementation, making it a wider gap.

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: nJava - Nspire JVM
« Reply #25 on: February 04, 2012, 11:41:15 am »
I'm also hoping that coding in Java will be easier than C for the Nspire. (I don't know why, but C with the Nspire SDK seems confusing... Perhaps it's just me though) :P

Hopefully standard Java will be supported and even games already written can be run.

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...

Offline ExtendeD

  • CoT Emeritus
  • LV8 Addict (Next: 1000)
  • *
  • Posts: 825
  • Rating: +167/-2
    • View Profile
Re: nJava - Nspire JVM
« Reply #26 on: February 04, 2012, 11:51:30 am »
If anything can be done to improve the native SDK, I'm open to your suggestions.
Ndless.me with the finest TI-Nspire programs

Offline Jim Bauwens

  • Lua! Nspire! Linux!
  • Editor
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1881
  • Rating: +206/-7
  • Linux!
    • View Profile
    • nothing...
Re: nJava - Nspire JVM
« Reply #27 on: February 04, 2012, 02:56:56 pm »
After all, that lua interpreter was written by TI. If anything it would be worse than the standard implementation, making it a wider gap.
The interpreter itself is not written by TI, they just added some modules and made it event based (Not hard to do that at all).
They implemented it as many other games/programs do.

Offline AngelFish

  • Is this my custom title?
  • Administrator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3242
  • Rating: +270/-27
  • I'm a Fishbot
    • View Profile
Re: nJava - Nspire JVM
« Reply #28 on: February 04, 2012, 06:43:53 pm »
Hello.

As you can guess my the title, I am starting a project to port a Java Virtual Machine to the Nspire.

So far I have found an open sourced JMV here

http://jamvm.sourceforge.net/

That I believe can be ported to the Nspire. It is also written almost entirely in C so I think that'll help.

What I want to do is basically be able to take any Java byte code, and be able to run it on the Nspire. (Possible Minecraft, anyone?) :P

However, I don't know where to start with this project. I downloaded the source for the JVM and found the main file, however I do not know what I need to do to port it to the Nspire.

I hope that this can become a community project where anyone can contribute, because if it were only myself, it might never come to fruition, which would be a shame.

So, first question, where do I start? ExtendeD suggested to me earlier to try to compile the project as is using the Ndless SDK to see what dependencies aren't supported, although I don't know what I should make for a makefile to do that.

First, understand precisely what a JVM is and how it works.
That means you need to read the Sun Spec for the Java VM. It will be invaluable for understanding the logic behind some of the superficially "WTF?" decisions that appear in the VM. Also, try to get your hands on the book "Inside the Java Virtual Machine." It's not quite as useful as the spec itself, but the depth it goes into can occasionally be helpful and it explains some of the algorithms used in the sun implementation, something the spec deliberately avoids doing.

Also, get comfortable with optimization and low level programming. They're the heart of a good VM.

Perhaps most importantly, understand the code you're trying to use as if you had written it yourself. If you're going to be maintaining it, then you'll quickly see why that's such a good idea.

So, long story short: Writing/porting a JVM is a very good way to learn precisely how much you don't know. You'll come out of it a better programmer either way and I highly recommend attempting it for the learning experience, even if you never manage to fully port it. If you do manage to fully port it, then I love you :D
∂²Ψ    -(2m(V(x)-E)Ψ
---  = -------------
∂x²        ℏ²Ψ

Offline Scipi

  • Omni Kitten Meow~ =^ω^=
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1547
  • Rating: +192/-3
  • Meow :3
    • View Profile
    • ScipiSoftware
Re: nJava - Nspire JVM
« Reply #29 on: February 04, 2012, 06:46:47 pm »
Ok, thanks. I'll definitely do that then. If all else fails, I can probably get quite a bit of help from my College professors as well if any of them are interested in assisting me. :D

Imma Cat! =^_^= :3 (It's an emoticon now!)
Spoiler For Things I find interesting:
Spoiler For AI Programming:
Spoiler For Shameless advertising:

Spoiler For OldSig:





Spoiler For IMPORTANT NEWS!:
Late last night, Quebec was invaded by a group calling themselves, "Omnimaga". Not much is known about these mysterious people except that they all carried calculators of some kind and they all seemed to converge on one house in particular. Experts estimate that the combined power of their fabled calculators is greater than all the worlds super computers put together. The group seems to be holding out in the home of a certain DJ_O, who the Omnimagians claim to be their founder. Such power has put the world at a standstill with everyone waiting to see what the Omnimagians will do...

Wait... This just in, the Omnimagians have sent the UN a list of demands that must be met or else the world will be "submitted to the wrath of Netham45's Lobster Army". Such demands include >9001 crates of peanuts, sacrificial blue lobsters, and a wide assortment of cherry flavored items. With such computing power stored in the hands of such people, we can only hope these demands are met.

In the wake of these events, we can only ask, Why? Why do these people make these demands, what caused them to gather, and what are their future plans...