Mercurial > hg > graal-compiler
changeset 23084:16c59c5ddaeb
mark the cas-locked path out of a monitorenter snippet
author | Doug Simon <doug.simon@oracle.com> |
---|---|
date | Wed, 25 Nov 2015 14:50:57 +0100 |
parents | 4974a3ed58ed |
children | a19b68d309a2 |
files | graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AcquiredCASLockNode.java graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java |
diffstat | 2 files changed, 61 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/AcquiredCASLockNode.java Wed Nov 25 14:50:57 2015 +0100 @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.hotspot.nodes; + +import com.oracle.graal.compiler.common.type.StampFactory; +import com.oracle.graal.graph.NodeClass; +import com.oracle.graal.nodeinfo.NodeInfo; +import com.oracle.graal.nodes.FixedWithNextNode; +import com.oracle.graal.nodes.ValueNode; +import com.oracle.graal.nodes.spi.LIRLowerable; +import com.oracle.graal.nodes.spi.NodeLIRBuilderTool; + +/** + * Marks the control flow path where an object acquired a lightweight lock based on an atomic + * compare-and-swap (CAS) of the mark word in the object's header. + */ +@NodeInfo +public final class AcquiredCASLockNode extends FixedWithNextNode implements LIRLowerable { + public static final NodeClass<AcquiredCASLockNode> TYPE = NodeClass.create(AcquiredCASLockNode.class); + + @Input ValueNode object; + + public AcquiredCASLockNode(ValueNode object) { + super(TYPE, StampFactory.forVoid()); + this.object = object; + } + + public ValueNode object() { + return object; + } + + public void generate(NodeLIRBuilderTool generator) { + // This is just a marker node so it generates nothing + } + + @NodeIntrinsic + public static native void mark(Object object); +}
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Wed Nov 25 14:48:57 2015 +0100 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/replacements/MonitorSnippets.java Wed Nov 25 14:50:57 2015 +0100 @@ -74,6 +74,7 @@ import com.oracle.graal.graph.iterators.NodeIterable; import com.oracle.graal.hotspot.meta.HotSpotProviders; import com.oracle.graal.hotspot.meta.HotSpotRegistersProvider; +import com.oracle.graal.hotspot.nodes.AcquiredCASLockNode; import com.oracle.graal.hotspot.nodes.CurrentLockNode; import com.oracle.graal.hotspot.nodes.DirectCompareAndSwapNode; import com.oracle.graal.hotspot.nodes.FastAcquireBiasedLockNode; @@ -394,6 +395,7 @@ } else { traceObject(trace, "+lock{cas}", object, true); lockCas.inc(); + AcquiredCASLockNode.mark(object); } } @@ -669,7 +671,7 @@ private static native void monitorenterStubC(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object, Word lock); @NodeIntrinsic(ForeignCallNode.class) - private static native void monitorexitStubC(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object, Word lock); + public static native void monitorexitStubC(@ConstantNodeParameter ForeignCallDescriptor descriptor, Object object, Word lock); /** * Counters for the various paths for acquiring a lock. The counters whose names start with