Exemple #1
0
void factor_vm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv)
{
	default_parameters(p);
	p->executable_path = argv[0];

	int i = 0;

	for(i = 1; i < argc; i++)
	{
		vm_char *arg = argv[i];
		if(STRCMP(arg,STRING_LITERAL("--")) == 0) break;
		else if(factor_arg(arg,STRING_LITERAL("-datastack=%d"),&p->datastack_size));
		else if(factor_arg(arg,STRING_LITERAL("-retainstack=%d"),&p->retainstack_size));
		else if(factor_arg(arg,STRING_LITERAL("-callstack=%d"),&p->callstack_size));
		else if(factor_arg(arg,STRING_LITERAL("-young=%d"),&p->young_size));
		else if(factor_arg(arg,STRING_LITERAL("-aging=%d"),&p->aging_size));
		else if(factor_arg(arg,STRING_LITERAL("-tenured=%d"),&p->tenured_size));
		else if(factor_arg(arg,STRING_LITERAL("-codeheap=%d"),&p->code_size));
		else if(factor_arg(arg,STRING_LITERAL("-pic=%d"),&p->max_pic_size));
		else if(factor_arg(arg,STRING_LITERAL("-callbacks=%d"),&p->callback_size));
		else if(STRCMP(arg,STRING_LITERAL("-fep")) == 0) p->fep = true;
		else if(STRCMP(arg,STRING_LITERAL("-nosignals")) == 0) p->signals = false;
		else if(STRNCMP(arg,STRING_LITERAL("-i="),3) == 0) p->image_path = arg + 3;
		else if(STRCMP(arg,STRING_LITERAL("-console")) == 0) p->console = true;
	}
}
Exemple #2
0
void vm_parameters::init_from_args(int argc, vm_char** argv) {
  int i = 0;

  for (i = 1; i < argc; i++) {
    vm_char* arg = argv[i];
    if (STRCMP(arg, STRING_LITERAL("--")) == 0)
      break;
    else if (factor_arg(arg, STRING_LITERAL("-datastack=%d"),
                        &datastack_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-retainstack=%d"),
                        &retainstack_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-callstack=%d"),
                        &callstack_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-young=%d"), &young_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-aging=%d"), &aging_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-tenured=%d"), &tenured_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-codeheap=%d"), &code_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-pic=%d"), &max_pic_size))
      ;
    else if (factor_arg(arg, STRING_LITERAL("-callbacks=%d"), &callback_size))
      ;
    else if (STRNCMP(arg, STRING_LITERAL("-i="), 3) == 0) {
      // In case you specify -i more than once.
      if (image_path) {
        free((vm_char *)image_path);
      }
      image_path = safe_strdup(arg + 3);
    }
    else if (STRCMP(arg, STRING_LITERAL("-fep")) == 0)
      fep = true;
    else if (STRCMP(arg, STRING_LITERAL("-nosignals")) == 0)
      signals = false;
    else if (STRCMP(arg, STRING_LITERAL("-console")) == 0)
      console = true;
  }
}
Exemple #3
0
 * Fugue dynamically allocated string handling                       *
 *                                                                   *
 * dSinit() must be used to initialize a dynamically allocated       *
 * string, and dSfree() to free up the contents.  To minimize        *
 * resize()s, initialize the size to be a little more than the       *
 * median expected size.                                             *
 *********************************************************************/

#include "tfconfig.h"
#include "port.h"
#include "malloc.h"
#include "tf.h"
#include "signals.h"	/* core() */

static String *Stringpool = NULL;	/* freelist */
conString blankline[1] = { STRING_LITERAL("") };

#if USE_MMALLOC
# define MD(str)	(str->md)
#else
# define MD(str)	(NULL)
#endif

#define lcheck(str, file, line) \
    do { if ((str)->len >= (str)->size)  resize(str, file, line); } while(0)

#if USE_DMALLOC
# define Smalloc(str, size) \
    (str->static_struct ? \
        mmalloc(MD(str), size) : xmalloc(MD(str), size, file, line))
# define Srealloc(str, ptr, size) \
Exemple #4
0
void factorvm::init_parameters_from_args(vm_parameters *p, int argc, vm_char **argv)
{
	default_parameters(p);
	p->executable_path = argv[0];

	int i = 0;

	for(i = 1; i < argc; i++)
	{
		if(factor_arg(argv[i],STRING_LITERAL("-datastack=%d"),&p->ds_size));
		else if(factor_arg(argv[i],STRING_LITERAL("-retainstack=%d"),&p->rs_size));
		else if(factor_arg(argv[i],STRING_LITERAL("-generations=%d"),&p->gen_count));
		else if(factor_arg(argv[i],STRING_LITERAL("-young=%d"),&p->young_size));
		else if(factor_arg(argv[i],STRING_LITERAL("-aging=%d"),&p->aging_size));
		else if(factor_arg(argv[i],STRING_LITERAL("-tenured=%d"),&p->tenured_size));
		else if(factor_arg(argv[i],STRING_LITERAL("-codeheap=%d"),&p->code_size));
		else if(factor_arg(argv[i],STRING_LITERAL("-pic=%d"),&p->max_pic_size));
		else if(STRCMP(argv[i],STRING_LITERAL("-securegc")) == 0) p->secure_gc = true;
		else if(STRCMP(argv[i],STRING_LITERAL("-fep")) == 0) p->fep = true;
		else if(STRNCMP(argv[i],STRING_LITERAL("-i="),3) == 0) p->image_path = argv[i] + 3;
		else if(STRCMP(argv[i],STRING_LITERAL("-console")) == 0) p->console = true;
		else if(STRCMP(argv[i],STRING_LITERAL("-no-stack-traces")) == 0) p->stack_traces = false;
	}
}