Examples of AccessorOptimizer


Examples of org.mvel2.optimizers.AccessorOptimizer

        return (newObjectOptimizer = new NewObjectArray(getBaseComponentType(egressType.getComponentType()), typeDescr.getCompiledArraySize()))
            .getValue(ctx, thisValue, factory);
      }

      try {
        AccessorOptimizer optimizer = getThreadAccessorOptimizer();

        ParserContext pCtx = this.pCtx;
        if (pCtx == null) {
          pCtx = new ParserContext();
          pCtx.getParserConfiguration().setAllImports(getInjectedImports(factory));
        }

        newObjectOptimizer = optimizer.optimizeObjectCreation(pCtx, name, 0, name.length, ctx, thisValue, factory);

        /**
         * Check to see if the optimizer actually produced the object during optimization.  If so,
         * we return that value now.
         */
        if (optimizer.getResultOptPass() != null) {
          egressType = optimizer.getEgressType();
          return optimizer.getResultOptPass();
        }
      }
      catch (CompileException e) {
        throw ErrorUtil.rewriteIfNeeded(e, expr, start);
      }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

  }

  private Object get(Object ctx, Object elCtx, VariableResolverFactory variableFactory) {
    if (nextAccessor == null) {
      Object o = accessor.getValue(ctx, elCtx, variableFactory);
      AccessorOptimizer ao = OptimizerFactory.getDefaultAccessorCompiler();
      Class ingress = accessor.getKnownEgressType();

      nextAccessor = ao.optimizeAccessor(getCurrentThreadParserContext(), nextExpr, start, offset, o, elCtx, variableFactory,
          false, ingress);
      return ao.getResultOptPass();
    }
    else {
      return accessor.getValue(ctx, elCtx, variableFactory);
    }
  }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

  private Object optimize(Object ctx, Object thisValue, VariableResolverFactory factory) {
    if ((fields & DEOP) != 0) {
      fields ^= DEOP;
    }

    AccessorOptimizer optimizer;
    Object retVal = null;

    if ((fields & NOJIT) != 0 || factory != null && factory.isResolveable(nameCache)) {
      optimizer = getAccessorCompiler(SAFE_REFLECTIVE);
    }
    else {
      optimizer = getDefaultAccessorCompiler();
    }

    ParserContext pCtx;

    if ((fields & PCTX_STORED) != 0) {
      pCtx = (ParserContext) literal;
    }
    else {
      pCtx = new ParserContext(new ParserConfiguration(getInjectedImports(factory), null));
    }

    try {
      pCtx.optimizationNotify();
      setAccessor(optimizer.optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, egressType));
    }
    catch (OptimizationNotSupported ne) {
      setAccessor((optimizer = getAccessorCompiler(SAFE_REFLECTIVE))
          .optimizeAccessor(pCtx, expr, start, offset, ctx, thisValue, factory, true, null));
    }

    if (accessor == null) {
      return get(expr, start, offset, ctx, factory, thisValue, pCtx);
    }

    if (retVal == null) {
      retVal = optimizer.getResultOptPass();
    }

    if (egressType == null) {
      egressType = optimizer.getEgressType();
    }

    return retVal;
  }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

    if (accessor != null) {
      return accessor.getValue(main.getReducedValueAccelerated(ctx, thisValue, factory), thisValue, factory);
    }
    else {
      try {
        AccessorOptimizer o = OptimizerFactory.getThreadAccessorOptimizer();
        accessor = o.optimizeAccessor(getCurrentThreadParserContext(), expr, start, offset,
            main.getReducedValueAccelerated(ctx, thisValue, factory), thisValue, factory, false, main.getEgressType());
        return o.getResultOptPass();
      }
      finally {
        OptimizerFactory.clearThreadAccessorOptimizer();
      }
    }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

  private Object optimize(Object ctx, Object elCtx, VariableResolverFactory variableResolverFactory, Object value) {
    if (DynamicOptimizer.isOverloaded()) {
      DynamicOptimizer.enforceTenureLimit();
    }

    AccessorOptimizer ao = OptimizerFactory.getAccessorCompiler("ASM");
    _accessor = ao.optimizeSetAccessor(context, property, start, offset, ctx, elCtx,
        variableResolverFactory, false, value, value != null ? value.getClass() : Object.class);
    assert _accessor != null;

    return value;
  }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

    if (DynamicOptimizer.isOverloaded()) {
      DynamicOptimizer.enforceTenureLimit();
    }

    AccessorOptimizer ao = OptimizerFactory.getAccessorCompiler("ASM");
    switch (type) {
      case DynamicOptimizer.REGULAR_ACCESSOR:
        _accessor = ao.optimizeAccessor(context, expr, start, offset, ctx, elCtx, variableResolverFactory, false, null);
        return ao.getResultOptPass();
      case DynamicOptimizer.OBJ_CREATION:
        _accessor = ao.optimizeObjectCreation(context, expr, start, offset, ctx, elCtx, variableResolverFactory);
        return _accessor.getValue(ctx, elCtx, variableResolverFactory);
      case DynamicOptimizer.COLLECTION:
        _accessor = ao.optimizeCollection(AbstractParser.getCurrentThreadParserContext(), ctx, null, expr, start, offset, ctx, elCtx, variableResolverFactory);
        return _accessor.getValue(ctx, elCtx, variableResolverFactory);
    }
    return null;
  }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

    super(expr, start, end, fields | INLINE_COLLECTION, pctx);

    if ((fields & COMPILE_IMMEDIATE) != 0) {
      parseGraph(true, null, pctx);
      try {
        AccessorOptimizer ao = OptimizerFactory.getThreadAccessorOptimizer();
        accessor = ao.optimizeCollection(pctx, collectionGraph, egressType, expr, trailingStart, trailingOffset, null, null, null);
        egressType = ao.getEgressType();
      }
      finally {
        OptimizerFactory.clearThreadAccessorOptimizer();
      }
    }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

    this.egressType = type;

    if ((fields & COMPILE_IMMEDIATE) != 0) {
      try {
        parseGraph(true, type, pctx);
        AccessorOptimizer ao = OptimizerFactory.getThreadAccessorOptimizer();
        accessor = ao.optimizeCollection(pctx, collectionGraph, egressType, expr, this.trailingStart, trailingOffset, null, null, null);
        egressType = ao.getEgressType();
      }
      finally {
        OptimizerFactory.clearThreadAccessorOptimizer();
      }
    }
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

    if (accessor != null) {
      return accessor.getValue(ctx, thisValue, factory);
    }
    else {
      try {
        AccessorOptimizer ao = OptimizerFactory.getThreadAccessorOptimizer();
        if (collectionGraph == null) parseGraph(true, null, null);

        accessor = ao.optimizeCollection(AbstractParser.getCurrentThreadParserContext(), collectionGraph,
            egressType, expr, trailingStart, trailingOffset, ctx, thisValue, factory);
        egressType = ao.getEgressType();

        return accessor.getValue(ctx, thisValue, factory);
      }
      finally {
        OptimizerFactory.clearThreadAccessorOptimizer();
View Full Code Here

Examples of org.mvel2.optimizers.AccessorOptimizer

    if (accessor != null) {
      return accessor.getValue(literal, thisValue, factory);
    }
    else {
      try {
        AccessorOptimizer aO = getThreadAccessorOptimizer();
        accessor = aO.optimizeAccessor(getCurrentThreadParserContext(), expr, start, offset,
            literal, thisValue, factory, false, null);
        return aO.getResultOptPass();
      }
      finally {
        OptimizerFactory.clearThreadAccessorOptimizer();
      }
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.