> Same compiler, same class codes.
> As I said, Jbed throw the exception immediatly when entering the
> method.
>
> /Kid
Thanks for the information Mark & Seungil.
Mark,
> You could possibly rewrite the code to use .forName to look for the one missing
> class and catch the exception for classNotFoundError and load the other
> similarly with .forName in the exception handler block.
I've been thinking of doing this, but that would mean to use the
reflect classes and I'm not sure how much this package is supported.
Also, there are too many places this has to be done! ;)
What does verification mean? That the VM checks if the method is valid
before executing it? Exactly what is checked?
> You may want to hack a .class file to make it invalid and see if the Jeode
> VM rejects it. A verification error can easily be induced by reducing the
> max stack depth for a method. There are plenty of public bytecode
> assemblers to use if you need and there are many .class file
> viewers/disassemblers too.
Sounds interesting. I haven't handled java bytecode before.
Do you have any recommendations for bytecode assembles, viewers?
> Another test would be to try and run the class
> on Sun's VM - as the definition of what is correct, the result there should
> be a good indication of the correct action. The Sun JRE is easy to find
> and download if you don't have it already.
I've tried it on the Sun's 1.5 JRE and it runs without any exceptions.
Haven't tried it on older jre though (1.3 should be equal to JME CDC).
Seungil,
I think it's a performance issue too. But if this is the case, it means
that a lot of "useless" classes are preloaded, and they won't even be
referenced! This is a waste of both time and memory!
I've tried to contact Esmertec but haven't got any replies yet. Seems
like they are very hard contact unless you are a PDA manufacturer and
have alot of cash!
Insignia, who owned Jeode before Esmertec, was much easier to reach.
By the way, anyone know where I can find a "changes" list for
Jeode/Jbed?
Because I've noticed some other significant differences!
I thought that one should be able to run Jeode applications straight
over on Jbed, since Jbed is a superset of Jeode. But this is not, by
far, the case!
Regards,
/Kid
Mark Bottomley - 30 Jun 2005 02:26 GMT
> Thanks for the information Mark & Seungil.
>
[quoted text clipped - 7 lines]
> reflect classes and I'm not sure how much this package is supported.
> Also, there are too many places this has to be done! ;)
I don't think it is a reflection activity - it is part of java/lang/class.
(I could be wrong as I'm a VM programmer, not a Java guru)
> What does verification mean? That the VM checks if the method is valid
> before executing it? Exactly what is checked?
Verification is what makes the Java language safe - it has several parts:
1) take a bag of bytes and see if it smells like a .class file. Things that
are checked include things like CAFEBABE as the first four bytes,
legal access flag combinations, legal constant pool formation, etc. The
bag of bytes must have no left over bytes and must be complete. The
failure of an checks at this stage usually result in a ClassFormatError.
2) take the possible .class file and check the gory details with data flow
analysis of the methods. The stack must never overflow/underflow, the
bytecode data must be of the correct type e.g. iadd must find 2 integers
on the top of the stack and it will leave 1 integer. Failures typically
result
in a VerifyError.
3) load any referenced classes for visibility to check legal method calls,
visibility constraints and availability. Failures could be VerifyErrors or
some other types. This can caused nested verification as parent
classes must be loaded before child classes can complete verification.
4) runtime checks of things like Null pointers, division by 0, and array
bounds violations are checked. These result in the appropriate
exception.
For most of the details, see the JVM spec chapter 4. 4.1 to 4.7
describe a .class file, 4.8 contains most of the things checked for
by verification, 4.9 gives an overview of the verification sequence.
4.10 contains some more verification checks.
Verification can usually be enabled/disabled (depending on the vendor's
default) with command line options like -verify or -noverify. Using an
empty java command line will often give you a subset of the acceptable
options.
>> You may want to hack a .class file to make it invalid and see if the
>> Jeode
[quoted text clipped - 5 lines]
> Sounds interesting. I haven't handled java bytecode before.
> Do you have any recommendations for bytecode assembles, viewers?
Unfortunately, the tools I use are in-house tools, but there are several
public domain java assemblers and javap is Sun's disassembler
available in the JDK.
>> Another test would be to try and run the class
>> on Sun's VM - as the definition of what is correct, the result there
[quoted text clipped - 4 lines]
> I've tried it on the Sun's 1.5 JRE and it runs without any exceptions.
> Haven't tried it on older jre though (1.3 should be equal to JME CDC).
If it is passing through Sun's 1.5 JRE, it is probably valid code.
> Seungil,
> I think it's a performance issue too. But if this is the case, it means
[quoted text clipped - 15 lines]
> Regards,
> /Kid
Mark...