一、Build Options
-CVM_GCCHOICE (Generational/marksweep/semispace)
Default: generational
Example:-CVM_GCCHOICE=semispace
二、Runtime Options
-Xgc:gc_specific_options(In generational is youngGen=nnn in bytes)
Default: 1M
-Xmssize (memory allocation pool)
Default: 4M
Example: -Xms6291456, -Xms6144k, -Xms6m
三、Source Organization
- src/share/javavm/include/gc_common.h:The shared GC interface.
- src/share/javavm/include/gc/gc_impl.h :The gcimpl GC interface that has to be implemented for each GC.
- src/share/javavm/include/gc/
/gc_config.h :The configuration file for a specific GC. - src/share/javavm/runtime/gc/
/gc_impl.c :The implementation file for a specific GC.
四、Execution Flow
- CVM allocates memory using the shared routine CVMgcAllocNewInstance().
- CVMgcAllocNewInstance() does some processing and calls the GC-specific
CVMgcimplAllocObject() to allocate the actual space for the object. - CVMgcimplAllocObject() performs the GC and calls the shared routine
CVMgcStopTheWorldAndGC() to stop all threads at GC-safe points. - CVMgcStopTheWorldAndGC() ensures that all threads rendezvous at GC-safe points. When that is done, it calls the GC implementation CVMgcimplDoGC() to perform the GC action.
- CVMgcimplDoGC() may call shared GC service routines to scan GC state: For example, CVMgcScanRoots() to scan all roots or CVMobjectWalkRefs() to scan the pointers in a given object or array.
- When CVMgcimplDoGC() returns, all threads that were stopped at GC points resume execution. Eventually, CVMgcAllocNewInstance() returns and the thread that originally initiated GC resumes execution.
五、測試
make clean; (win32 makefile有問題)
make CVM_GCCHOICE=[semispacegenerationalmarksweep]
bin/cvm -cp testclasses.zip HelloWorld;
bin/cvm -XshowBuildOptions;
六、reference
CDCfoundation_porting_guide.pdf

0 意見:
張貼意見