×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Regular Contributor
    Join Date
    Mar 2010
    Posts
    136

    bytecode verifier

    In the book, it is said that “The bytecode verifier checks the class file to make sure it behaves well and won’t do nasty things to the JVM.”
    When it can be said that the class file does not behaves well and do nasty things?

    Can you please give me an example.

  2. #2
    Super Contributor
    Join Date
    Jun 2003
    Location
    Cheshire, UK
    Posts
    7,395

    Re: bytecode verifier

    The verifier checks that the program is actually a valid program.

    One example: the IADD instruction takes two values off the stack, adds them (as 32 bit integers) and places the result (also a 32 bit integer) back on the stack. The bytecode verifier check the code to make sure that, when the IADD instruction will be executed, the top two items on the stack are 32 bit integers.

    The Java compiler never generates code that is invalid. Invalid bytecode can only occur if you've generated the bytecode using some other tool (say, if you wrote your own compiler).

    The bytecode verifier is not the same as the preverifier. All Java Virtual Machines (ME/SE/EE) have bytecode verifiers, and verify all bytecode that they load before executing any of it. The preverifier utility is unique to CLDC, and generates some extra information to help the bytecode verifier in the VM work quickly. Without this extra information, verification uses a lot of memory and processing power.

    Hope that answers your question.

    Graham.

Similar Threads

  1. Ensymble bytecode compatible
    By danburney999 in forum Symbian
    Replies: 2
    Last Post: 2011-07-19, 08:13
  2. Replies: 5
    Last Post: 2010-01-04, 11:28
  3. Reverse engineer WMLScript bytecode to actual text source?
    By mayur_24 in forum Browsing and Mark-ups
    Replies: 2
    Last Post: 2007-09-27, 06:16
  4. Java bytecode
    By luigi.carabiniere in forum Mobile Java General
    Replies: 0
    Last Post: 2004-02-02, 22:28
  5. Viewing Bytecode?
    By mrmop in forum Mobile Java General
    Replies: 2
    Last Post: 2004-01-09, 23:00

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×