Main Page | Namespace List | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

gc_stub.c File Reference


Detailed Description

JVM stub garbage collector, performs role of System.gc() .

The logic of these structures and functions is empty, pending a memory allocation and garbage collection design for the project.

This is the first of hopefully a number of garbage collection schemes. Others should be named gc_somename.c .

The common header file gc.h defines the prototypes for all garbage collection implementations by way of the CONFIG_GC_TYPE_xxx symbol definitions.

Control

$URL: https://svn.apache.org/path/name/gc_stub.c $ $Id: gc_stub.c 0 09/28/2005 dlydick $

Copyright 2005 The Apache Software Foundation or its licensors, as applicable.

Licensed under the Apache License, Version 2.0 ("the License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

See the License for the specific language governing permissions and limitations under the License.

Version:
$LastChangedRevision: 0 $
Date:
$LastChangedDate: 09/28/2005 $
Author:
$LastChangedBy: dlydick $ Original code contributed by Daniel Lydick on 09/28/2005.

Reference

Definition in file gc_stub.c.

#include "arch.h"
#include "jvmcfg.h"
#include "classfile.h"
#include "jvm.h"

Go to the source code of this file.

Data Structures

struct  gc_class_stub
 Type definition for references to garbage collection in Java classes. More...
struct  gc_object_stub
 Type definition for references to garbage collection in Java objects. More...
struct  gc_stack_stub
 Type definition for references to garbage collection in Java stacks. More...

Functions

rboolean gc_class_delete_stub (jvm_class_index clsidxOLD, rboolean delete_class)
 Garbage collect a class static instance.
rboolean gc_class_field_mkref_stub (jvm_class_index clsidxTO, jvm_field_lookup_index csflidxTO)
 Add a class static field reference to a class.
rboolean gc_class_field_rmref_stub (jvm_class_index clsidxTO, jvm_field_lookup_index csflidxTO)
 Remove a class static field reference from a class.
rboolean gc_class_mkref_from_class_stub (jvm_class_index clsidxFROM, jvm_class_index clsidxTO)
 Add a class static reference to a class.
rboolean gc_class_mkref_from_object_stub (jvm_object_hash objhashFROM, jvm_class_index clsidxTO)
 Add an object instance reference to a class.
rboolean gc_class_new_stub (jvm_class_index clsidxNEW)
 Start up garbage collection for a class.
rboolean gc_class_reload_stub (jvm_class_index clsidxOLD, jvm_class_index clsidxNEW)
 Shut down and restart garbage collection for a class.
rboolean gc_class_rmref_from_class_stub (jvm_class_index clsidxFROM, jvm_class_index clsidxTO)
 Remove a class static reference from a class.
rboolean gc_class_rmref_from_object_stub (jvm_object_hash objhashFROM, jvm_class_index clsidxTO)
 Remove an object instance reference from a class.
rvoid gc_init_stub ()
 Initialize garbage collection.
rboolean gc_object_delete_stub (jvm_object_hash objhashOLD)
 Garbage collect an object instance.
rboolean gc_object_field_mkref_stub (jvm_object_hash objhashTO, jvm_field_lookup_index oiflidxTO)
 Add an object instance field reference to an object.
rboolean gc_object_field_rmref_stub (jvm_object_hash objhashTO, jvm_field_lookup_index oiflidxTO)
 Add an object instance field reference to an object.
rboolean gc_object_mkref_from_class_stub (jvm_class_index clsidxFROM, jvm_object_hash objhashTO)
 Add a class static reference to an object.
rboolean gc_object_mkref_from_object_stub (jvm_object_hash objhashFROM, jvm_object_hash objhashTO)
 Add an object instance reference to an object.
rboolean gc_object_new_stub (jvm_object_hash objhashNEW)
 Start up garbage collection for an object.
rboolean gc_object_rmref_from_class_stub (jvm_class_index clsidxFROM, jvm_object_hash objhashTO)
 Remove a class static reference from an object.
rboolean gc_object_rmref_from_object_stub (jvm_object_hash objhashFROM, jvm_object_hash objhashTO)
 Remove an object instance reference from an object.
rvoid gc_run_stub (rboolean rmref)
 Review collection status of all objects and clean them up.
rboolean gc_stack_delete_stub (jvm_thread_index thridxOLD, rvoid **ppgcs, jint *plocal_teardown)
 Garbage collect a Java virtual method stack frame.
rboolean gc_stack_mkref_from_jvm_stub (jvm_thread_index thridxFROM, jint frmidxTO)
 Add local variable reference to an object.
rvoidgc_stack_new_stub (jvm_thread_index thridxNEW, rint num_locals)
 Start up garbage collection for a new Java virtual method stack frame.
rboolean gc_stack_rmref_from_jvm_stub (jvm_thread_index thridxFROM, jint frmidxTO)
 Remove local variable reference from an object.
static void gc_stub_c_dummy (void)

Variables

static char * gc_stub_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/gc_stub.c $ $Id: gc_stub.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable."


Function Documentation

static void gc_stub_c_dummy void   )  [static]
 

Definition at line 52 of file gc_stub.c.

rvoid gc_init_stub  ) 
 

Initialize garbage collection.

Parameters: rvoid

Returns:
rvoid

Definition at line 126 of file gc_stub.c.

rvoid gc_run_stub rboolean  rmref  ) 
 

Review collection status of all objects and clean them up.

Scan through object table for objects that need be deallocated and free up those resources for reuse by the JVM.

Parameters:
rmref rtrue when class and object references are to be removed during processing. This is rfalse during JVM shutdown.
Returns:
rvoid
< This slot contains a class

< NULL class slot. Exactly on exists in normal use, any else besides the JVMCFG_NULL_CLASS is a class slot now being initialized.

< Class may be garbage collected.

Todo:
Write the object GC algorithm
< This slot contains an object

< NULL object (only 1 exists in normal use, any else besides the JVMCFG_NULL_OBJECT is an object slot now being initialized.)

< Object may be garbage collected

Todo:
Write the object GC algorithm

Definition at line 153 of file gc_stub.c.

References CLASS, CLASS_STATUS_GCREQ, CLASS_STATUS_INUSE, CLASS_STATUS_NULL, jvm_class_index_null, jvm_object_hash_null, JVMCFG_MAX_CLASSES, JVMCFG_MAX_OBJECTS, OBJECT, OBJECT_STATUS_GCREQ, OBJECT_STATUS_INUSE, and OBJECT_STATUS_NULL.

rboolean gc_class_new_stub jvm_class_index  clsidxNEW  ) 
 

Start up garbage collection for a class.

Initialize garbage collection for a new class static instance, as set up in class_static_new(). The reverse of gc_class_delete_stub().

Parameters:
clsidxNEW Class table index of new class static instance.
Returns:
rtrue if garbage collection was initialized for this class static instance, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null class index or if a garbage collection accounting area has already been allocated for this class.

Definition at line 256 of file gc_stub.c.

References rfalse.

rboolean gc_class_reload_stub jvm_class_index  clsidxOLD,
jvm_class_index  clsidxNEW
 

Shut down and restart garbage collection for a class.

Reinitialize garbage collection for a reloaded class static instance, as set up in class_reload().

Parameters:
clsidxOLD Class table index of old class static instance.
clsidxNEW Class table index of reloaded class static instance.
Returns:
rtrue if garbage collection was reinitialized for this reloaded class static instance, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target class index.

Definition at line 286 of file gc_stub.c.

References rfalse.

rboolean gc_class_mkref_from_class_stub jvm_class_index  clsidxFROM,
jvm_class_index  clsidxTO
 

Add a class static reference to a class.

Mark class as having another class static instance reference to it, namely a lower_dim_array or initiating_ClassLoader or defining_ClasslLoader The reverse of gc_class_rmref_from_class_stub().

Parameters:
clsidxFROM Class table index of source class static instance. If jvm_class_index_null, this is the class table entry itself.
clsidxTO Class table index of target class static instance.
Returns:
rtrue if class static instance was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target class index.

Definition at line 320 of file gc_stub.c.

References rfalse.

rboolean gc_class_mkref_from_object_stub jvm_object_hash  objhashFROM,
jvm_class_index  clsidxTO
 

Add an object instance reference to a class.

Mark class as having another class object instance reference to it, namely where OBJECT_STATUS_CLASS is set for that object. (Usually marked only one time over the life of the class.) The reverse of gc_class_rmref_from_object_stub().

Parameters:
objhashFROM Object hash of source object instance.
clsidxTO Class table index of target class static instance
Returns:
rtrue if class static instance was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target class index.

Definition at line 351 of file gc_stub.c.

References rfalse.

rboolean gc_class_rmref_from_class_stub jvm_class_index  clsidxFROM,
jvm_class_index  clsidxTO
 

Remove a class static reference from a class.

Unmark class as having a class static instance reference to it. The reverse of gc_class_mkref_from_class_stub().

Parameters:
clsidxFROM Class table index of source class static instance. If jvm_class_index_null, this is the class table entry itself.
clsidxTO Class table index of target class static instance.
Returns:
rtrue if class static instance was unmarked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target class index.

Definition at line 383 of file gc_stub.c.

References rfalse.

rboolean gc_class_rmref_from_object_stub jvm_object_hash  objhashFROM,
jvm_class_index  clsidxTO
 

Remove an object instance reference from a class.

Unmark class as having a class object reference to it, namely where OBJECT_STATUS_CLASS is set for that object. (Usually marked only one time over the life of the class, so this will effectively mark the class itself as being ready for garbage collection.) The reverse of gc_class_mkref_stub().

Parameters:
objhashFROM Object hash of source object instance.
clsidxTO Class table index of target class static instance
Returns:
rtrue if class static instance was unmarked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target class index.

Definition at line 415 of file gc_stub.c.

References rfalse.

rboolean gc_class_field_mkref_stub jvm_class_index  clsidxTO,
jvm_field_lookup_index  csflidxTO
 

Add a class static field reference to a class.

Mark class static field as being a reference type (typically after loading the class). The reverse of gc_class_field_rmref_stub().

Parameters:
clsidxTO Class table index of target class static instance.
csflidxTO Class static field lookup index to field in target class static instance.
Returns:
rtrue if class static field was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target class index.

Definition at line 446 of file gc_stub.c.

References rfalse.

rboolean gc_class_field_rmref_stub jvm_class_index  clsidxTO,
jvm_field_lookup_index  csflidxTO
 

Remove a class static field reference from a class.

Mark class static field as not being a reference type (typically before unloading the class. The reverse of gc_class_field_mkref_stub().

Parameters:
clsidxTO Class table index of target class static instance.
csflidxTO Class static field lookup index to field in target class.
Returns:
rtrue if class static field was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null class index.

Definition at line 477 of file gc_stub.c.

References rfalse.

rboolean gc_class_delete_stub jvm_class_index  clsidxOLD,
rboolean  delete_class
 

Garbage collect a class static instance.

Finalize garbage collection for a class static instance that will no longer be used, as set up in class_static_delete(). If there are any outstanding references to this class, those must first be removed, at which time gc_run_stub() will perform the finalization instead. The reverse of gc_class_new_stub().

Note:
Since this function is the reverse of gc_class_new_stub(), the rclass.pgarbage pointer must be freed by HEAP_DATA_FREE.
Parameters:
clsidxOLD Class table index of defunct class static instance.
delete_class If rtrue, attempt class_static_delete() when finished with garbage collection.
Returns:
rtrue if garbage collection was finalized for this class static instance, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null source source class index.

Definition at line 517 of file gc_stub.c.

References rfalse.

rboolean gc_object_new_stub jvm_object_hash  objhashNEW  ) 
 

Start up garbage collection for an object.

Initialize garbage collection for a new object instance, as set up in object_new(). The reverse of gc_object_delete_stub().

Parameters:
objhashNEW Object table hash of new object instance.
Returns:
rtrue if garbage collection was initialized for this object instance, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null object hash.

Definition at line 545 of file gc_stub.c.

References rfalse.

rboolean gc_object_mkref_from_class_stub jvm_class_index  clsidxFROM,
jvm_object_hash  objhashTO
 

Add a class static reference to an object.

Mark object as having another class static instance reference to it. The reverse of gc_object_rmref_from_class_stub().

Parameters:
clsidxFROM Class table index of source class static instance.
objhashTO Object table hash of target object instance
Returns:
rtrue if object instance was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target object hash.

Definition at line 573 of file gc_stub.c.

References rfalse.

rboolean gc_object_mkref_from_object_stub jvm_object_hash  objhashFROM,
jvm_object_hash  objhashTO
 

Add an object instance reference to an object.

Mark object as having another object instance reference to it. The reverse of gc_object_rmref_from_object_stub().

Parameters:
objhashFROM Object table hash of source object instance. If jvm_object_hash_null, this is the object table entry itself.
objhashTO Object table hash of target object instance
Returns:
rtrue if object instance was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target object hash.

Definition at line 605 of file gc_stub.c.

References rfalse.

rboolean gc_object_rmref_from_class_stub jvm_class_index  clsidxFROM,
jvm_object_hash  objhashTO
 

Remove a class static reference from an object.

Unmark object as having a class static instance reference to it. The reverse of gc_object_mkref_from_class_stub().

Parameters:
clsidxFROM Class table index of source class static instance.
objhashTO Object table hash of target object instance
Returns:
rtrue if class static instance was unmarked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target object hash.

Definition at line 634 of file gc_stub.c.

References rfalse.

rboolean gc_object_rmref_from_object_stub jvm_object_hash  objhashFROM,
jvm_object_hash  objhashTO
 

Remove an object instance reference from an object.

Unmark object as having an object instance reference to it. The reverse of gc_object_mkref_from_object_stub().

Parameters:
objhashFROM Object table hash of source object instance. If jvm_object_hash_null, this is the object table entry itself.
objhashTO Object table hash of target object instance
Returns:
rtrue if object instance was unmarked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target object hash.

Definition at line 666 of file gc_stub.c.

References rfalse.

rboolean gc_object_field_mkref_stub jvm_object_hash  objhashTO,
jvm_field_lookup_index  oiflidxTO
 

Add an object instance field reference to an object.

Mark object instance field as being a reference type (typically after loading the class and instantiating an object of that class type). The reverse of gc_object_field_rmref_stub().

Parameters:
objhashTO Object table hash of target object instance.
oiflidxTO Object instance field lookup index to field in target object instance.
Returns:
rtrue if object instance field was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target object hash.

Definition at line 697 of file gc_stub.c.

References rfalse.

rboolean gc_object_field_rmref_stub jvm_object_hash  objhashTO,
jvm_field_lookup_index  oiflidxTO
 

Add an object instance field reference to an object.

Mark object instance field as not being a reference type any more (typically before unloading the class). The reverse of gc_object_field_rmref_stub().

Parameters:
objhashTO Object table hash of target object instance.
oiflidxTO Object instance field lookup index to field in target object instance.
Returns:
rtrue if class static field was unmarked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null target object hash.

Definition at line 728 of file gc_stub.c.

References rfalse.

rboolean gc_object_delete_stub jvm_object_hash  objhashOLD  ) 
 

Garbage collect an object instance.

Finalize garbage collection for an object instance that will no longer be used, as set up in object_instance_delete(). If there are any outstanding references to this class, those must first be removed, at which time gc_run_stub() will perform the finalization instead. The reverse of gc_object_new_stub().

Note:
Since this function is the reverse of gc_object_new_stub(), the rclass.pgarbage pointer must be freed by HEAP_DATA_FREE.
Parameters:
objhashOLD Object table hash of defunct object instance.
Returns:
rtrue if garbage collection was finalized for this object instance, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null object hash.

Definition at line 763 of file gc_stub.c.

References rnull.

rvoid* gc_stack_new_stub jvm_thread_index  thridxNEW,
rint  num_locals
 

Start up garbage collection for a new Java virtual method stack frame.

Initialize garbage collection for a new stack frame for a virtual Java method invocation, as set up in PUSH_GC(). The reverse of gc_stack_delete_stub().

Parameters:
thridxNEW Thread table index to thread that is setting up a new stack frame for a method invocation.
num_locals Number of local variables in this method.
Returns:
Pointer to (gc_stack) for this object instance
Attention:
Due to the fact that there may be any number of garbage collection algorithms implemented for the JVM, and with the need to keep the API to the GC system constant, this return value is not defined to be related to any particular type of GC. Instead it is a simple rvoid pointer.

Definition at line 796 of file gc_stub.c.

References rfalse.

rboolean gc_stack_mkref_from_jvm_stub jvm_thread_index  thridxFROM,
jint  frmidxTO
 

Add local variable reference to an object.

Mark object as having another local variable instance reference to it. The reverse of gc_stack_rmref_stub().

Parameters:
thridxFROM Thread table index to thread that is setting up new stack from for a method invocation.
frmidxTO Index into current frame of local variable that is an object reference.
Returns:
rtrue if object instance was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null thread index.

Definition at line 826 of file gc_stub.c.

References rfalse.

rboolean gc_stack_rmref_from_jvm_stub jvm_thread_index  thridxFROM,
jint  frmidxTO
 

Remove local variable reference from an object.

Unmark object from having another local variable instance reference to it. The reverse of gc_stack_mkref_stub().

Parameters:
thridxFROM Thread table index to thread that is setting up new stack from for a method invocation.
frmidxTO Index into current frame of local variable that is an object reference.
Returns:
rtrue if object instance was marked, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null thread index.

Definition at line 857 of file gc_stub.c.

References rfalse.

rboolean gc_stack_delete_stub jvm_thread_index  thridxOLD,
rvoid **  ppgcs,
jint plocal_teardown
 

Garbage collect a Java virtual method stack frame.

Finalize garbage collection for a stack frame that will no longer be used by a virtual Java method, as set up in PUSH_GC(). This function is called from POP_GC(). It is the reverse of gc_stack_new_stub().

Parameters:
thridxOLD Thread table index to thread that is tearing down an old stack frame from a method invocation.
ppgcs Pointer to GC stack area pointer for this frame
plocal_teardown Pointer to local area of partially popped frame.
Returns:
rtrue if garbage collection was finalized for this method return, otherwise rfalse.
Exceptions:
JVMCLASS_JAVA_LANG_INTERNALERROR if null thread index.
Attention:
Due to the fact that there may be any number of garbage collection algorithms implemented for the JVM, and with the need to keep the API to the GC system constant, the parameter ppgcs is not defined to be related to any particular type of GC. Instead it is a simple rvoid pointer.

Definition at line 901 of file gc_stub.c.


Variable Documentation

char* gc_stub_c_copyright = "\0" "$URL: https://svn.apache.org/path/name/gc_stub.c $ $Id: gc_stub.c 0 09/28/2005 dlydick $" " " "Copyright 2005 The Apache Software Foundation or its licensors, as applicable." [static]
 

Definition at line 52 of file gc_stub.c.


Generated on Fri Sep 30 19:00:10 2005 by  doxygen 1.4.4