Mercurial > hg > truffle
changeset 19606:d344d76b7b6d
Truffle: Node cleanup
author | Andreas Woess <andreas.woess@oracle.com> |
---|---|
date | Fri, 27 Feb 2015 14:55:42 +0100 |
parents | 4efe39251424 |
children | 73811d1b4cd0 |
files | graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java |
diffstat | 1 files changed, 5 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Fri Feb 27 13:56:01 2015 +0100 +++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java Fri Feb 27 14:55:42 2015 +0100 @@ -41,7 +41,6 @@ public abstract class Node implements NodeInterface, Cloneable { @CompilationFinal private Node parent; - @CompilationFinal private SourceSection sourceSection; /** @@ -573,11 +572,7 @@ public final void atomic(Runnable closure) { RootNode rootNode = getRootNode(); - if (rootNode != null) { - synchronized (rootNode) { - closure.run(); - } - } else { + synchronized (rootNode != null ? rootNode : GIL) { closure.run(); } } @@ -585,14 +580,10 @@ public final <T> T atomic(Callable<T> closure) { try { RootNode rootNode = getRootNode(); - if (rootNode != null) { - synchronized (rootNode) { - return closure.call(); - } - } else { + synchronized (rootNode != null ? rootNode : GIL) { return closure.call(); } - } catch (RuntimeException e) { + } catch (RuntimeException | Error e) { throw e; } catch (Exception e) { throw new RuntimeException(e); @@ -625,4 +616,6 @@ } return ""; } + + private static final Object GIL = new Object(); }