com.oracle.truffle.regex.RegexObjectExecUTF8MethodGen Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of driver-cql-shaded Show documentation
Show all versions of driver-cql-shaded Show documentation
A Shaded CQL ActivityType driver for http://nosqlbench.io/
// CheckStyle: start generated
package com.oracle.truffle.regex;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.TruffleLanguage;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import com.oracle.truffle.api.dsl.GeneratedBy;
import com.oracle.truffle.api.interop.ArityException;
import com.oracle.truffle.api.interop.InteropLibrary;
import com.oracle.truffle.api.interop.UnsupportedMessageException;
import com.oracle.truffle.api.interop.UnsupportedTypeException;
import com.oracle.truffle.api.library.DynamicDispatchLibrary;
import com.oracle.truffle.api.library.LibraryExport;
import com.oracle.truffle.api.library.LibraryFactory;
import com.oracle.truffle.api.nodes.Node;
import com.oracle.truffle.api.nodes.NodeCost;
import com.oracle.truffle.regex.RegexObject.ExecCompiledRegexNode;
import com.oracle.truffle.regex.RegexObject.GetCompiledRegexNode;
import com.oracle.truffle.regex.RegexObject.RegexObjectExecUTF8Method;
import com.oracle.truffle.regex.RegexObjectFactory.ExecCompiledRegexNodeGen;
import com.oracle.truffle.regex.RegexObjectFactory.GetCompiledRegexNodeGen;
import com.oracle.truffle.regex.runtime.nodes.ExpectByteArrayHostObjectNode;
import com.oracle.truffle.regex.runtime.nodes.ExpectByteArrayHostObjectNodeGen;
import com.oracle.truffle.regex.runtime.nodes.ToLongNode;
import com.oracle.truffle.regex.runtime.nodes.ToLongNodeGen;
import java.util.concurrent.locks.Lock;
@GeneratedBy(RegexObjectExecUTF8Method.class)
final class RegexObjectExecUTF8MethodGen {
private static final LibraryFactory DYNAMIC_DISPATCH_LIBRARY_ = LibraryFactory.resolve(DynamicDispatchLibrary.class);
static {
LibraryExport.register(RegexObjectExecUTF8Method.class, new InteropLibraryExports());
}
private RegexObjectExecUTF8MethodGen() {
}
@GeneratedBy(RegexObjectExecUTF8Method.class)
private static final class InteropLibraryExports extends LibraryExport {
private InteropLibraryExports() {
super(InteropLibrary.class, RegexObjectExecUTF8Method.class, false);
}
@Override
protected InteropLibrary createUncached(Object receiver) {
assert receiver instanceof RegexObjectExecUTF8Method;
InteropLibrary uncached = new Uncached();
return uncached;
}
@Override
protected InteropLibrary createCached(Object receiver) {
assert receiver instanceof RegexObjectExecUTF8Method;
return new Cached();
}
@GeneratedBy(RegexObjectExecUTF8Method.class)
private static final class Cached extends InteropLibrary {
@CompilationFinal private volatile int state_;
@Child private ExecuteData execute_cache;
Cached() {
}
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof RegexObjectExecUTF8Method) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof RegexObjectExecUTF8Method;
}
@Override
public boolean hasLanguage(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((RegexObjectExecUTF8Method) receiver)).hasLanguage();
}
@Override
public Class extends TruffleLanguage>> getLanguage(Object receiver) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((RegexObjectExecUTF8Method) receiver)).getLanguage();
}
@Override
public Object toDisplayString(Object receiver, boolean allowSideEffects) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((RegexObjectExecUTF8Method) receiver)).toDisplayString(allowSideEffects);
}
@Override
public boolean isExecutable(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
return (((RegexObjectExecUTF8Method) receiver)).isExecutable();
}
@Override
public Object execute(Object arg0Value_, Object... arg1Value) throws UnsupportedTypeException, ArityException, UnsupportedMessageException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
assert assertAdopted();
RegexObjectExecUTF8Method arg0Value = ((RegexObjectExecUTF8Method) arg0Value_);
int state = state_;
if (state != 0 /* is-active execute(RegexObjectExecUTF8Method, Object[], GetCompiledRegexNode, ExpectByteArrayHostObjectNode, ToLongNode, ExecCompiledRegexNode) */) {
ExecuteData s1_ = this.execute_cache;
if (s1_ != null) {
return arg0Value.execute(arg1Value, s1_.getCompiledRegexNode_, s1_.expectByteArrayHostObjectNode_, s1_.toLongNode_, s1_.execNode_);
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value, arg1Value);
}
private Object executeAndSpecialize(RegexObjectExecUTF8Method arg0Value, Object[] arg1Value) throws ArityException, UnsupportedTypeException, UnsupportedMessageException {
Lock lock = getLock();
boolean hasLock = true;
lock.lock();
int state = state_;
try {
ExecuteData s1_ = super.insert(new ExecuteData());
s1_.getCompiledRegexNode_ = s1_.insertAccessor((GetCompiledRegexNodeGen.create()));
s1_.expectByteArrayHostObjectNode_ = s1_.insertAccessor((ExpectByteArrayHostObjectNodeGen.create()));
s1_.toLongNode_ = s1_.insertAccessor((ToLongNode.create()));
s1_.execNode_ = s1_.insertAccessor((ExecCompiledRegexNodeGen.create()));
this.execute_cache = s1_;
this.state_ = state = state | 0b1 /* add-active execute(RegexObjectExecUTF8Method, Object[], GetCompiledRegexNode, ExpectByteArrayHostObjectNode, ToLongNode, ExecCompiledRegexNode) */;
lock.unlock();
hasLock = false;
return arg0Value.execute(arg1Value, s1_.getCompiledRegexNode_, s1_.expectByteArrayHostObjectNode_, s1_.toLongNode_, s1_.execNode_);
} finally {
if (hasLock) {
lock.unlock();
}
}
}
@Override
public NodeCost getCost() {
int state = state_;
if (state == 0b0) {
return NodeCost.UNINITIALIZED;
} else {
return NodeCost.MONOMORPHIC;
}
}
@GeneratedBy(RegexObjectExecUTF8Method.class)
private static final class ExecuteData extends Node {
@Child GetCompiledRegexNode getCompiledRegexNode_;
@Child ExpectByteArrayHostObjectNode expectByteArrayHostObjectNode_;
@Child ToLongNode toLongNode_;
@Child ExecCompiledRegexNode execNode_;
ExecuteData() {
}
@Override
public NodeCost getCost() {
return NodeCost.NONE;
}
T insertAccessor(T node) {
return super.insert(node);
}
}
}
@GeneratedBy(RegexObjectExecUTF8Method.class)
private static final class Uncached extends InteropLibrary {
Uncached() {
}
@TruffleBoundary
@Override
public boolean accepts(Object receiver) {
assert !(receiver instanceof RegexObjectExecUTF8Method) || DYNAMIC_DISPATCH_LIBRARY_.getUncached().dispatch(receiver) == null : "Invalid library export. Exported receiver with dynamic dispatch found but not expected.";
return receiver instanceof RegexObjectExecUTF8Method;
}
@Override
public boolean isAdoptable() {
return false;
}
@Override
public NodeCost getCost() {
return NodeCost.MEGAMORPHIC;
}
@TruffleBoundary
@Override
public boolean hasLanguage(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((AbstractRegexObject) receiver) .hasLanguage();
}
@TruffleBoundary
@Override
public Class extends TruffleLanguage>> getLanguage(Object receiver) throws UnsupportedMessageException {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((AbstractRegexObject) receiver) .getLanguage();
}
@TruffleBoundary
@Override
public Object toDisplayString(Object receiver, boolean allowSideEffects) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((AbstractRegexObject) receiver) .toDisplayString(allowSideEffects);
}
@TruffleBoundary
@Override
public boolean isExecutable(Object receiver) {
assert this.accepts(receiver) : "Invalid library usage. Library does not accept given receiver.";
return ((RegexObjectExecUTF8Method) receiver) .isExecutable();
}
@TruffleBoundary
@Override
public Object execute(Object arg0Value_, Object... arg1Value) throws ArityException, UnsupportedTypeException, UnsupportedMessageException {
assert this.accepts(arg0Value_) : "Invalid library usage. Library does not accept given receiver.";
RegexObjectExecUTF8Method arg0Value = ((RegexObjectExecUTF8Method) arg0Value_);
return arg0Value.execute(arg1Value, (GetCompiledRegexNodeGen.getUncached()), (ExpectByteArrayHostObjectNodeGen.getUncached()), (ToLongNodeGen.getUncached()), (ExecCompiledRegexNodeGen.getUncached()));
}
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy