Commit 578c09cd authored by rswindell's avatar rswindell
Browse files

Renamed JAVASCRIPT_GC/YIELD_FREQUENCY to (more accurate) *_INTERVAL.

parent 0ad98272
......@@ -547,10 +547,10 @@ js_BranchCallback(JSContext *cx, JSScript *script)
return(JS_FALSE);
}
/* Give up timeslices every once in a while */
if(sbbs->js_branch.yield_freq && (sbbs->js_branch.counter%sbbs->js_branch.yield_freq)==0)
if(sbbs->js_branch.yield_interval && (sbbs->js_branch.counter%sbbs->js_branch.yield_interval)==0)
YIELD();
if(sbbs->js_branch.gc_freq && (sbbs->js_branch.counter%sbbs->js_branch.gc_freq)==0)
if(sbbs->js_branch.gc_interval && (sbbs->js_branch.counter%sbbs->js_branch.gc_interval)==0)
JS_MaybeGC(cx);
return(JS_TRUE);
......
......@@ -70,10 +70,10 @@ static JSBool js_get(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
JS_NewNumberValue(cx,branch->limit,vp);
break;
case PROP_YIELD_INTERVAL:
JS_NewNumberValue(cx,branch->yield_freq,vp);
JS_NewNumberValue(cx,branch->yield_interval,vp);
break;
case PROP_GC_INTERVAL:
JS_NewNumberValue(cx,branch->gc_freq,vp);
JS_NewNumberValue(cx,branch->gc_interval,vp);
break;
#ifdef jscntxt_h___
case PROP_GC_BYTES:
......@@ -112,10 +112,10 @@ static JSBool js_set(JSContext *cx, JSObject *obj, jsval id, jsval *vp)
JS_ValueToInt32(cx, *vp, (int32*)&branch->limit);
break;
case PROP_GC_INTERVAL:
JS_ValueToInt32(cx, *vp, (int32*)&branch->gc_freq);
JS_ValueToInt32(cx, *vp, (int32*)&branch->gc_interval);
break;
case PROP_YIELD_INTERVAL:
JS_ValueToInt32(cx, *vp, (int32*)&branch->yield_freq);
JS_ValueToInt32(cx, *vp, (int32*)&branch->yield_interval);
break;
}
......
......@@ -82,8 +82,8 @@ void usage(FILE* fp)
"\t-m <bytes> set maximum heap size (default=%u bytes)\n"
"\t-s <bytes> set context stack size (default=%u bytes)\n"
"\t-b <limit> set branch limit (default=%u, 0=unlimited)\n"
"\t-y <freq> set yield frequency (default=%u, 0=never)\n"
"\t-g <freq> set garbage collection frequency (default=%u, 0=never)\n"
"\t-y <freq> set yield interval (default=%u, 0=never)\n"
"\t-g <freq> set garbage collection interval (default=%u, 0=never)\n"
"\t-t <filename> send console output to stdout and filename\n"
"\t-e send error messages to console instead of stderr\n"
"\t-n send status messages to %s instead of stdout\n"
......@@ -94,8 +94,8 @@ void usage(FILE* fp)
,JAVASCRIPT_MAX_BYTES
,JAVASCRIPT_CONTEXT_STACK
,JAVASCRIPT_BRANCH_LIMIT
,JAVASCRIPT_YIELD_FREQUENCY
,JAVASCRIPT_GC_FREQUENCY
,JAVASCRIPT_YIELD_INTERVAL
,JAVASCRIPT_GC_INTERVAL
,_PATH_DEVNULL
,_PATH_DEVNULL
);
......@@ -397,10 +397,10 @@ js_BranchCallback(JSContext *cx, JSScript *script)
return(JS_FALSE);
}
/* Give up timeslices every once in a while */
if(branch.yield_freq && (branch.counter%branch.yield_freq)==0)
if(branch.yield_interval && (branch.counter%branch.yield_interval)==0)
YIELD();
if(branch.gc_freq && (branch.counter%branch.gc_freq)==0)
if(branch.gc_interval && (branch.counter%branch.gc_interval)==0)
JS_MaybeGC(cx);
if(terminated) {
......@@ -659,8 +659,8 @@ int main(int argc, char **argv, char** environ)
statfp=nulfp;
branch.limit=JAVASCRIPT_BRANCH_LIMIT;
branch.yield_freq=JAVASCRIPT_YIELD_FREQUENCY;
branch.gc_freq=JAVASCRIPT_GC_FREQUENCY;
branch.yield_interval=JAVASCRIPT_YIELD_INTERVAL;
branch.gc_interval=JAVASCRIPT_GC_INTERVAL;
sscanf("$Revision$", "%*s %s", revision);
......@@ -680,10 +680,10 @@ int main(int argc, char **argv, char** environ)
branch.limit=strtoul(argv[++argn],NULL,0);
break;
case 'y':
branch.yield_freq=strtoul(argv[++argn],NULL,0);
branch.yield_interval=strtoul(argv[++argn],NULL,0);
break;
case 'g':
branch.gc_freq=strtoul(argv[++argn],NULL,0);
branch.gc_interval=strtoul(argv[++argn],NULL,0);
break;
case 'e':
errfp=confp;
......
......@@ -764,8 +764,8 @@ bool sbbs_t::js_init()
return(false);
js_branch.limit = JAVASCRIPT_BRANCH_LIMIT;
js_branch.gc_freq = JAVASCRIPT_GC_FREQUENCY;
js_branch.yield_freq = JAVASCRIPT_YIELD_FREQUENCY;
js_branch.gc_interval = JAVASCRIPT_GC_INTERVAL;
js_branch.yield_interval = JAVASCRIPT_YIELD_INTERVAL;
js_branch.counter = 0; /* loop counter */
bool success=false;
......
......@@ -67,14 +67,14 @@
#define JAVASCRIPT_MAX_BYTES (8*1024*1024)
#define JAVASCRIPT_CONTEXT_STACK (16*1024)
#define JAVASCRIPT_BRANCH_LIMIT 99999999
#define JAVASCRIPT_YIELD_FREQUENCY 10000
#define JAVASCRIPT_GC_FREQUENCY 100
#define JAVASCRIPT_YIELD_INTERVAL 10000
#define JAVASCRIPT_GC_INTERVAL 100
typedef struct {
ulong counter;
ulong limit;
ulong yield_freq;
ulong gc_freq;
ulong yield_interval;
ulong gc_interval;
} js_branch_t;
#ifndef __FLAT__
......
......@@ -881,10 +881,10 @@ js_BranchCallback(JSContext *cx, JSScript *script)
return(JS_FALSE);
}
/* Give up timeslices every once in a while */
if(client->branch.yield_freq && (client->branch.counter%client->branch.yield_freq)==0)
if(client->branch.yield_interval && (client->branch.counter%client->branch.yield_interval)==0)
YIELD();
if(client->branch.gc_freq && (client->branch.counter%client->branch.gc_freq)==0)
if(client->branch.gc_interval && (client->branch.counter%client->branch.gc_interval)==0)
JS_MaybeGC(cx);
return(JS_TRUE);
......@@ -1133,8 +1133,8 @@ static void js_static_service_thread(void* arg)
service_client.socket = service->socket;
service_client.service = service;
service_client.branch.limit = JAVASCRIPT_BRANCH_LIMIT;
service_client.branch.gc_freq = JAVASCRIPT_GC_FREQUENCY;
service_client.branch.yield_freq = JAVASCRIPT_YIELD_FREQUENCY;
service_client.branch.gc_interval = JAVASCRIPT_GC_INTERVAL;
service_client.branch.yield_interval = JAVASCRIPT_YIELD_INTERVAL;
if((js_runtime=JS_NewRuntime(startup->js_max_bytes))==NULL) {
lprintf("%04d !%s ERROR initializing JavaScript runtime"
......@@ -2012,8 +2012,8 @@ void DLLCALL services_thread(void* arg)
client->udp_buf=udp_buf;
client->udp_len=udp_len;
client->branch.limit=JAVASCRIPT_BRANCH_LIMIT;
client->branch.gc_freq=JAVASCRIPT_GC_FREQUENCY;
client->branch.yield_freq=JAVASCRIPT_YIELD_FREQUENCY;
client->branch.gc_interval=JAVASCRIPT_GC_INTERVAL;
client->branch.yield_interval=JAVASCRIPT_YIELD_INTERVAL;
udp_buf = NULL;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment