Fix LDC, LDC_W, and INSTANCEOF opcodes, more debugging
[jamvm-avr32-jem.git] / src / init.c
blobd5b4a61b19471c26f1da41f02381179f57b11e14
1 /*
2 * Copyright (C) 2003, 2004, 2005, 2006, 2007
3 * Robert Lougher <rob@lougher.org.uk>.
5 * This file is part of JamVM.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2,
10 * or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 #include <stdio.h>
23 #include <string.h>
24 #include <stdlib.h>
25 #include <stdarg.h>
27 #include "jam.h"
29 static int VM_initing = TRUE;
30 extern void initialisePlatform();
32 /* Setup default values for command line args */
34 void setDefaultInitArgs(InitArgs *args) {
35 args->noasyncgc = FALSE;
37 args->verbosegc = FALSE;
38 args->verbosedll = FALSE;
39 args->verboseclass = FALSE;
41 args->compact_specified = FALSE;
43 args->classpath = NULL;
44 args->bootpath = NULL;
46 args->java_stack = DEFAULT_STACK;
47 args->min_heap = DEFAULT_MIN_HEAP;
48 args->max_heap = DEFAULT_MAX_HEAP;
50 args->props_count = 0;
52 args->vfprintf = vfprintf;
53 args->abort = abort;
54 args->exit = exit;
56 #ifdef INLINING
57 args->replication = 10;
58 args->codemem = args->max_heap / 4;
59 #endif
62 int VMInitialising() {
63 return VM_initing;
66 void initVM(InitArgs *args) {
67 /* Perform platform dependent initialisation */
68 initialisePlatform();
70 /* Initialise the VM modules -- ordering is important! */
71 initialiseHooks(args);
72 initialiseProperties(args);
73 initialiseAlloc(args);
74 initialiseClass(args);
75 initialiseDll(args);
76 initialiseUtf8();
77 initialiseMonitor();
78 initialiseInterpreter(args);
79 initialiseMainThread(args);
80 initialiseException();
81 initialiseString();
82 initialiseGC(args);
83 initialiseJNI();
84 initialiseNatives();
86 /* No need to check for exception - if one occurs, signalException aborts VM */
87 findSystemClass("java/lang/NoClassDefFoundError");
88 findSystemClass("java/lang/ClassFormatError");
89 findSystemClass("java/lang/NoSuchFieldError");
90 findSystemClass("java/lang/NoSuchMethodError");
92 VM_initing = FALSE;
95 unsigned long parseMemValue(char *str) {
96 char *end;
97 unsigned long n = strtol(str, &end, 0);
99 switch(end[0]) {
100 case '\0':
101 break;
103 case 'M':
104 case 'm':
105 n *= MB;
106 break;
108 case 'K':
109 case 'k':
110 n *= KB;
111 break;
113 default:
114 n = 0;
117 return n;