Change the implementation of classobj
[IRC.git] / Robust / src / ClassLibrary / MGC / System.java
1 public class System {
2   public static PrintStream out = new PrintStream("System.out");
3   public static PrintStream err = new PrintStream("System.err");
4   public static InputStream in = new InputStream();
5   
6   public System() {
7   }
8   
9   public static void printInt(int x) {
10     String s=String.valueOf(x);
11     printString(s);
12   }
13   
14   public static native void setgcprofileflag();
15   
16   public static native void resetgcprofileflag();
17
18   public static native long currentTimeMillis();
19   
20   public static native long microTimes();
21
22   public static native long getticks();
23
24   public static native void printString(String s);
25
26   public static void println(String s) {
27     System.printString(s+"\n");
28   }
29
30   public static void println(Object o) {
31     System.printString(""+o+"\n");
32   }
33
34   public static void println(int o) {
35     System.printString(""+o+"\n");
36   }
37
38   public static void println(double o) {
39     System.printString(""+o+"\n");
40   }
41
42   public static void println(long o) {
43     System.printString(""+o+"\n");
44   }
45   
46   public static void println() {
47     System.printString("\n");
48   }
49
50   public static void print(String s) {
51     System.printString(s);
52   }
53
54   public static void print(Object o) {
55     System.printString(""+o);
56   }
57
58   public static void print(int o) {
59     System.printString(""+o);
60   }
61
62   public static void print(double o) {
63     System.printString(""+o);
64   }
65
66   public static void print(long o) {
67     System.printString(""+o);
68   }
69
70   public static void error() {
71     System.printString("Error (Use Breakpoint on ___System______error method for more information!)\n");
72   }
73
74   public static native void exit(int status);
75
76   public static native void printI(int status);
77
78   public static native void clearPrefetchCache();
79
80   public static native void rangePrefetch(Object o, short[] offsets);
81
82   public static native void deepArrayCopy(Object dst, Object src);
83
84   public static native void Assert(boolean status);
85
86   /* Only used for microbenchmark testing of SingleTM version */
87   public static native void logevent(int event);
88   public static native void logevent();
89
90   /* Only used for microbenchmark testing of SingleTM version */
91   public static native void initLog();
92
93   public static native void flushToFile(int threadid);
94   /* Only used for microbenchmark testing of SingleTM version */
95
96   public static native void arraycopy(Object src, int srcPos, Object dst, int destPos, int length);
97
98   // for disjoint reachability analysis
99   public static void genReach();
100   
101   private static Properties props;
102   
103   static {
104     setProperty("line.separator", "\n");
105   }
106   
107   public static Properties getProperties() {
108     return props;
109   }
110   
111   public static String getProperty(String key) {
112     if(props != null) {
113       return (String)props.getProperty(key);
114     }
115     return "";
116   }
117   
118   public static String setProperty(String key, String value) {
119     if(props == null) {
120       props = new Properties();
121     }
122     return (String)props.setProperty(key, value);
123   }
124   
125   public static void setOut(PrintStream out) {
126     out = out;
127   }
128
129   public static void setErr(PrintStream err) {
130     err = err;
131   }
132 }