1 /* This file has been automatically generated from "vm_args.m4.c" */
2 
3   if (strcmp ("vfprintf", optstr) == 0)
4     {
5       vm->vfprintf = SVM_CAST_EXTENSION
6 	(int (*)(FILE *, const char *, va_list)) vm_args->options[i].
7 	extraInfo;
8       if (vm->vfprintf == NULL)
9 	{
10 	  goto error;
11 	}
12     }
13 
14   else if (strcmp ("exit", optstr) == 0)
15     {
16       vm->exit =
17 	SVM_CAST_EXTENSION (void (*)(int)) vm_args->options[i].extraInfo;
18       if (vm->exit == NULL)
19 	{
20 	  goto error;
21 	}
22     }
23 
24   else if (strcmp ("abort", optstr) == 0)
25     {
26       vm->abort =
27 	SVM_CAST_EXTENSION (void (*)(void)) vm_args->options[i].extraInfo;
28       if (vm->abort == NULL)
29 	{
30 	  goto error;
31 	}
32     }
33 
34   /* boot paths */
35 
36   else if (strncmp ("-Dsablevm.boot.class.path=", optstr, 26) == 0)
37     {
38       if (vm->class_loading.boot_loader.boot_class_path != NULL)
39 	{
40 	  _svmm_gfree_str_no_exception (vm->class_loading.boot_loader.boot_class_path);
41 	}
42 
43       if (_svmm_galloc_copy_str_no_exception
44 	  (vm->class_loading.boot_loader.boot_class_path, &optstr[26]) != JNI_OK)
45 	{
46 	  goto error;
47 	}
48     }
49 
50   else if (strncmp ("-Dsablevm.boot.class.path.prepend=", optstr, 34) == 0)
51     {
52       if (vm->class_loading.boot_loader.boot_class_path_prepend != NULL)
53 	{
54 	  _svmm_gfree_str_no_exception (vm->class_loading.boot_loader.boot_class_path_prepend);
55 	}
56 
57       if (_svmm_galloc_copy_str_no_exception
58 	  (vm->class_loading.boot_loader.boot_class_path_prepend, &optstr[34]) != JNI_OK)
59 	{
60 	  goto error;
61 	}
62     }
63 
64   else if (strncmp ("-Dsablevm.boot.class.path.append=", optstr, 33) == 0)
65     {
66       if (vm->class_loading.boot_loader.boot_class_path_append != NULL)
67 	{
68 	  _svmm_gfree_str_no_exception (vm->class_loading.boot_loader.boot_class_path_append);
69 	}
70 
71       if (_svmm_galloc_copy_str_no_exception
72 	  (vm->class_loading.boot_loader.boot_class_path_append, &optstr[33]) != JNI_OK)
73 	{
74 	  goto error;
75 	}
76     }
77 
78   else if (strncmp ("-Dsablevm.boot.library.path=", optstr, 28) == 0)
79     {
80       if (vm->class_loading.boot_loader.boot_library_path != NULL)
81 	{
82 	  _svmm_gfree_str_no_exception (vm->class_loading.boot_loader.boot_library_path);
83 	}
84 
85       if (_svmm_galloc_copy_str_no_exception
86 	  (vm->class_loading.boot_loader.boot_library_path, &optstr[28]) != JNI_OK)
87 	{
88 	  goto error;
89 	}
90     }
91 
92   /* structured locking */
93 
94   else if (strncmp ("-Dsablevm.structured.locking=", optstr, 29) == 0)
95     {
96       const char *value = &optstr[29];
97 
98       if (strcmp (value, "on") == 0 || strcmp (value, "true") == 0)
99 	{
100 	  vm->enforce_structured_locking = JNI_TRUE;
101 	}
102       else if (strcmp (value, "off") == 0 || strcmp (value, "false") == 0)
103 	{
104 	  vm->enforce_structured_locking = JNI_FALSE;
105 	}
106       else
107 	{
108 	  goto error;
109 	}
110     }
111 
112 #if defined (_SABLEVM_NO_GC)
113 
114   /* copying heap parameters */
115 
116   else if (strncmp ("-Dsablevm.heap.size=", optstr, 20) == 0)
117     {
118       if (_svmf_parse_size_t (&vm->heap.size, &optstr[20]) != JNI_OK)
119 	{
120 	  goto error;
121 	}
122     }
123 
124 #elif defined (_SABLEVM_COPY_GC) || defined (_SABLEVM_GENCOPY_GC)
125 
126   /* copying heap parameters */
127 
128   else if (strncmp ("-Dsablevm.heap.size.min=", optstr, 24) == 0)
129     {
130       if (_svmf_parse_size_t (&vm->heap.min_size, &optstr[24]) != JNI_OK)
131 	{
132 	  goto error;
133 	}
134     }
135 
136   else if (strncmp ("-Dsablevm.heap.size.max=", optstr, 24) == 0)
137     {
138       if (_svmf_parse_size_t (&vm->heap.max_size, &optstr[24]) != JNI_OK)
139 	{
140 	  goto error;
141 	}
142     }
143 
144   else if (strncmp ("-Dsablevm.heap.size.increment=", optstr, 30) == 0)
145     {
146       if (_svmf_parse_size_t (&vm->heap.allocation_increment, &optstr[30]) != JNI_OK)
147 	{
148 	  goto error;
149 	}
150     }
151 
152 #if defined (_SABLEVM_GENCOPY_GC)
153 
154   /* genrational copying heap parameters */
155 
156   else if (strncmp ("-Dsablevm.heap.size.nursery=", optstr, 28) == 0)
157     {
158       if (_svmf_parse_size_t (&vm->heap.nursery_size, &optstr[28]) != JNI_OK)
159 	{
160 	  goto error;
161 	}
162     }
163 
164 #endif /* defined (_SABLEVM_GENCOPY_GC) */
165 #endif /* defined (_SABLEVM_NO_GC) */
166 
167   /* stack and class loader heap parameters */
168 
169   else if (strncmp ("-Dsablevm.stack.size.min=", optstr, 25) == 0)
170     {
171       if (_svmf_parse_size_t (&vm->stack_min_size, &optstr[25]) != JNI_OK)
172 	{
173 	  goto error;
174 	}
175     }
176 
177   else if (strncmp ("-Dsablevm.stack.size.max=", optstr, 25) == 0)
178     {
179       if (_svmf_parse_size_t (&vm->stack_max_size, &optstr[25]) != JNI_OK)
180 	{
181 	  goto error;
182 	}
183     }
184 
185   else if (strncmp ("-Dsablevm.stack.size.increment=", optstr, 31) == 0)
186     {
187       if (_svmf_parse_size_t (&vm->stack_allocation_increment, &optstr[31]) != JNI_OK)
188 	{
189 	  goto error;
190 	}
191     }
192 
193   else if (strncmp ("-Dsablevm.classloader.heap.size.min=", optstr, 36) == 0)
194     {
195       if (_svmf_parse_size_t (&vm->class_loader_min_size, &optstr[36]) != JNI_OK)
196 	{
197 	  goto error;
198 	}
199     }
200 
201   else if (strncmp ("-Dsablevm.classloader.heap.size.max=", optstr, 36) == 0)
202     {
203       if (_svmf_parse_size_t (&vm->class_loader_max_size, &optstr[36]) != JNI_OK)
204 	{
205 	  goto error;
206 	}
207     }
208 
209   else if (strncmp ("-Dsablevm.classloader.heap.size.increment=", optstr, 42) == 0)
210     {
211       if (_svmf_parse_size_t (&vm->class_loader_allocation_increment, &optstr[42]) != JNI_OK)
212 	{
213 	  goto error;
214 	}
215     }
216 
217 #if !defined(NDEBUG)
218 
219   /* additional verbose options */
220 
221   else if (strncmp ("-Dsablevm.verbose.exceptions=", optstr, 29) == 0)
222     {
223       const char *value = &optstr[29];
224 
225       if (strcmp (value, "on") == 0 || strcmp (value, "true") == 0)
226 	{
227 	  vm->verbose_exceptions = JNI_TRUE;
228 	}
229       else if (strcmp (value, "off") == 0 || strcmp (value, "false") == 0)
230 	{
231 	  vm->verbose_exceptions = JNI_FALSE;
232 	}
233       else
234 	{
235 	  goto error;
236 	}
237     }
238 
239   else if (strncmp ("-Dsablevm.verbose.exit=", optstr, 23) == 0)
240     {
241       const char *value = &optstr[23];
242 
243       if (strcmp (value, "on") == 0 || strcmp (value, "true") == 0)
244 	{
245 	  vm->exit_stack_trace = JNI_TRUE;
246 	}
247       else if (strcmp (value, "off") == 0 || strcmp (value, "false") == 0)
248 	{
249 	  vm->exit_stack_trace = JNI_FALSE;
250 	}
251       else
252 	{
253 	  goto error;
254 	}
255     }
256 
257 #endif
258 
259 #if !defined(NDEBUG) || defined(_SABLEVM_VERBOSE_INSTRUCTIONS_INLINED)
260 
261   /* additional verbose options */
262 
263   else if (strncmp ("-Dsablevm.verbose.methods=", optstr, 26) == 0)
264     {
265       const char *value = &optstr[26];
266 
267       if (strcmp (value, "on") == 0 || strcmp (value, "true") == 0)
268 	{
269 	  vm->verbose_methods = JNI_TRUE;
270 	}
271       else if (strcmp (value, "off") == 0 || strcmp (value, "false") == 0)
272 	{
273 	  vm->verbose_methods = JNI_FALSE;
274 	}
275       else
276 	{
277 	  goto error;
278 	}
279     }
280 
281   else if (strncmp ("-Dsablevm.verbose.instructions=", optstr, 31) == 0)
282     {
283       const char *value = &optstr[31];
284 
285       if (strcmp (value, "on") == 0 || strcmp (value, "true") == 0)
286 	{
287 	  vm->verbose_instructions = JNI_TRUE;
288 	}
289       else if (strcmp (value, "off") == 0 || strcmp (value, "false") == 0)
290 	{
291 	  vm->verbose_instructions = JNI_FALSE;
292 	}
293       else
294 	{
295 	  goto error;
296 	}
297     }
298 
299   else if (strncmp ("-Dsablevm.verbose.synchronization=", optstr, 34) == 0)
300     {
301       const char *value = &optstr[34];
302 
303       if (strcmp (value, "on") == 0 || strcmp (value, "true") == 0)
304 	{
305 	  vm->verbose_synchronization = JNI_TRUE;
306 	}
307       else if (strcmp (value, "off") == 0 || strcmp (value, "false") == 0)
308 	{
309 	  vm->verbose_synchronization = JNI_FALSE;
310 	}
311       else
312 	{
313 	  goto error;
314 	}
315     }
316 
317 #endif
318 
319   /* generic property */
320   else if (strncmp ("-D", optstr, 2) == 0)
321     {
322       /* check that properties are properly declared */
323 
324       const char *first_equal;
325 
326       if (strlen (optstr) < 4 || optstr[2] == '=')
327 	{
328 	  goto error;
329 	}
330 
331       first_equal = strchr (&optstr[3], '=');
332 
333       if (first_equal == NULL)
334 	{
335 	  goto error;
336 	}
337     }
338 
339   /* verbose */
340 
341   else if (strncmp ("-verbose", optstr, 8) == 0)
342     {
343       const char *start = &optstr[8];
344       if (*start == 0)
345 	{
346 	  vm->verbose_class = JNI_TRUE;
347 	  vm->verbose_gc = JNI_TRUE;
348 	  vm->verbose_jni = JNI_TRUE;
349 	  start = NULL;
350 	}
351       else if (*(start++) != ':')
352 	{
353 	  goto error;
354 	}
355 
356       while (start != NULL)
357 	{
358 	  const char *stop = strchr (start, ',');
359 	  size_t len;
360 
361 	  if (stop != NULL)
362 	    {
363 	      len = stop - start;
364 	    }
365 	  else
366 	    {
367 	      len = strlen (start);
368 	    }
369 
370 	  if (len == 0)
371 	    {
372 	      goto error;
373 	    }
374 
375 	  if (len == 5 && strncmp (start, "class", len) == 0)
376 	    {
377 	      vm->verbose_class = JNI_TRUE;
378 	    }
379 	  else if (len == 2 && strncmp (start, "gc", len) == 0)
380 	    {
381 	      vm->verbose_gc = JNI_TRUE;
382 	    }
383 	  else if (len == 3 && strncmp (start, "jni", len) == 0)
384 	    {
385 	      vm->verbose_jni = JNI_TRUE;
386 	    }
387 	  else if (!vm_args->ignoreUnrecognized)
388 	    {
389 	      goto error;
390 	    }
391 
392 	  start = (stop == NULL) ? NULL : (stop + 1);
393 	}
394     }
395 
396   else if (!vm_args->ignoreUnrecognized)
397     {
398       goto error;
399     }
400 
401   /* save properties */
402   if (strncmp ("-D", optstr, 2) == 0)
403     {
404       if (_svmm_galloc_copy_str_no_exception
405 	  (vm->class_loading.boot_loader.system_properties.properties
406 	   [vm->class_loading.boot_loader.system_properties.count],
407 	   &optstr[2]) != JNI_OK)
408 	{
409 	  goto error;
410 	}
411 
412       vm->class_loading.boot_loader.system_properties.count++;
413     }
414 
415   /* end of arguments */
416 
417