当前位置: 首页>>代码示例>>Java>>正文


Java CompilerDirectives.transferToInterpreterAndInvalidate方法代码示例

本文整理汇总了Java中com.oracle.truffle.api.CompilerDirectives.transferToInterpreterAndInvalidate方法的典型用法代码示例。如果您正苦于以下问题:Java CompilerDirectives.transferToInterpreterAndInvalidate方法的具体用法?Java CompilerDirectives.transferToInterpreterAndInvalidate怎么用?Java CompilerDirectives.transferToInterpreterAndInvalidate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.oracle.truffle.api.CompilerDirectives的用法示例。


在下文中一共展示了CompilerDirectives.transferToInterpreterAndInvalidate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: instantiateClassObject

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
private SClass instantiateClassObject(final SObject rcvr) {
  if (superclassAndMixinResolver == null) {
    CompilerDirectives.transferToInterpreterAndInvalidate();
    createResolverCallTargets();
  }

  Object superclassAndMixins = superclassAndMixinResolver.call(new Object[] {rcvr});
  SClass classObject = instantiation.execute(rcvr, superclassAndMixins);
  return classObject;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:11,代码来源:ClassSlotAccessNode.java

示例2: executeRepeating

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Override
public boolean executeRepeating(VirtualFrame frame) {
    try {
        if (invalidationCounter >= 0) {
            if (invalidationCounter == 0) {
                CompilerDirectives.transferToInterpreterAndInvalidate();
                invalidationCounter = -1; // disable
            } else {
                invalidationCounter--;
            }
        }

        if (CompilerDirectives.inCompiledCode()) {
            compiled = true;
        } else {
            compiled = false;
        }

        int counter = frame.getInt(param1);
        frame.setInt(param1, counter - 1);
        return counter != 0;
    } catch (FrameSlotTypeException e) {
        return false;
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:26,代码来源:OptimizedOSRLoopNodeTest.java

示例3: getProfiledArgumentTypes

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
Class<?>[] getProfiledArgumentTypes() {
    if (profiledArgumentTypesAssumption == null) {
        /*
         * We always need an assumption. If this method is called before the profile was
         * initialized, we have to be conservative and disable profiling, which is done by
         * creating an invalid assumption but leaving the type field null.
         */
        CompilerDirectives.transferToInterpreterAndInvalidate();
        profiledArgumentTypesAssumption = createAssumption("Profiled Argument Types");
        profiledArgumentTypesAssumption.invalidate();
    }

    if (profiledArgumentTypesAssumption.isValid()) {
        return profiledArgumentTypes;
    } else {
        return null;
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:19,代码来源:OptimizedCompilationProfile.java

示例4: getProfiledReturnType

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
Class<?> getProfiledReturnType() {
    if (profiledReturnTypeAssumption == null) {
        /*
         * We always need an assumption. If this method is called before the profile was
         * initialized, we have to be conservative and disable profiling, which is done by
         * creating an invalid assumption but leaving the type field null.
         */
        CompilerDirectives.transferToInterpreterAndInvalidate();
        profiledReturnTypeAssumption = createAssumption("Profiled Return Type");
        profiledReturnTypeAssumption.invalidate();
    }

    if (profiledReturnTypeAssumption.isValid()) {
        return profiledReturnType;
    } else {
        return null;
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:19,代码来源:OptimizedCompilationProfile.java

示例5: profileReturnValue

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
final void profileReturnValue(Object result) {
    Assumption returnTypeAssumption = profiledReturnTypeAssumption;
    if (CompilerDirectives.inInterpreter() && returnTypeAssumption == null) {
        // we only profile return values in the interpreter as we don't want to deoptimize
        // for immediate compiles.
        if (TruffleCompilerOptions.getValue(TruffleReturnTypeSpeculation)) {
            profiledReturnType = classOf(result);
            profiledReturnTypeAssumption = createAssumption("Profiled Return Type");
        }
    } else if (profiledReturnType != null) {
        if (result == null || profiledReturnType != result.getClass()) {
            CompilerDirectives.transferToInterpreterAndInvalidate();
            profiledReturnType = null;
            returnTypeAssumption.invalidate();
        }
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:18,代码来源:OptimizedCompilationProfile.java

示例6: profileExceptionType

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
final <E extends Throwable> E profileExceptionType(E ex) {
    Class<?> cachedClass = exceptionType;
    // if cachedClass is null and we are not in the interpreter we don't want to deoptimize
    // This usually happens only if the call target was compiled using compile without ever
    // calling it.
    if (cachedClass != Object.class) {
        if (cachedClass != null && cachedClass == ex.getClass()) {
            return (E) cachedClass.cast(ex);
        }
        CompilerDirectives.transferToInterpreterAndInvalidate();
        if (cachedClass == null) {
            exceptionType = ex.getClass();
        } else {
            // object class is not reachable for exceptions
            exceptionType = Object.class;
        }
    }
    return ex;
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:21,代码来源:OptimizedCompilationProfile.java

示例7: setLayoutAndTransferFields

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
private void setLayoutAndTransferFields() {
  CompilerDirectives.transferToInterpreterAndInvalidate();

  ObjectLayout layoutAtClass;
  synchronized (clazz) {
    layoutAtClass = clazz.getLayoutForInstances();
    if (objectLayout == layoutAtClass) {
      return;
    }
  }

  HashMap<SlotDefinition, Object> fieldValues = getAllFields();

  objectLayout = layoutAtClass;
  extensionPrimFields = getExtendedPrimStorage(layoutAtClass);
  extensionObjFields = getExtendedObjectStorage(layoutAtClass);

  setAllFields(fieldValues);
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:20,代码来源:SObject.java

示例8: evalForRemainingNils

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的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

示例9: resolvePromise

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
protected final void resolvePromise(final VirtualFrame frame,
    final SResolver resolver, final Object result,
    final boolean haltOnResolver, final boolean haltOnResolution) {
  // lazy initialization of resolution node
  if (resolve == null) {
    CompilerDirectives.transferToInterpreterAndInvalidate();
    if (resolver == null) {
      this.resolve = insert(new NullResolver(sourceSection));
    } else {
      this.resolve = insert(ResolvePromiseNodeFactory.create(false, sourceSection, vm, null,
          null, null, null));
    }
  }

  // resolve promise
  resolve.executeEvaluated(frame, resolver, result, haltOnResolver, haltOnResolution);
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:ReceivedRootNode.java

示例10: errorPromise

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
protected final void errorPromise(final VirtualFrame frame,
    final SResolver resolver, final Object exception,
    final boolean haltOnResolver, final boolean haltOnResolution) {
  // lazy initialization of resolution node
  if (error == null) {
    CompilerDirectives.transferToInterpreterAndInvalidate();
    if (resolver == null) {
      this.error = insert(new NullResolver(getSourceSection()));
    } else {
      this.error = insert(
          ErrorPromiseNodeFactory.create(false, sourceSection, vm, null, null, null, null));
    }
  }

  // error promise
  error.executeEvaluated(frame, resolver, exception, haltOnResolver, haltOnResolution);
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:ReceivedRootNode.java

示例11: doPreEvaluated

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Override
public Object doPreEvaluated(final VirtualFrame frame, final Object[] args) {
  CompilerDirectives.transferToInterpreterAndInvalidate();
  // this specialize method is designed to be execute only once and
  // tracks its replacement nodes to avoid re-specialization in case of
  // re-execution
  PreevaluatedExpression newNode;
  Lock lock = getLock();
  try {
    lock.lock();
    newNode = specialize(args);
  } finally {
    lock.unlock();
  }
  return newNode.doPreEvaluated(frame, args);
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:17,代码来源:ResolvingImplicitReceiverSend.java

示例12: doWrite

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Override
public void doWrite(final SObject obj, final Object value) {
  if (value instanceof Long) {
    accessor.write(obj, (long) value);
    if (!accessor.isPrimitiveSet(obj, primMarkProfile)) {
      CompilerDirectives.transferToInterpreterAndInvalidate();
      accessor.markPrimAsSet(obj);

      // fall back to LongSlotWriteSetOrUnset
      replace(new LongSlotWriteSetOrUnset(slot, accessor, guard, nextInCache));
    }
  } else {
    TruffleCompiler.transferToInterpreterAndInvalidate("unstabelized write node");
    ObjectTransitionSafepoint.INSTANCE.writeAndGeneralizeSlot(obj, slot, value);
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:17,代码来源:CachedSlotWrite.java

示例13: setSlow

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(replaces = "setFast")
public Object setSlow(Symbol symbol, Object value) {
    CompilerDirectives.transferToInterpreterAndInvalidate();

    FrameSlot frameSlot = lookupFrameSlot(symbol);
    this.getGlobalFrame().setObject(frameSlot, value);
    return value;
}
 
开发者ID:ragnard,项目名称:shen-truffle,代码行数:9,代码来源:Set.java

示例14: valueSlow

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(replaces = "value")
public Object valueSlow(Symbol symbol) {
    CompilerDirectives.transferToInterpreterAndInvalidate();

    FrameSlot frameSlot = lookupFrameSlot(symbol);

    if (frameSlot == null) {
        throw new RuntimeException("value: not set: " + symbol);
    }
    try {
        return this.getContext().getGlobalFrame().getObject(frameSlot);
    } catch (FrameSlotTypeException e) {
        throw new RuntimeException("value: frame slot type", e);
    }
}
 
开发者ID:ragnard,项目名称:shen-truffle,代码行数:16,代码来源:Value.java

示例15: eval

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization
//@CompilerDirectives.TruffleBoundary
public Object eval(VirtualFrame frame, Object expr) {
    CompilerDirectives.transferToInterpreterAndInvalidate();

    //System.out.println("eval: " + expr);

    RootNode root = Analyzer.analyzeRoot(getContext().getLanguage(), expr, Builtins.BUILTIN_SOURCE.createUnavailableSection());
    /*if(this.isTail()) {
        root.setIsTail();
    }*/
    CallTarget callTarget = Truffle.getRuntime().createCallTarget(root);

    return callTarget.call(frame.getArguments()[0]);
}
 
开发者ID:ragnard,项目名称:shen-truffle,代码行数:16,代码来源:Eval.java


注:本文中的com.oracle.truffle.api.CompilerDirectives.transferToInterpreterAndInvalidate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。