Mercurial > hg > truffle
diff c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/LoggingProxy.java @ 1422:3483ec571caf
* using reflected objects instead of oops
* removed scratch from allocatable registers
* instanceof xir snippet
* arraylength xir snippet
* exceptionobject xir snippet
* VMEntries and VMExits as interfaces
* calls to VMEntries and VMExits are routet through logging proxies
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Mon, 02 Aug 2010 15:44:38 -0700 |
parents | 6223633ce7dd |
children |
line wrap: on
line diff
--- a/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/LoggingProxy.java Fri Jul 23 15:53:02 2010 -0700 +++ b/c1x4hotspotsrc/HotSpotVM/src/com/sun/hotspot/c1x/LoggingProxy.java Mon Aug 02 15:44:38 2010 -0700 @@ -15,10 +15,22 @@ int argCount = args == null ? 0 : args.length; if (method.getParameterTypes().length != argCount) throw new RuntimeException("wrong parameter count"); - System.out.println("method " + method + " called with " + argCount + " args"); - if (args == null) - return method.invoke(delegate); - return method.invoke(delegate, args); + StringBuilder str = new StringBuilder(); + str.append(method.getReturnType().getSimpleName() + " " + method.getDeclaringClass().getSimpleName() + "." + method.getName() + "("); + for (int i = 0; i < argCount; i++) { + str.append(i == 0 ? "" : ", "); + str.append(Logger.pretty(args[i])); + } + str.append(")"); + Logger.startScope(str.toString()); + final Object result; + if (args == null) { + result = method.invoke(delegate); + } else { + result = method.invoke(delegate, args); + } + Logger.endScope(" = " + Logger.pretty(result)); + return result; } public static <T> T getProxy(Class<T> interf, T delegate) {