runtime: correct a logic error in hashmap growth.
[gcc.git] / libgo / runtime / go-main.c
1 /* go-main.c -- the main function for a Go program.
2
3 Copyright 2009 The Go Authors. All rights reserved.
4 Use of this source code is governed by a BSD-style
5 license that can be found in the LICENSE file. */
6
7 #include "config.h"
8
9 #include <stdlib.h>
10 #include <time.h>
11 #include <unistd.h>
12
13 #ifdef HAVE_FPU_CONTROL_H
14 #include <fpu_control.h>
15 #endif
16
17 #include "go-alloc.h"
18 #include "array.h"
19 #include "go-string.h"
20
21 #include "runtime.h"
22 #include "arch.h"
23 #include "malloc.h"
24
25 #undef int
26 #undef char
27 #undef unsigned
28
29 /* The main function for a Go program. This records the command line
30 parameters, calls the real main function, and returns a zero status
31 if the real main function returns. */
32
33 extern char **environ;
34
35 extern void runtime_main (void);
36 static void mainstart (void *);
37
38 /* The main function. */
39
40 int
41 main (int argc, char **argv)
42 {
43 runtime_check ();
44 runtime_args (argc, (byte **) argv);
45 runtime_osinit ();
46 runtime_schedinit ();
47 __go_go (mainstart, NULL);
48 runtime_mstart (runtime_m ());
49 abort ();
50 }
51
52 static void
53 mainstart (void *arg __attribute__ ((unused)))
54 {
55 runtime_main ();
56 }