comparison c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/InvocationSocket.java @ 2289:6190d20bd6d6

merge
author Lukas Stadler <lukas.stadler@jku.at>
date Mon, 11 Apr 2011 11:25:06 +0200
parents 8c426c2891c8
children 160aacf936ad
comparison
equal deleted inserted replaced
2288:8c426c2891c8 2289:6190d20bd6d6
77 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable { 77 public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {
78 if (!method.getDeclaringClass().isInterface()) { 78 if (!method.getDeclaringClass().isInterface()) {
79 return method.invoke(receiver, args); 79 return method.invoke(receiver, args);
80 } 80 }
81 try { 81 try {
82 //Logger.startScope("invoking remote " + method.getName()); 82 Logger.startScope("invoking remote " + method.getName());
83 output.writeObject(new Invocation(receiver, method.getName(), args)); 83 output.writeObject(new Invocation(receiver, method.getName(), args));
84 output.flush(); 84 output.flush();
85 return waitForResult(); 85 return waitForResult();
86 } catch (Throwable t) { 86 } catch (Throwable t) {
87 t.printStackTrace(); 87 t.printStackTrace();
88 throw t; 88 throw t;
89 } finally { 89 } finally {
90 //Logger.endScope(""); 90 Logger.endScope("");
91 } 91 }
92 } 92 }
93 } 93 }
94 94
95 public Object waitForResult() throws IOException, ClassNotFoundException { 95 public Object waitForResult() throws IOException, ClassNotFoundException {
120 output.flush(); 120 output.flush();
121 } else { 121 } else {
122 Object result; 122 Object result;
123 try { 123 try {
124 if (invoke.args == null) { 124 if (invoke.args == null) {
125 //Logger.startScope("invoking local " + invoke.methodName); 125 Logger.startScope("invoking local " + invoke.methodName);
126 result = method.invoke(invoke.receiver); 126 result = method.invoke(invoke.receiver);
127 } else { 127 } else {
128 /* 128 if (Logger.ENABLED) {
129 StringBuilder str = new StringBuilder(); 129 StringBuilder str = new StringBuilder();
130 str.append("invoking local " + invoke.methodName + "("); 130 str.append("invoking local " + invoke.methodName + "(");
131 for (int i = 0; i < invoke.args.length; i++) { 131 for (int i = 0; i < invoke.args.length; i++) {
132 str.append(i == 0 ? "" : ", "); 132 str.append(i == 0 ? "" : ", ");
133 str.append(Logger.pretty(invoke.args[i])); 133 str.append(Logger.pretty(invoke.args[i]));
134 }
135 str.append(")");
136 Logger.startScope(str.toString());
134 } 137 }
135 str.append(")");
136 Logger.startScope(str.toString());*/
137 result = method.invoke(invoke.receiver, invoke.args); 138 result = method.invoke(invoke.receiver, invoke.args);
138 } 139 }
139 result = new Result(result); 140 result = new Result(result);
140 } catch (IllegalArgumentException e) { 141 } catch (IllegalArgumentException e) {
141 System.out.println("error while invoking " + invoke.methodName); 142 System.out.println("error while invoking " + invoke.methodName);
148 } catch (IllegalAccessException e) { 149 } catch (IllegalAccessException e) {
149 System.out.println("error while invoking " + invoke.methodName); 150 System.out.println("error while invoking " + invoke.methodName);
150 e.getCause().printStackTrace(); 151 e.getCause().printStackTrace();
151 result = e.getCause(); 152 result = e.getCause();
152 } finally { 153 } finally {
153 //Logger.endScope(""); 154 Logger.endScope("");
154 } 155 }
155 output.writeObject(result); 156 output.writeObject(result);
156 output.flush(); 157 output.flush();
157 } 158 }
158 } 159 }