00001 /* 00002 FALCON - The Falcon Programming Language. 00003 FILE: rampmode.h 00004 00005 Ramp mode - progressive GC limits adjustment algoritmhs 00006 ------------------------------------------------------------------- 00007 Author: Giancarlo Niccolai 00008 Begin: Wed, 18 Mar 2009 19:55:25 +0100 00009 00010 ------------------------------------------------------------------- 00011 (C) Copyright 2009: the FALCON developers (see list in AUTHORS file) 00012 00013 See LICENSE file for licensing details. 00014 */ 00015 00016 #ifndef FALCON_RAMP_MODE_H 00017 #define FALCON_RAMP_MODE_H 00018 00019 #include <falcon/setup.h> 00020 #include <falcon/types.h> 00021 #include <falcon/basealloc.h> 00022 00023 #include <stdlib.h> 00024 00025 namespace Falcon { 00026 00031 class FALCON_DYN_CLASS RampMode: public BaseAlloc 00032 { 00033 protected: 00034 size_t m_normal; 00035 size_t m_active; 00036 00037 public: 00038 RampMode() {} 00039 virtual ~RampMode(); 00040 00045 virtual void onScanInit()=0; 00046 00051 virtual void onScanComplete()=0; 00052 00054 virtual void reset(); 00055 00057 size_t normalLevel() const { return m_normal; } 00058 00060 size_t activeLevel() const { return m_active; } 00061 }; 00062 00063 00068 class FALCON_DYN_CLASS RampStrict: public RampMode 00069 { 00070 public: 00071 RampStrict(): 00072 RampMode() 00073 {} 00074 00075 virtual ~RampStrict(); 00076 virtual void onScanInit(); 00077 virtual void onScanComplete(); 00078 }; 00079 00080 #define RAMP_MODE_STRICT_ID 0 00081 00082 00083 class FALCON_DYN_CLASS RampLoose: public RampMode 00084 { 00085 public: 00086 RampLoose(): 00087 RampMode() 00088 {} 00089 00090 virtual ~RampLoose(); 00091 virtual void onScanInit(); 00092 virtual void onScanComplete(); 00093 }; 00094 00095 #define RAMP_MODE_LOOSE_ID 1 00096 00097 class FALCON_DYN_CLASS RampSmooth: public RampMode 00098 { 00099 size_t m_pNormal; 00100 size_t m_pActive; 00101 numeric m_factor; 00102 00103 public: 00104 RampSmooth( numeric factor ); 00105 virtual ~RampSmooth(); 00106 00107 virtual void reset(); 00108 virtual void onScanInit(); 00109 virtual void onScanComplete(); 00110 }; 00111 00112 #define RAMP_MODE_SMOOTH_SLOW_ID 2 00113 #define RAMP_MODE_SMOOTH_FAST_ID 3 00114 00115 #define RAMP_MODE_COUNT 4 00116 #define RAMP_MODE_OFF -1 00117 #define DEFAULT_RAMP_MODE RAMP_MODE_SMOOTH_SLOW_ID 00118 } 00119 00120 #endif 00121 00122 /* end of rampmode.h */