harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Harmony Wiki] Update of "JVM Implementation Ideas" by ArchieCobbs
Date Tue, 24 May 2005 14:52:49 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Harmony Wiki" for change notification.

The following page has been changed by ArchieCobbs:
http://wiki.apache.org/harmony/JVM_Implementation_Ideas

------------------------------------------------------------------------------
- 
  This is a list of various useful design ideas and implementation
  tricks that may be desirable to include in Harmony.
  
  = Per-class loader memory areas =
  
+  * Idea: class loaders and all their defined classes are unloaded all at once. Memory is
allocated and not freed until that happens, so allocation behavior is stack-like. Instead
of using the more general and therefore costly malloc() or the Java heap for class loader
specific memory, use a lighter weight, stack like memory subsystem. In addition, all java.lang.Class
objects can be stored in per-class loader memory instead of in the normal heap, reducing work
for the GC subsystem.
- * Idea: class loaders and all their defined classes are unloaded
- all at once. Memory is allocated and not freed until that happens,
- so allocation behavior is stack-like. Instead of using the more
- general and therefore costly malloc() or the Java heap for
- class loader specific memory, use a lighter weight, stack like
- memory subsystem.
- * Advantages: more efficient, makes class loader unloading easier
+  * Advantages: more efficient, makes class loader unloading easier
- * Disadvantages: none
+  * Disadvantages: if java.lang.Class objects are stored in per-loader memory, their references
must be tracked manually.
- * Origin: SableVM
+  * Origin: SableVM
  
  = Bi-directional object layout =
  
+  * Idea: let objects' primitive fields grow upward from the object head and let reference
fields grow downward from the object head. Object pointers pointing to objects themselves
containing object references therefore point into the middle of the object's memory area.
+  * Advantages: all object references are contiguous, which makes following these references
during garbage collection, etc. easier and simpler.
+  * Disadvantages: object head (lockword, vtable pointer, etc) is not necessarily at the
beginning of an object's memory area, which can mean extra work to find the head when iterating
through the heap e.g. during mark/sweep GC.
- * Idea: let objects' primitive fields grow upward from the object
- head and let reference fields grow downward from the object head.
- Object pointers pointing to objects themselves containing object
- references therefore point into the middle of the object's memory
- area.
- * Advantages: all object references are contiguous, which makes
- following these references during garbage collection, etc. easier
- and simpler.
- * Disadvantages: object head (lockword, vtable pointer, etc)
- is not necessarily at the beginning of an object's memory area,
- which can mean extra work to find the head when iterating through
- the heap e.g. during mark/sweep GC.
- * Origin: SableVM
+  * Origin: SableVM
  
  = Spinless thin-locks =
  
+  * Idea: compare-and-swap instruction used to grab an object lock in the common case of
no contention, otherwise fall back to mutexes.
- * Idea: compare-and-swap instruction used to grab an object lock
- in the common case of no contention, otherwise fall back to mutexes.
- * Advantages: very efficient
+  * Advantages: very efficient
- * Disadvantages: some assembly required
+  * Disadvantages: some assembly required
- * Origin: lots of people. SableVM has a nice version of this algorithm.
+  * Origin: lots of people. SableVM has a nice version of this algorithm.
  
+ = SableVM thread state tracking =
+ 
+  * Idea: use compare-and-swap to transition threads from running in Java mode vs. running
in native mode, and to detect a "stop the world" operation. When a Java thread goes into "native
mode", i.e., it invokes a JNI function or some other blocking system call like pthread_cond_wait(),
it has to detach itself in some sense from the JVM so that the JVM doesn't get stuck waiting
indefinitely for it to return.
+  * Advantages: efficient implementation
+  * Disadvantages: none known\
+  * Origin: SableVM
+ 

Mime
View raw message