Initial revision
[gcc.git] / libjava / java / lang / natRuntime.cc
1 // natRuntime.cc - Implementation of native side of Runtime class.
2
3 /* Copyright (C) 1998, 1999 Cygnus Solutions
4
5 This file is part of libgcj.
6
7 This software is copyrighted work licensed under the terms of the
8 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 details. */
10
11 #include <config.h>
12
13 #include <stdlib.h>
14
15 #include <cni.h>
16 #include <jvm.h>
17 #include <java/lang/Runtime.h>
18
19 void
20 java::lang::Runtime::exit (jint status)
21 {
22 checkExit (status);
23
24 // Make status right for Unix. This is perhaps strange.
25 if (status < 0 || status > 255)
26 status = 255;
27
28 if (finalize_on_exit)
29 _Jv_RunAllFinalizers ();
30
31 ::exit (status);
32 }
33
34 jlong
35 java::lang::Runtime::freeMemory (void)
36 {
37 return _Jv_GCFreeMemory ();
38 }
39
40 void
41 java::lang::Runtime::gc (void)
42 {
43 _Jv_RunGC ();
44 }
45
46 void
47 java::lang::Runtime::runFinalization (void)
48 {
49 _Jv_RunFinalizers ();
50 }
51
52 jlong
53 java::lang::Runtime::totalMemory (void)
54 {
55 return _Jv_GCTotalMemory ();
56 }
57
58 void
59 java::lang::Runtime::traceInstructions (jboolean)
60 {
61 // Do nothing.
62 }
63
64 void
65 java::lang::Runtime::traceMethodCalls (jboolean)
66 {
67 // Do nothing.
68 }