To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 4810
4809  |  4811
Subject: 
Re: Something else is needed, I think...
Newsgroups: 
lugnet.robotics
Date: 
Tue, 4 May 1999 00:35:42 GMT
Original-From: 
John A. Tamplin <jat@/StopSpammers/liveonthenet.com>
Viewed: 
1345 times
  
On Mon, 3 May 1999, Kekoa Proudfoot wrote:

Regarding 2), this is a given, everybody wants the byte code to be
compact.  Can you shed any light into how Java is made compact?  Is it
something non-obvious and different from the standard byte code, and if so,
how is it different?

For reference, the JVM specification is available online at this URL:
  http://java.sun.com/docs/books/vmspec/index.html

There are several features that promote compactness:

1) it is a stack-based bytecode.  Operands are pushed onto the stack,
a bytecode is executed, and results are pushed onto the stack.

2) it is a relatively high-level bytecode.  For example, calling a
particular member function on an object is a single bytecode.  Other
ways this impacts compactness are types are represented as indexes into
a table, references to the Class object, etc.  Since the interpreter keeps
various tables of these things outside the bytecode, the bytecode doesn't
have to encode how to find them.

3) there are "quick" versions of many bytecodes that include a small
constant in the bytecode itself, saving a separate push instruction.

4) the synchronization model has a very simple representation in the
bytecode.

Regarding 3), these are nice features.  With regards to threading, how does
the JVM support this feature?  How is it exposed in the byte code?  I am
particularly interested what the JVM thinks is the state associated with a
single thread (e.g. a stack, a PC, etc.).

I want to be careful what I describe from the JDK source, since the license
says I can't give it to anyone else.  You can download your own copy for
free (you have to register and agree to the license which basically says
you can use it for research purposes for free and you have to get their
permission to distribute it).

The context of a thread reachable by a Java program includes the name,
priority, a queue, some debugging information, and various access control
information.  The runtime uses the native thread implemention (which
typically will maintain a separate stack and per-thread variables used by
the OS such as errno) as well as an execution environment (which contains
a frame stack, value stack, exception handling, GC hints, monitor cache).

There are bytecodes to obtain a monitor on an object, and to release it.
The java.lang.Thread object has methods for notification, waiting, sleeping,
etc.  The methods in a class that require synchronization are marked with
the synchronized keyword, which is noted in the class structure and then
used during code generation for calls to these methods.

Regarding 4), this is a nice goal.  I think it's straightforward in
principle to understand.

It does mean that the bytecode has to be high-level enough to not obscure
concepts like arrays and types.

John A. Tamplin Traveller Information Services
jat@LiveOnTheNet.COM 2104 West Ferry Way
256/705-7007 - FAX 256/705-7100 Huntsville, AL 35801

--
Did you check the web site first?: http://www.crynwr.com/lego-robotics



Message has 1 Reply:
  Re: Something else is needed, I think...
 
I say let us go ahead and make this JVM for the RCX. I am in, Any other volunteers? As I have previously announced (in the LegOS) group that I was going to do this one person has already agreed to volunteer. As a side note take a look at: (URL) (...) (25 years ago, 4-May-99, to lugnet.robotics)

Message is in Reply To:
  Re: Something else is needed, I think...
 
(...) So this is a nice start at least. Regarding things you like, I'm going to ignore 1) and 6) because they are not features of byte code, they are features of Java; you either use the JVM and you get them, or you do not use the JVM and you do not (...) (25 years ago, 3-May-99, to lugnet.robotics)

67 Messages in This Thread:






















Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact

This Message and its Replies on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR