Package org.apache.bcel.generic

Examples of org.apache.bcel.generic.ASTORE


            Util.getJCRefType(STRING_SIG),
            il.getEnd());
           
            // store the name into a variable first so _name.translate only needs to be called once 
            _name.translate(classGen, methodGen);
            il.append(new ASTORE(nameValue.getIndex()));
            il.append(new ALOAD(nameValue.getIndex()));
           
            // call checkNCName if the name is an AVT
            final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkNCName",
                                "("
View Full Code Here


      addLocalVariable("iterator",
           Util.getJCRefType(Constants.NODE_ITERATOR_SIG),
           null, null);
  ITERATOR_INDEX = iterator.getIndex();
  _aloadIterator = new ALOAD(ITERATOR_INDEX);
  _astoreIterator = new ASTORE(ITERATOR_INDEX);
  il.append(new ACONST_NULL());
  il.append(storeIterator());
    }
View Full Code Here

      il.append(classGen.loadTranslet());
      il.append(new INVOKEVIRTUAL(indexConstructor));
      il.append(DUP);
      il.append(methodGen.loadDOM());
      il.append(new INVOKEVIRTUAL(keyDom));
      il.append(new ASTORE(returnIndex.getIndex()));

      // Initialise the index specified in the first parameter of key()
      il.append(classGen.loadTranslet());
      if (_name == null) {
    il.append(new PUSH(cpg,"##id"));
      }
      else if (_resolvedQName != null) {
    il.append(new PUSH(cpg, _resolvedQName.toString()));
      }
      else {
    _name.translate(classGen, methodGen);
      }

      il.append(new INVOKEVIRTUAL(getKeyIndex));
      il.append(new ASTORE(searchIndex.getIndex()));

      // LOOP STARTS HERE

      // Now we're ready to start traversing the node-set given in
      // the key() function's second argument....
      final BranchHandle nextNode = il.append(new GOTO(null));
      final InstructionHandle loop = il.append(NOP);

      // Push returnIndex on stack to prepare for call to merge()
      il.append(new ALOAD(returnIndex.getIndex()));
     
      // Lookup index using the string value from the current node
      il.append(new ALOAD(searchIndex.getIndex()));
      il.append(DUP);
      il.append(methodGen.loadDOM());
      il.append(methodGen.loadCurrentNode());
      il.append(new INVOKEINTERFACE(getNodeValue, 2));
      if (_name == null) {
    il.append(new INVOKEVIRTUAL(lookupId));
      }
      else {
    il.append(new INVOKEVIRTUAL(lookupKey));
      }

      // Call to returnIndex.merge(searchIndex);
      il.append(new INVOKEVIRTUAL(merge));
   
      // Go on with next node in the 2nd parameter node-set
      nextNode.setTarget(il.append(methodGen.loadIterator()));
      il.append(methodGen.nextNode());
      il.append(DUP);
      il.append(methodGen.storeCurrentNode());
      il.append(new IFGT(loop));

      // LOOP ENDS HERE

      // Restore current node and current iterator from the stack
      il.append(methodGen.storeIterator());
      il.append(methodGen.storeCurrentNode());
  }
  // If the second parameter is a single value we just lookup the named
  // index and initialise the iterator to return nodes with this value.
  else {
      // Call getKeyIndex in AbstractTranslet with the name of the key
      // to get the index for this key (which is also a node iterator).
      il.append(classGen.loadTranslet());
      if (_name == null) {
    il.append(new PUSH(cpg,"##id"));
      }
      else if (_resolvedQName != null) {
    il.append(new PUSH(cpg, _resolvedQName.toString()));
      }
      else {
    _name.translate(classGen, methodGen);
      }
      il.append(new INVOKEVIRTUAL(getKeyIndex));

      // Now use the value in the second argument to determine what nodes
      // the iterator should return.
      il.append(DUP);

      _value.translate(classGen, methodGen);

      if (_name == null) {
    il.append(new INVOKEVIRTUAL(lookupId));
      }
      else {
    il.append(new INVOKEVIRTUAL(lookupKey));
      }

      il.append(new ASTORE(returnIndex.getIndex()));
  }

        return returnIndex;
    }
View Full Code Here

  _step.translate(classGen, methodGen);
        LocalVariableGen stepIteratorTemp =
                methodGen.addLocalVariable("step_pattern_tmp2",
                                           Util.getJCRefType(NODE_ITERATOR_SIG),
                                           il.getEnd(), null);
        il.append(new ASTORE(stepIteratorTemp.getIndex()));

  il.append(new NEW(cpg.addClass(MATCHING_ITERATOR)));
  il.append(DUP);
  il.append(new ILOAD(match.getIndex()));
        il.append(new ALOAD(stepIteratorTemp.getIndex()));
View Full Code Here

              NODE_ITERATOR_SIG);

      il.append(classGen.loadTranslet());
      il.append(new GETFIELD(iteratorIndex));
      il.append(DUP);
      il.append(new ASTORE(iter.getIndex()));
      ifBlock = il.append(new IFNONNULL(null));
      il.append(classGen.loadTranslet());
 

  // Compile the step created at type checking time
  _step.translate(classGen, methodGen);
  il.append(new ASTORE(iter.getIndex()));

  // If in the main class update the field too
  if (!classGen.isExternal()) {
      il.append(new ALOAD(iter.getIndex()));
      il.append(new PUTFIELD(iteratorIndex));
View Full Code Here

  final String className = classGen.getClassName();
  il.append(filterGen.loadTranslet());
  il.append(new CHECKCAST(cpg.addClass(className)));
  il.append(new GETFIELD(cpg.addFieldref(className,
                 DOM_FIELD, DOM_INTF_SIG)));
  il.append(new ASTORE(local.getIndex()));

  // Store the dom index in the test generator
  testGen.setDomIndex(local.getIndex());

  _exp.translate(filterGen, testGen);
View Full Code Here

                    Util.getJCRefType(STRING_SIG),
                    il.getEnd());
                   
            // store the name into a variable first so _name.translate only needs to be called once 
            _name.translate(classGen, methodGen);
            il.append(new ASTORE(nameValue.getIndex()));
            il.append(new ALOAD(nameValue.getIndex()));
           
            // call checkQName if the name is an AVT
            final int check = cpg.addMethodref(BASIS_LIBRARY_CLASS, "checkQName",
                            "("
View Full Code Here

         String method_name, String class_name,
         InstructionList il, ConstantPoolGen cpg) {
  super(access_flags, return_type, arg_types, arg_names, method_name,
        class_name, il, cpg);
 
  _astoreHandler  = new ASTORE(HANDLER_INDEX);
  _aloadHandler   = new ALOAD(HANDLER_INDEX);
  _astoreIterator = new ASTORE(ITERATOR_INDEX);
  _aloadIterator  = new ALOAD(ITERATOR_INDEX);
  _aloadDom       = new ALOAD(DOM_INDEX);
  _astoreDom      = new ASTORE(DOM_INDEX);
 
  final int startElement =
      cpg.addInterfaceMethodref(TRANSLET_OUTPUT_INTERFACE,
              "startElement",
              START_ELEMENT_SIG);
View Full Code Here

    public Instruction LOAD(int slot) {
  return new ALOAD(slot);
    }

    public Instruction STORE(int slot) {
  return new ASTORE(slot);
    }
View Full Code Here

            CFG cfg = getClassContext().getCFG(getMethod());
            Collection<BasicBlock> blockList = cfg.getBlocksContainingInstructionWithOffset(obj.getHandlerPC());
            for (BasicBlock block : blockList) {
                InstructionHandle first = block.getFirstInstruction();
                if (first != null && first.getPosition() == obj.getHandlerPC() && first.getInstruction() instanceof ASTORE) {
                    ASTORE astore = (ASTORE) first.getInstruction();
                    BitSet liveStoreSet = dataflow.getFactAtLocation(new Location(first, block));
                    if (!liveStoreSet.get(astore.getIndex())) {
                        // The ASTORE storing the exception object is dead
                        if (DEBUG) {
                            System.out.println("Dead exception store at " + first);
                        }
                        caughtException.dead = true;
View Full Code Here

TOP

Related Classes of org.apache.bcel.generic.ASTORE

Copyright © 2018 www.massapicom. 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.