public Instruction LOAD(int slot) { return new ILOAD(slot); }
public Instruction LOAD(int slot) { return new ILOAD(slot); }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ public void visitILOAD(ILOAD o){ int idx = o.getIndex(); if (idx < 0){ constraintViolated(o, "Index '"+idx+"' must be non-negative."); } else{ int maxminus1 = max_locals()-1; if (idx > maxminus1){ constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'."); } } }
public Instruction LOAD(int slot) { return new ILOAD(slot); }
/** Checks if the constraints of operands of the said instruction(s) are satisfied. */ @Override public void visitILOAD(final ILOAD o) { final int idx = o.getIndex(); if (idx < 0) { constraintViolated(o, "Index '"+idx+"' must be non-negative."); } else{ final int maxminus1 = max_locals()-1; if (idx > maxminus1) { constraintViolated(o, "Index '"+idx+"' must not be greater than max_locals-1 '"+maxminus1+"'."); } } }
public MatchGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_INDEX); _istoreCurrent = new ISTORE(CURRENT_INDEX); }
public TestGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_NODE_INDEX); _istoreCurrent = new ISTORE(CURRENT_NODE_INDEX); _iloadContext = new ILOAD(CONTEXT_NODE_INDEX); _istoreContext = new ILOAD(CONTEXT_NODE_INDEX); _astoreIterator = new ASTORE(ITERATOR_INDEX); _aloadIterator = new ALOAD(ITERATOR_INDEX); }
/** * Helper method to generate an instance of a subclass of * {@link LoadInstruction} based on the specified {@link Type} that will * load the specified local variable * @param index the JVM stack frame index of the variable that is to be * loaded * @param type the {@link Type} of the variable * @return the generated {@link LoadInstruction} */ private static Instruction loadLocal(int index, Type type) { if (type == Type.BOOLEAN) { return new ILOAD(index); } else if (type == Type.INT) { return new ILOAD(index); } else if (type == Type.SHORT) { return new ILOAD(index); } else if (type == Type.LONG) { return new LLOAD(index); } else if (type == Type.BYTE) { return new ILOAD(index); } else if (type == Type.CHAR) { return new ILOAD(index); } else if (type == Type.FLOAT) { return new FLOAD(index); } else if (type == Type.DOUBLE) { return new DLOAD(index); } else { return new ALOAD(index); } }
public Instruction loadCurrentNode() { if (_iloadCurrent == null) { int idx = getLocalIndex("current"); if (idx > 0) _iloadCurrent = new ILOAD(idx); else _iloadCurrent = new ICONST(0); } return _iloadCurrent; }
public CompareGenerator(int access_flags, Type return_type, Type[] arg_types, String[] arg_names, String method_name, String class_name, InstructionList il, ConstantPoolGen cp) { super(access_flags, return_type, arg_types, arg_names, method_name, class_name, il, cp); _iloadCurrent = new ILOAD(CURRENT_INDEX); _istoreCurrent = new ISTORE(CURRENT_INDEX); _aloadDom = new ALOAD(DOM_INDEX); _iloadLast = new ILOAD(LAST_INDEX); LocalVariableGen iterator = 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()); }
public static void compileGetChildren(ClassGenerator classGen, MethodGenerator methodGen, int node) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int git = cpg.addInterfaceMethodref(DOM_INTF, GET_CHILDREN, GET_CHILDREN_SIG); il.append(methodGen.loadDOM()); il.append(new ILOAD(node)); il.append(new INVOKEINTERFACE(git, 2)); }
"(I)I"); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(new INVOKEINTERFACE(getNS, 2)); il.append(new SWITCH(types, targets, defaultTarget));
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadCurrentNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(POSITION_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int index = cpg.addInterfaceMethodref(NODE_ITERATOR, "getPosition", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(index,1)); } } }
public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final InstructionList il = methodGen.getInstructionList(); if (methodGen instanceof CompareGenerator) { il.append(((CompareGenerator)methodGen).loadLastNode()); } else if (methodGen instanceof TestGenerator) { il.append(new ILOAD(LAST_INDEX)); } else { final ConstantPoolGen cpg = classGen.getConstantPool(); final int getLast = cpg.addInterfaceMethodref(NODE_ITERATOR, "getLast", "()I"); il.append(methodGen.loadIterator()); il.append(new INVOKEINTERFACE(getLast, 1)); } } }
/** * This method is called when the constructor is compiled in * Stylesheet.compileConstructor() and not as the syntax tree is traversed. */ public void translate(ClassGenerator classGen, MethodGenerator methodGen) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = methodGen.getInstructionList(); final int tst = cpg.addMethodref(BASIS_LIBRARY_CLASS, "testLanguage", "("+STRING_SIG+DOM_INTF_SIG+"I)Z"); _lang.translate(classGen,methodGen); il.append(methodGen.loadDOM()); if (classGen instanceof FilterGenerator) il.append(new ILOAD(1)); else il.append(methodGen.loadContextNode()); il.append(new INVOKESTATIC(tst)); } }
/** * Compiles the default action for DOM text nodes and attribute nodes: * output the node's text value */ private InstructionList compileDefaultText(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle next) { final ConstantPoolGen cpg = classGen.getConstantPool(); final InstructionList il = new InstructionList(); final int chars = cpg.addInterfaceMethodref(DOM_INTF, CHARACTERS, CHARACTERS_SIG); il.append(methodGen.loadDOM()); il.append(new ILOAD(_currentIndex)); il.append(methodGen.loadHandler()); il.append(new INVOKEINTERFACE(chars, 3)); il.append(new GOTO_W(next)); return il; }
il.append(new ILOAD(extractMethod.getLocalIndex("level")));
/** * Translates reference into object of internal type <code>type</code>. * * @see org.apache.xalan.xsltc.compiler.util.Type#translateTo */ public void translateTo(ClassGenerator classGen, MethodGenerator methodGen, StringType type) { final int current = methodGen.getLocalIndex("current"); ConstantPoolGen cpg = classGen.getConstantPool(); InstructionList il = methodGen.getInstructionList(); // If no current, conversion is a top-level if (current < 0) { il.append(new PUSH(cpg, DTM.ROOT_NODE)); // push root node } else { il.append(new ILOAD(current)); } il.append(methodGen.loadDOM()); final int stringF = cpg.addMethodref(BASIS_LIBRARY_CLASS, "stringF", "(" + OBJECT_SIG + NODE_SIG + DOM_INTF_SIG + ")" + STRING_SIG); il.append(new INVOKESTATIC(stringF)); }