本文整理汇总了Java中com.oracle.truffle.api.nodes.ExplodeLoop类的典型用法代码示例。如果您正苦于以下问题:Java ExplodeLoop类的具体用法?Java ExplodeLoop怎么用?Java ExplodeLoop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExplodeLoop类属于com.oracle.truffle.api.nodes包,在下文中一共展示了ExplodeLoop类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE)
@Override
public int execute(VirtualFrame frame) {
Flag flag = new Flag();
int result = 0;
int i = 0;
while (i < count) {
i++;
CompilerAsserts.partialEvaluationConstant(result);
if (flag.flag) {
result++;
continue;
} else {
result--;
continue;
}
}
return result;
}
开发者ID:graalvm,项目名称:graal-core,代码行数:22,代码来源:TwoMergesExplodedLoopTestNode.java
示例2: loopExplosionKind
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public LoopExplosionKind loopExplosionKind(ResolvedJavaMethod method) {
ExplodeLoop explodeLoop = method.getAnnotation(ExplodeLoop.class);
if (explodeLoop == null) {
return LoopExplosionKind.NONE;
}
/*
* Support for the deprecated Truffle property until it is removed in a future Truffle
* release.
*/
if (explodeLoop.merge()) {
return LoopExplosionKind.MERGE_EXPLODE;
}
return LOOP_EXPLOSION_KIND_MAP.get(explodeLoop.kind());
}
开发者ID:graalvm,项目名称:graal-core,代码行数:19,代码来源:PartialEvaluator.java
示例3: getAllFields
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
private HashMap<SlotDefinition, Object> getAllFields() {
assert objectLayout != null;
HashMap<SlotDefinition, StorageLocation> locations = objectLayout.getStorageLocations();
HashMap<SlotDefinition, Object> fieldValues =
new HashMap<>((int) (locations.size() / 0.75f));
for (Entry<SlotDefinition, StorageLocation> loc : locations.entrySet()) {
if (loc.getValue().isSet(this)) {
fieldValues.put(loc.getKey(), loc.getValue().read(this));
} else {
fieldValues.put(loc.getKey(), null);
}
}
return fieldValues;
}
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:SObject.java
示例4: evalForRemaining
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
public static Object evalForRemaining(final VirtualFrame frame,
final ExpressionNode[] exprs, final long[] storage, final int next) {
for (int i = next; i < exprs.length; i++) {
try {
storage[i] = exprs[i].executeLong(frame);
} catch (UnexpectedResultException e) {
Object[] newStorage = new Object[exprs.length];
for (int j = 0; j < i; j += 1) {
newStorage[j] = storage[j];
}
newStorage[i] = e.getResult();
return evalForRemaining(frame, exprs, newStorage, i + 1);
}
}
return storage;
}
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:ArraySetAllStrategy.java
示例5: evalForRemainingNils
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
public static Object evalForRemainingNils(final VirtualFrame frame,
final ExpressionNode[] exprs, final int next) {
for (int i = next; i < exprs.length; i++) {
Object result = exprs[i].executeGeneric(frame);
if (result != Nil.nilObject) {
CompilerDirectives.transferToInterpreterAndInvalidate();
// TODO: not optimized for partially empty literals,
// changes immediately to object storage
Object[] newStorage = new Object[exprs.length];
for (int j = 0; j < i; j += 1) {
newStorage[j] = Nil.nilObject;
}
newStorage[i] = result;
return evalForRemaining(frame, exprs, newStorage, i + 1);
}
}
return exprs.length;
}
开发者ID:smarr,项目名称:SOMns,代码行数:20,代码来源:ArraySetAllStrategy.java
示例6: sendDirectMessage
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
protected void sendDirectMessage(final Object[] args, final Actor owner,
final SResolver resolver) {
CompilerAsserts.compilationConstant(args.length);
SFarReference rcvr = (SFarReference) args[0];
Actor target = rcvr.getActor();
for (int i = 0; i < args.length; i++) {
args[i] = wrapArgs[i].execute(args[i], target, owner);
}
assert !(args[0] instanceof SFarReference) : "This should not happen for this specialization, but it is handled in determineTargetAndWrapArguments(.)";
assert !(args[0] instanceof SPromise) : "Should not happen either, but just to be sure";
DirectMessage msg = new DirectMessage(target, selector, args,
owner, resolver, onReceive,
messageReceiverBreakpoint.executeShouldHalt(),
promiseResolverBreakpoint.executeShouldHalt());
if (VmSettings.ACTOR_TRACING) {
ActorExecutionTrace.sendOperation(SendOp.ACTOR_MSG, msg.getMessageId(),
target.getId());
}
target.send(msg, actorPool);
}
开发者ID:smarr,项目名称:SOMns,代码行数:27,代码来源:EventualSendNode.java
示例7: determineContext
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
protected final MaterializedFrame determineContext(final Frame frame) {
SObjectWithContext self = (SObjectWithContext) SArguments.rcvr(frame);
int i = contextLevel - 1;
if (i > 0) {
boolean doBuildChain = determineContext == null;
if (doBuildChain) {
determineContext = buildChain(self, i);
}
self = determineContext.getOuterSelf(self);
}
// Graal needs help here to see that this is always a MaterializedFrame
// so, we record explicitly a class profile
return frameType.profile(outerType.profile(self).getContext());
}
开发者ID:smarr,项目名称:SOMns,代码行数:20,代码来源:ContextualNode.java
示例8: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
public RuleResult execute(final Object[] arguments) {
CompilerAsserts.compilationConstant(rules.length);
PatternMatchFailure lastFailure = null;
for (int i = 0; i < rules.length; i++) {
try {
final Rule r = rules[i];
return r.execute(Truffle.getRuntime().createVirtualFrame(arguments, r.getFrameDescriptor()));
} catch (PatternMatchFailure pmfx) {
lastFailure = pmfx;
}
}
// there are no rules or all rules have failed. we throw a soft exception to allow alternative rules to be tried
if (lastFailure != null) {
throw lastFailure;
} else {
throw PatternMatchFailure.INSTANCE;
}
}
开发者ID:metaborg,项目名称:dynsem,代码行数:20,代码来源:NonEmptyRuleSetNode.java
示例9: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@Override
@ExplodeLoop
public void execute(VirtualFrame frame) {
final Object t = termNode.executeGeneric(frame);
CompilerAsserts.compilationConstant(cases.length);
if (cases.length == 0) {
throw PatternMatchFailure.INSTANCE;
}
// execute each of the cases until the first succeeds
for (int i = 0; i < cases.length; i++) {
try {
cases[i].execute(frame, t);
break;
} catch (CaseMatchFailure cfx) {
// the current case has failed, if it was the last case re-throw the exception
if (i == cases.length - 1) {
throw PatternMatchFailure.INSTANCE;
}
}
}
}
开发者ID:metaborg,项目名称:dynsem,代码行数:25,代码来源:CaseMatchPremise.java
示例10: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
@Override
public void execute(VirtualFrame frame, Object t) {
// execute the match
try {
pattern.executeMatch(frame, t);
} catch (PatternMatchFailure pmex) {
throw CaseMatchFailure.INSTANCE;
}
// signal that the match has actually succeeded
patternSucceeded.enter();
for (Premise p : premises) {
p.execute(frame);
}
}
开发者ID:metaborg,项目名称:dynsem,代码行数:18,代码来源:Case.java
示例11: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@Override
@ExplodeLoop
public void execute(VirtualFrame frame) {
// execute the reduction
final RuleResult res = relationLhs.execute(frame);
// evaluate the RHS pattern match
rhsNode.executeMatch(frame, res.result);
// evaluate the RHS component pattern matches
final Object[] components = res.components;
CompilerAsserts.compilationConstant(rhsRwNodes.length);
for (int i = 0; i < rhsRwNodes.length; i++) {
rhsRwNodes[i].executeMatch(frame, InterpreterUtils.getComponent(getContext(), components, i));
}
}
开发者ID:metaborg,项目名称:dynsem,代码行数:17,代码来源:RelationPremise.java
示例12: evalObject
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@Override
@ExplodeLoop
Object evalObject(VirtualFrame frame) {
Object[] arguments = new Object[argumentNodes.length];
for(int i=0; i<argumentNodes.length; i++) {
arguments[i] = argumentNodes[i].eval(frame);
}
//FIXME stupid ahead of time compilation
CallTarget callTarget = this.callTarget;
if (callTarget != null) {
return callTarget.call(frame.pack(), new ArrayArguments(arguments));
}
callTarget = callTargetMap.get(name);
this.callTarget = callTarget;
return callTarget.call(frame.pack(), new ArrayArguments(arguments));
}
开发者ID:forax,项目名称:ninal,代码行数:19,代码来源:Interpreter.java
示例13: readUpStack
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
public <T> T readUpStack(FrameGet<T> getter, Frame frame)
throws FrameSlotTypeException {
Frame lookupFrame = frame;
for (int i = 0; i < this.getDepth(); i++) {
lookupFrame = getLexicalClosure(lookupFrame);
}
return getter.get(lookupFrame, this.getSlot());
}
开发者ID:ragnard,项目名称:shen-truffle,代码行数:11,代码来源:ReadLexicalClosureVariableNode.java
示例14: executeGeneric
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@Override
@ExplodeLoop
public Object executeGeneric(VirtualFrame frame) {
CompilerAsserts.compilationConstant(this.callTargets.length);
Object ret = null;
for(int i = 0; i < this.callTargets.length; i++) {
ret = this.callTargets[i].call();
}
return ret;
}
开发者ID:ragnard,项目名称:shen-truffle,代码行数:12,代码来源:SequenceNode.java
示例15: executeGeneric
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@Override
@ExplodeLoop
public Object executeGeneric(VirtualFrame frame) {
CompilerAsserts.compilationConstant(this.argumentNodes.length);
Object[] argumentValues = new Object[this.argumentNodes.length];
for(int i = 0; i < argumentNodes.length; i++) {
argumentValues[i] = this.argumentNodes[i].executeGeneric(frame);
}
return argumentValues;
}
开发者ID:ragnard,项目名称:shen-truffle,代码行数:12,代码来源:EvaluateArgumentsNode.java
示例16: executeGeneric
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@Override
@ExplodeLoop
public Object executeGeneric(VirtualFrame frame) {
CompilerAsserts.compilationConstant(this.exprs.length);
Object ret = null;
for(ExpressionNode expr : this.exprs) {
ret = expr.executeGeneric(frame);
}
return ret;
}
开发者ID:ragnard,项目名称:shen-truffle,代码行数:12,代码来源:DoNode.java
示例17: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop(kind = LoopExplosionKind.FULL_EXPLODE_UNTIL_RETURN)
public Object execute(Object arg0Value) {
if ((arg0Value instanceof AbstractType)) {
AbstractType arg0Value0 = (AbstractType) arg0Value;
CachedData s1 = cached;
while (s1 != null) {
if ((arg0Value0 == s1.cachedOperand)) {
return s1.cachedOperand.someMethod();
}
s1 = s1.next;
}
}
CompilerDirectives.transferToInterpreterAndInvalidate();
return executeAndSpecialize(arg0Value);
}
开发者ID:graalvm,项目名称:graal-core,代码行数:16,代码来源:ExplodeLoopBlockDuplicationTest.java
示例18: executeSuccessorIndex
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
public int executeSuccessorIndex(byte value) {
for (int i = 0; i < matchers.length; i++) {
if (matchers[i].match(value)) {
return i;
}
}
CompilerDirectives.transferToInterpreter();
throw new IllegalStateException();
}
开发者ID:graalvm,项目名称:graal-core,代码行数:11,代码来源:DFAPartialEvaluationTest.java
示例19: execute
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop(kind = ExplodeLoop.LoopExplosionKind.MERGE_EXPLODE)
protected boolean execute(byte[] inputString) {
CompilerAsserts.compilationConstant(states.length);
int ip = entry;
int successor = -1;
DFAStateNode curState = null;
outer: while (true) {
CompilerAsserts.partialEvaluationConstant(ip);
CompilerAsserts.partialEvaluationConstant(states[ip]);
curState = states[ip];
if (curState.isFinalState()) {
break;
}
if (!inputStringIterator.hasNext(inputString)) {
break;
}
successor = curState.executeSuccessorIndex(inputStringIterator.next(inputString));
int[] successors = curState.getSuccessors();
for (int i = 0; i < successors.length; i++) {
if (i == successor) {
ip = successors[i];
continue outer;
}
}
CompilerDirectives.transferToInterpreter();
throw new Error();
}
return curState.isFinalState();
}
开发者ID:graalvm,项目名称:graal-core,代码行数:30,代码来源:DFAPartialEvaluationTest.java
示例20: executeSpecial
import com.oracle.truffle.api.nodes.ExplodeLoop; //导入依赖的package包/类
@ExplodeLoop
private int executeSpecial(VirtualFrame frame) {
int result = 0;
for (AbstractTestNode statement : statements) {
result = statement.execute(frame);
}
return result;
}
开发者ID:graalvm,项目名称:graal-core,代码行数:9,代码来源:ControlFlowExceptionPartialEvaluationTest.java
注:本文中的com.oracle.truffle.api.nodes.ExplodeLoop类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论