pike.git / src / builtin.cmod

version» Context lines:

pike.git/src/builtin.cmod:1:   /* -*- c -*-   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin.cmod,v 1.106 2003/01/12 16:00:13 mast Exp $ + || $Id: builtin.cmod,v 1.107 2003/01/14 19:20:24 mast Exp $   */      #include "global.h"   #include "interpret.h"   #include "svalue.h"   #include "opcodes.h"   #include "pike_macros.h"   #include "object.h"   #include "program.h"   #include "array.h"
pike.git/src/builtin.cmod:365:    *! garbage collector. The passed mapping contains the parameters to    *! set. If a parameter is missing from the mapping, the current value    *! will be filled in instead. The same mapping is returned. Thus an    *! empty mapping, or no argument at all, causes a mapping with all    *! current settings to be returned.    *!    *! The following parameters are recognized:    *!    *! @mapping    *! @member int "enabled" -  *! All automatically scheduled gc runs are disabled if this is zero -  *! and the parameters below have no effect. Explicit runs through -  *! the @[gc] function still works as usual. +  *! If this is 1 then the gc is enabled as usual. If it's 0 then all +  *! automatically scheduled gc runs are disabled and the parameters +  *! below have no effect, but explicit runs through the @[gc] +  *! function still works as usual. If it's -1 then the gc is +  *! completely disabled so that even explicit @[gc] calls won't do +  *! anything.    *! @member float "garbage_ratio_low"    *! As long as the gc time is less than gc_time_ratio, aim to run    *! the gc approximately every time the ratio between the garbage    *! and the total amount of allocated things is this.    *! @member float "time_ratio"    *! When more than this fraction of the cpu time is spent in the gc,    *! aim for gc_garbage_ratio_high instead of gc_garbage_ratio_low.    *! @member float "garbage_ratio_high"    *! Upper limit for the garbage ratio - run the gc as often as it    *! takes to keep it below this.
pike.git/src/builtin.cmod:420:    GET; \    mapping_string_insert (params->u.mapping, str, &get); \    } \    } while (0)      #define HANDLE_FLOAT_FACTOR(NAME, VAR) \    HANDLE_PARAM (NAME, { \    if (set->type != T_FLOAT || \    set->u.float_number < 0.0 || set->u.float_number > 1.0) \    SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1, \ -  "float value between 0.0 and 1.0 for " NAME); \ +  "float between 0.0 and 1.0 for " NAME); \    VAR = set->u.float_number; \    }, { \    get.type = T_FLOAT; \    get.u.float_number = VAR; \    });       HANDLE_PARAM ("enabled", { -  if (gc_enabled != !UNSAFE_IS_ZERO (set)) { -  if (gc_enabled) { -  gc_enabled = 0; +  if (set->type != T_INT || set->u.integer < -1 || set->u.integer > 1) +  SIMPLE_BAD_ARG_ERROR ("Pike.gc_parameters", 1, +  "integer in the range -1..1 for 'enabled'"); +  if (gc_enabled != set->u.integer) { +  if (gc_enabled > 0) { +  gc_enabled = set->u.integer;    alloc_threshold = GC_MAX_ALLOC_THRESHOLD;    }    else {    gc_enabled = 1;    alloc_threshold = GC_MIN_ALLOC_THRESHOLD;    }    }    }, {    get.type = T_INT;    get.u.integer = gc_enabled;