php.runtime.env.Environment.popCall()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(7.7k)|赞(0)|评价(0)|浏览(90)

本文整理了Java中php.runtime.env.Environment.popCall()方法的一些代码示例,展示了Environment.popCall()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Environment.popCall()方法的具体详情如下:
包路径:php.runtime.env.Environment
类名称:Environment
方法名:popCall

Environment.popCall介绍

暂无

代码示例

代码示例来源:origin: jphp-group/jphp

@Override
public void popCall() {
  env.popCall();
  env.popCall();
}

代码示例来源:origin: jphp-group/jphp

@Override
public void popCall() {
  env.popCall();
  env.popCall();
}

代码示例来源:origin: jphp-group/jphp

protected void popCall(){
  env.popCall();
}

代码示例来源:origin: jphp-group/jphp

public static Memory call_user_func(Environment env, TraceInfo trace, Memory function, Memory... args)
    throws Throwable {
  Memory[] passed;
  if (args == null) {
    passed = new Memory[]{function};
  } else {
    passed = new Memory[args.length + 1];
    System.arraycopy(args, 0, passed, 1, args.length);
    passed[0] = function;
  }
  env.pushCall(trace, null, passed, "call_user_func", null, null);
  try {
    return _call_user_func(env, trace, function, args);
  } finally {
    env.popCall();
  }
}

代码示例来源:origin: jphp-group/jphp

protected boolean eof() {
  env.pushCall(stream, "eof");
  try {
    return stream.eof(env).toBoolean();
  } finally {
    env.popCall();
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
  public void reset() {
    currentKey = Memory.CONST_INT_M1;
    env.pushCall(stream, "seek", Memory.CONST_INT_0);
    try {
      stream.seek(env, Memory.CONST_INT_0);
    } catch (IOException e) {
      env.catchUncaught(e);
    } finally {
      env.popCall();
    }
  }
}));

代码示例来源:origin: jphp-group/jphp

@Override
  public Memory getMemoryKey() {
    if (keyInit)
      return (Memory) currentKey;
    if (!isNative)
      env.pushCall(trace, ObjectMemory.this.value, null, "key", className, null);
    try {
      currentKey = iterator.key(env).toImmutable();
      keyInit = true;
      return (Memory) currentKey;
    } finally {
      if (!isNative)
        env.popCall();
    }
  }
};

代码示例来源:origin: jphp-group/jphp

public static Memory call_user_func_array(Environment env, TraceInfo trace, Memory function, Memory args)
    throws Throwable {
  if (expecting(env, trace, 2, args, Memory.Type.ARRAY)) {
    Memory[] passed = new Memory[]{function, args};
    env.pushCall(trace, null, passed, "call_user_func_array", null, null);
    try {
      return _call_user_func(env, trace, function, ((ArrayMemory) args).values(false));
    } finally {
      env.popCall();
    }
  }
  return Memory.FALSE;
}

代码示例来源:origin: jphp-group/jphp

@Signature
public Memory call(Environment env, Memory... args) {
  invoker.setTrace(env.trace());
  env.popCall();
  try {
    return invoker.callNoThrow(args);
  } finally {
    env.pushCall(this, "call");
  }
}

代码示例来源:origin: jphp-group/jphp

/**
 * Remove all method which does not destruct
 *
 * @throws Throwable
 */
public void finalizeObjects() throws Throwable {
  cleanGcObjects();
  for (WeakReference<IObject> el : new HashSet<>(gcObjects)) {
    IObject o = el.get();
    if (o == null)
      continue;
    ClassEntity entity = o.getReflection();
    if (entity.methodDestruct != null) {
      if (!o.isFinalized()) {
        o.doFinalize();
        pushCall(o, entity.methodDestruct.getName());
        try {
          entity.methodDestruct.invokeDynamic(o, this, TraceInfo.UNKNOWN);
        } finally {
          popCall();
        }
      }
    }
  }
  gcObjects.clear();
}

代码示例来源:origin: jphp-group/jphp

protected boolean rewind() {
  if (getReferences && value instanceof Generator) {
    if (!((Generator) value).isReturnReferences()) {
      env.exception(trace, "You can only iterate a generator by-reference if it declared that it yields by-reference");
    }
  }
  if (!rewind) {
    if (!isNative)
      env.pushCall(trace, ObjectMemory.this.value, null, "rewind", className, null);
    try {
      return iterator.rewind(env).toValue() != FALSE;
    } finally {
      rewind = true;
      if (!isNative)
        env.popCall();
    }
  }
  return true;
}

代码示例来源:origin: jphp-group/jphp

private Memory __import(String path, ArrayMemory locals, TraceInfo trace, String funcName, boolean once, Callback<Void, Void> callback)
    throws Throwable {
  synchronized (moduleManager) {
    if (once && moduleManager.hasModule(path)) {
      return Memory.TRUE;
    }
    ModuleEntity module = moduleManager.fetchModule(path, path.endsWith(".phb"));
    if (module == null) {
      callback.call(null);
      return Memory.FALSE;
    }
    CallStackItem stackItem = pushCall(
        trace, null, new Memory[]{StringMemory.valueOf(path)}, funcName, null, null
    );
    try {
      if (locals == null) {
        locals = new ArrayMemory();
      }
      return module.include(this, locals);
    } finally {
      popCall();
    }
  }
}

代码示例来源:origin: jphp-group/jphp

@Override
protected boolean nextValue() {
  if (eof())
    return false;
  env.pushCall(stream, "read", LongMemory.valueOf(chunkSize));
  try {
    currentValue = stream.read(env, LongMemory.valueOf(chunkSize));
    currentKey = ((LongMemory) currentKey).inc();
  } catch (IOException e) {
    env.catchUncaught(e);
  } finally {
    env.popCall();
  }
  return true;
}

代码示例来源:origin: jphp-group/jphp

protected Memory _next(Environment env) {
  if (busy) {
    env.error(env.trace(), "Cannot resume an already running generator");
  }
  boolean x2 = false;
  if (callStackItem != null) {
    env.pushCall(new CallStackItem(callStackItem));
    x2 = true;
  }
  try {
    counter += 1;
    busy = true;
    return iterator.next().getValue();
  } catch (NoSuchElementException e) {
    valid = false;
    callStackItem = null;
  } finally {
    if (x2) env.popCall();
    busy = false;
    checkThrow();
  }
  return null;
}

代码示例来源:origin: jphp-group/jphp

throw new RuntimeException(e);
} finally {
  env.popCall();

代码示例来源:origin: jphp-group/jphp

public static Memory call(Environment env, TraceInfo trace, FunctionEntity function, Memory[] args)
    throws Throwable {
  Memory result = function.getImmutableResultTyped(env, trace);
  Memory[] passed = null;
  if (result != null && !function.hasParameters() && args == null) {
    return result;
  }
  passed = InvokeArgumentHelper.makeArguments(
      env, args, function.getParameters(), function.getName(), null, null, trace
  );
  if (result != null) {
    return result;
  }
  if (trace != null && function.isUsesStackTrace())
    env.pushCall(trace, null, args, function.getName(), null, null);
  try {
    result = function.invoke(env, trace, passed);
  } finally {
    if (trace != null && function.isUsesStackTrace())
      env.popCall();
  }
  return result;
}

代码示例来源:origin: jphp-group/jphp

@Override
public void manualUnset(Environment env) {
  ClassEntity entity = value.getReflection();
  if (entity.methodDestruct != null) {
    if (!value.isFinalized()) {
      value.doFinalize();
      env.pushCall(value, entity.methodDestruct.getName());
      try {
        if (value instanceof IManualDestructable) {
          ((IManualDestructable) value).onManualDestruct(env);
        }
        entity.methodDestruct.invokeDynamic(value, env, env.trace());
      } catch (InvocationTargetException e) {
        env.__throwException(e);
      } catch (RuntimeException e) {
        throw e;
      } catch (Throwable throwable) {
        throw new CriticalException(throwable);
      } finally {
        env.popCall();
      }
    }
  }
}

代码示例来源:origin: jphp-group/jphp

.toBoolean() ? Memory.TRUE : Memory.NULL;
} finally {
  env.popCall();

代码示例来源:origin: jphp-group/jphp

@Signature(@Arg(value = "collection", type = HintType.TRAVERSABLE))
public static Memory count(Environment env, Memory... args) {
  if (args[0].isArray())
    return LongMemory.valueOf(args[0].toValue(ArrayMemory.class).size());
  else if (args[0].isObject()) {
    ObjectMemory objectMemory = args[0].toValue(ObjectMemory.class);
    if (objectMemory.value instanceof Countable) {
      env.pushCall(objectMemory.value, "count");
      try {
        long size = ((Countable) objectMemory.value).count(env).toLong();
        return LongMemory.valueOf(size);
      } finally {
        env.popCall();
      }
    } else {
      ForeachIterator iterator = args[0].getNewIterator(env);
      if (iterator == null) {
        return Memory.FALSE;
      }
      int r = 0;
      while (iterator.next()) r++;
      return LongMemory.valueOf(r);
    }
  } else
    return Memory.CONST_INT_0;
}

代码示例来源:origin: jphp-group/jphp

public static Memory callStatic(Environment env, TraceInfo trace,
                MethodEntity method, @Nullable String staticClass,
                Memory[] args, boolean checkAccess)
    throws Throwable {
  if (checkAccess)
    checkAccess(env, trace, method);
  Memory result = method.getImmutableResultTyped(env, trace);
  if (result != null) {
    return result;
  }
  String originClassName = method.getClazz().getName();
  String originMethodName = method.getName();
  String staticClazz = staticClass == null ? originClassName : staticClass;
  Memory[] passed = InvokeArgumentHelper.makeArguments(
      env, args, method.getParameters(), originClassName, originMethodName, staticClass, trace
  );
  try {
    if (trace != null && method.isUsesStackTrace()) {
      env.pushCallEx(trace, null, passed, originMethodName, method.getClazz(), staticClazz);
    }
    return method.invokeStatic(env, passed);
  } finally {
    if (trace != null && method.isUsesStackTrace())
      env.popCall();
  }
}

相关文章