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


Java CompilerDirectives.inInterpreter方法代码示例

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


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

示例1: executeImpl

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Override
protected Object executeImpl(VirtualFrame originalFrame) {
    FrameWithoutBoxing loopFrame = (FrameWithoutBoxing) (originalFrame);
    FrameWithoutBoxing parentFrame = (FrameWithoutBoxing) (loopFrame.getArguments()[0]);
    executeTransfer(parentFrame, loopFrame, readFrameSlots, readFrameSlotsTags);
    try {
        while (loopNode.getRepeatingNode().executeRepeating(loopFrame)) {
            if (CompilerDirectives.inInterpreter()) {
                return Boolean.FALSE;
            }
        }
        return Boolean.TRUE;
    } finally {
        executeTransfer(loopFrame, parentFrame, writtenFrameSlots, writtenFrameSlotsTags);
    }
}
 
开发者ID:graalvm,项目名称:graal-core,代码行数:17,代码来源:OptimizedOSRLoopNode.java

示例2: 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

示例3: doPutEvalBlock

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization
public SMutableArray doPutEvalBlock(final SMutableArray rcvr,
    final SBlock block, final long length) {
  if (length <= 0) {
    return rcvr;
  }

  try {
    Object newStorage = ArraySetAllStrategy.evaluateFirstDetermineStorageAndEvaluateRest(
        block, length, this.block);
    rcvr.transitionTo(newStorage);
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return rcvr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:PutAllNode.java

示例4: doEmptyArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "arr.isEmptyType()")
public final SArray doEmptyArray(final SArray arr, final SBlock block) {
  int length = arr.getEmptyStorage(storageType);
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(block, Nil.nilObject);
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(block, Nil.nilObject);
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:DoPrim.java

示例5: doPartiallyEmptyArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "arr.isPartiallyEmptyType()")
public final SArray doPartiallyEmptyArray(final SArray arr, final SBlock block) {
  PartiallyEmptyArray storage = arr.getPartiallyEmptyStorage(storageType);
  int length = storage.getLength();
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(block, storage.get(SArray.FIRST_IDX));
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(block, storage.get(i));
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:DoPrim.java

示例6: doObjectArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "arr.isObjectType()")
public final SArray doObjectArray(final SArray arr, final SBlock block) {
  Object[] storage = arr.getObjectStorage(storageType);
  int length = storage.length;
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(block, storage[SArray.FIRST_IDX]);
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(block, storage[(int) i]);
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:DoPrim.java

示例7: doLongArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "arr.isLongType()")
public final SArray doLongArray(final SArray arr, final SBlock block) {
  long[] storage = arr.getLongStorage(storageType);
  int length = storage.length;
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(block, storage[SArray.FIRST_IDX]);
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(block, storage[(int) i]);
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:DoPrim.java

示例8: doDoubleArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "arr.isDoubleType()")
public final SArray doDoubleArray(final SArray arr, final SBlock block) {
  double[] storage = arr.getDoubleStorage(storageType);
  int length = storage.length;
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(block, storage[SArray.FIRST_IDX]);
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(block, storage[(int) i]);
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:DoPrim.java

示例9: doBooleanArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "arr.isBooleanType()")
public final SArray doBooleanArray(final SArray arr, final SBlock block) {
  boolean[] storage = arr.getBooleanStorage(storageType);
  int length = storage.length;
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(block, storage[SArray.FIRST_IDX]);
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(block, storage[(int) i]);
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(length, this);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:DoPrim.java

示例10: create

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "isValueArrayClass(valueArrayClass)")
public SImmutableArray create(final SClass valueArrayClass, final long size,
    final SBlock block) {
  if (size <= 0) {
    return new SImmutableArray(0, valueArrayClass);
  }

  try {
    Object newStorage = ArraySetAllStrategy.evaluateFirstDetermineStorageAndEvaluateRest(
        block, size, this.block, isValue);
    return new SImmutableArray(newStorage, valueArrayClass);
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(size, this);
    }
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:NewImmutableArrayNode.java

示例11: doWhileUnconditionally

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
protected final Object doWhileUnconditionally(final SBlock loopCondition,
    final SBlock loopBody) {
  long iterationCount = 0;

  boolean loopConditionResult = (boolean) conditionValueSend.call(
      new Object[] {loopCondition});

  try {
    // TODO: this is a simplification, we don't cover the case receiver isn't a boolean
    while (loopConditionResult == predicateBool) {
      bodyValueSend.call(new Object[] {loopBody});
      loopConditionResult = (boolean) conditionValueSend.call(
          new Object[] {loopCondition});

      if (CompilerDirectives.inInterpreter()) {
        iterationCount++;
      }
      ObjectTransitionSafepoint.INSTANCE.checkAndPerformSafepoint();
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(iterationCount, this);
    }
  }
  return Nil.nilObject;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:27,代码来源:AbstractWhileNode.java

示例12: executeGeneric

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Override
public Object executeGeneric(final VirtualFrame frame) {
  long iterationCount = 0;

  // TODO: this is a simplification, we don't cover the case receiver isn't a boolean
  boolean loopConditionResult = evaluateCondition(frame);

  try {
    while (loopConditionResult == expectedBool) {
      bodyNode.executeGeneric(frame);
      loopConditionResult = evaluateCondition(frame);

      if (CompilerDirectives.inInterpreter()) {
        iterationCount++;
      }
      ObjectTransitionSafepoint.INSTANCE.checkAndPerformSafepoint();
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      SomLoop.reportLoopCount(iterationCount, this);
    }
  }
  return Nil.nilObject;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:25,代码来源:WhileInlinedLiteralsNode.java

示例13: doLoop

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
public static long doLoop(final DirectCallNode value,
    final Node loopNode, final long receiver, final long limit, final long step,
    final SBlock block) {
  try {
    if (receiver <= limit) {
      value.call(new Object[] {block, receiver});
    }
    for (long i = receiver + step; i <= limit; i += step) {
      value.call(new Object[] {block, i});
      ObjectTransitionSafepoint.INSTANCE.checkAndPerformSafepoint();
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      long loopCount = limit - receiver;
      if (loopCount > 0) {
        SomLoop.reportLoopCount(loopCount, loopNode);
      }
    }
  }
  return receiver;
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:22,代码来源:IntToByDoMessageNode.java

示例14: doLooping

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
protected final void doLooping(final VirtualFrame frame, final long from, final long to) {
  if (from <= to) {
    frame.setLong(loopIndex, from);
    body.executeGeneric(frame);
  }

  if (CompilerDirectives.inInterpreter()) {
    loopFrequency = Math.max(0.0, Math.max(loopFrequency, (to - from) / (to - from + 1.0)));
  }

  for (long i = from + 1; CompilerDirectives.injectBranchProbability(loopFrequency,
      i <= to); i++) {
    frame.setLong(loopIndex, i);
    body.executeGeneric(frame);
    ObjectTransitionSafepoint.INSTANCE.checkAndPerformSafepoint();
  }
}
 
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:IntToDoInlinedLiteralsNode.java

示例15: doEmptyArray

import com.oracle.truffle.api.CompilerDirectives; //导入方法依赖的package包/类
@Specialization(guards = "isEmptyType(arr)")
public final SArray doEmptyArray(final VirtualFrame frame,
    final SArray arr, final SBlock block) {
  int length = arr.getEmptyStorage(storageType);
  try {
    if (SArray.FIRST_IDX < length) {
      execBlock(frame, block, Nil.nilObject);
    }
    for (long i = SArray.FIRST_IDX + 1; i < length; i++) {
      execBlock(frame, block, Nil.nilObject);
    }
  } finally {
    if (CompilerDirectives.inInterpreter()) {
      reportLoopCount(length);
    }
  }
  return arr;
}
 
开发者ID:smarr,项目名称:TruffleSOM,代码行数:19,代码来源:DoPrim.java


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