本文整理汇总了Java中com.sun.org.apache.bcel.internal.generic.ISTORE类的典型用法代码示例。如果您正苦于以下问题:Java ISTORE类的具体用法?Java ISTORE怎么用?Java ISTORE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ISTORE类属于com.sun.org.apache.bcel.internal.generic包,在下文中一共展示了ISTORE类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: storeLocal
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
/**
* Helper method to generate an instance of a subclass of
* {@link StoreInstruction} based on the specified {@link Type} that will
* store a value in the specified local variable
* @param index the JVM stack frame index of the variable that is to be
* stored
* @param type the {@link Type} of the variable
* @return the generated {@link StoredInstruction}
*/
private static Instruction storeLocal(int index, Type type) {
if (type == Type.BOOLEAN) {
return new ISTORE(index);
} else if (type == Type.INT) {
return new ISTORE(index);
} else if (type == Type.SHORT) {
return new ISTORE(index);
} else if (type == Type.LONG) {
return new LSTORE(index);
} else if (type == Type.BYTE) {
return new ISTORE(index);
} else if (type == Type.CHAR) {
return new ISTORE(index);
} else if (type == Type.FLOAT) {
return new FSTORE(index);
} else if (type == Type.DOUBLE) {
return new DSTORE(index);
} else {
return new ASTORE(index);
}
}
示例2: CompareGenerator
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
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());
}
示例3: MatchGenerator
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
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);
}
示例4: TestGenerator
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
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);
}
示例5: translate
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final LocalVariableGen name =
methodGen.addLocalVariable2("name",
Util.getJCRefType(STRING_SIG),
null);
final LocalVariableGen length =
methodGen.addLocalVariable2("length",
Util.getJCRefType("I"),
null);
// Get the name of the node to copy and save for later
il.append(methodGen.loadDOM());
il.append(methodGen.loadCurrentNode());
il.append(methodGen.loadHandler());
final int cpy = cpg.addInterfaceMethodref(DOM_INTF,
"shallowCopy",
"("
+ NODE_SIG
+ TRANSLET_OUTPUT_SIG
+ ")" + STRING_SIG);
il.append(new INVOKEINTERFACE(cpy, 3));
il.append(DUP);
name.setStart(il.append(new ASTORE(name.getIndex())));
final BranchHandle ifBlock1 = il.append(new IFNULL(null));
// Get the length of the node name and save for later
il.append(new ALOAD(name.getIndex()));
final int lengthMethod = cpg.addMethodref(STRING_CLASS,"length","()I");
il.append(new INVOKEVIRTUAL(lengthMethod));
il.append(DUP);
length.setStart(il.append(new ISTORE(length.getIndex())));
// Ignore attribute sets if current node is ROOT. DOM.shallowCopy()
// returns "" for ROOT, so skip attribute sets if length == 0
final BranchHandle ifBlock4 = il.append(new IFEQ(null));
// Copy in attribute sets if specified
if (_useSets != null) {
// If the parent of this element will result in an element being
// output then we know that it is safe to copy out the attributes
final SyntaxTreeNode parent = getParent();
if ((parent instanceof LiteralElement) ||
(parent instanceof LiteralElement)) {
_useSets.translate(classGen, methodGen);
}
// If not we have to check to see if the copy will result in an
// element being output.
else {
// check if element; if not skip to translate body
il.append(new ILOAD(length.getIndex()));
final BranchHandle ifBlock2 = il.append(new IFEQ(null));
// length != 0 -> element -> do attribute sets
_useSets.translate(classGen, methodGen);
// not an element; root
ifBlock2.setTarget(il.append(NOP));
}
}
// Instantiate body of xsl:copy
ifBlock4.setTarget(il.append(NOP));
translateContents(classGen, methodGen);
// Call the output handler's endElement() if we copied an element
// (The DOM.shallowCopy() method calls startElement().)
length.setEnd(il.append(new ILOAD(length.getIndex())));
final BranchHandle ifBlock3 = il.append(new IFEQ(null));
il.append(methodGen.loadHandler());
name.setEnd(il.append(new ALOAD(name.getIndex())));
il.append(methodGen.endElement());
final InstructionHandle end = il.append(NOP);
ifBlock1.setTarget(end);
ifBlock3.setTarget(end);
methodGen.removeLocalVariable(name);
methodGen.removeLocalVariable(length);
}
示例6: translate
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
if (_left != null) {
if (_left instanceof StepPattern) {
final LocalVariableGen local =
// absolute path pattern temporary
methodGen.addLocalVariable2("apptmp",
Util.getJCRefType(NODE_SIG),
null);
il.append(DUP);
local.setStart(il.append(new ISTORE(local.getIndex())));
_left.translate(classGen, methodGen);
il.append(methodGen.loadDOM());
local.setEnd(il.append(new ILOAD(local.getIndex())));
methodGen.removeLocalVariable(local);
}
else {
_left.translate(classGen, methodGen);
}
}
final int getParent = cpg.addInterfaceMethodref(DOM_INTF,
GET_PARENT,
GET_PARENT_SIG);
final int getType = cpg.addInterfaceMethodref(DOM_INTF,
"getExpandedTypeID",
"(I)I");
InstructionHandle begin = il.append(methodGen.loadDOM());
il.append(SWAP);
il.append(new INVOKEINTERFACE(getParent, 2));
if (_left instanceof AncestorPattern) {
il.append(methodGen.loadDOM());
il.append(SWAP);
}
il.append(new INVOKEINTERFACE(getType, 2));
il.append(new PUSH(cpg, DTM.DOCUMENT_NODE));
final BranchHandle skip = il.append(new IF_ICMPEQ(null));
_falseList.add(il.append(new GOTO_W(null)));
skip.setTarget(il.append(NOP));
if (_left != null) {
_left.backPatchTrueList(begin);
/*
* If _left is an ancestor pattern, backpatch this pattern's false
* list to the loop that searches for more ancestors.
*/
if (_left instanceof AncestorPattern) {
final AncestorPattern ancestor = (AncestorPattern) _left;
_falseList.backPatch(ancestor.getLoopHandle()); // clears list
}
_falseList.append(_left._falseList);
}
}
示例7: traverseNodeSet
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
/**
* This method is called if the "use" attribute of the key contains a
* node set. In this case we must traverse all nodes in the set and
* create one entry in this key's index for each node in the set.
*/
public void traverseNodeSet(ClassGenerator classGen,
MethodGenerator methodGen,
int buildKeyIndex) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
// DOM.getStringValueX(nodeIndex) => String
final int getNodeValue = cpg.addInterfaceMethodref(DOM_INTF,
GET_NODE_VALUE,
"(I)"+STRING_SIG);
final int getNodeIdent = cpg.addInterfaceMethodref(DOM_INTF,
"getNodeIdent",
"(I)"+NODE_SIG);
// AbstractTranslet.SetKeyIndexDom(name, Dom) => void
final int keyDom = cpg.addMethodref(TRANSLET_CLASS,
"setKeyIndexDom",
"("+STRING_SIG+DOM_INTF_SIG+")V");
// This variable holds the id of the node we found with the "match"
// attribute of xsl:key. This is the id we store, with the value we
// get from the nodes we find here, in the index for this key.
final LocalVariableGen parentNode =
methodGen.addLocalVariable("parentNode",
Util.getJCRefType("I"),
null, null);
// Get the 'parameter' from the stack and store it in a local var.
parentNode.setStart(il.append(new ISTORE(parentNode.getIndex())));
// Save current node and current iterator on the stack
il.append(methodGen.loadCurrentNode());
il.append(methodGen.loadIterator());
// Overwrite current iterator with one that gives us only what we want
_use.translate(classGen, methodGen);
_use.startIterator(classGen, methodGen);
il.append(methodGen.storeIterator());
final BranchHandle nextNode = il.append(new GOTO(null));
final InstructionHandle loop = il.append(NOP);
// Prepare to call buildKeyIndex(String name, int node, String value);
il.append(classGen.loadTranslet());
il.append(new PUSH(cpg, _name.toString()));
parentNode.setEnd(il.append(new ILOAD(parentNode.getIndex())));
// Now get the node value and push it on the parameter stack
il.append(methodGen.loadDOM());
il.append(methodGen.loadCurrentNode());
il.append(new INVOKEINTERFACE(getNodeValue, 2));
// Finally do the call to add an entry in the index for this key.
il.append(new INVOKEVIRTUAL(buildKeyIndex));
il.append(classGen.loadTranslet());
il.append(new PUSH(cpg, getName()));
il.append(methodGen.loadDOM());
il.append(new INVOKEVIRTUAL(keyDom));
nextNode.setTarget(il.append(methodGen.loadIterator()));
il.append(methodGen.nextNode());
il.append(DUP);
il.append(methodGen.storeCurrentNode());
il.append(new IFGE(loop)); // Go on to next matching node....
// Restore current node and current iterator from the stack
il.append(methodGen.storeIterator());
il.append(methodGen.storeCurrentNode());
}
示例8: translate
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
final ConstantPoolGen cpg = classGen.getConstantPool();
final InstructionList il = methodGen.getInstructionList();
final LocalVariableGen local =
methodGen.addLocalVariable2("ppt",
Util.getJCRefType(NODE_SIG),
null);
final com.sun.org.apache.bcel.internal.generic.Instruction loadLocal =
new ILOAD(local.getIndex());
final com.sun.org.apache.bcel.internal.generic.Instruction storeLocal =
new ISTORE(local.getIndex());
if (_right.isWildcard()) {
il.append(methodGen.loadDOM());
il.append(SWAP);
}
else if (_right instanceof StepPattern) {
il.append(DUP);
local.setStart(il.append(storeLocal));
_right.translate(classGen, methodGen);
il.append(methodGen.loadDOM());
local.setEnd(il.append(loadLocal));
}
else {
_right.translate(classGen, methodGen);
if (_right instanceof AncestorPattern) {
il.append(methodGen.loadDOM());
il.append(SWAP);
}
}
final int getParent = cpg.addInterfaceMethodref(DOM_INTF,
GET_PARENT,
GET_PARENT_SIG);
il.append(new INVOKEINTERFACE(getParent, 2));
final SyntaxTreeNode p = getParent();
if (p == null || p instanceof Instruction ||
p instanceof TopLevelElement)
{
_left.translate(classGen, methodGen);
}
else {
il.append(DUP);
InstructionHandle storeInst = il.append(storeLocal);
if (local.getStart() == null) {
local.setStart(storeInst);
}
_left.translate(classGen, methodGen);
il.append(methodGen.loadDOM());
local.setEnd(il.append(loadLocal));
}
methodGen.removeLocalVariable(local);
/*
* If _right is an ancestor pattern, backpatch _left false
* list to the loop that searches for more ancestors.
*/
if (_right instanceof AncestorPattern) {
final AncestorPattern ancestor = (AncestorPattern) _right;
_left.backPatchFalseList(ancestor.getLoopHandle()); // clears list
}
_trueList.append(_right._trueList.append(_left._trueList));
_falseList.append(_right._falseList.append(_left._falseList));
}
示例9: STORE
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
public Instruction STORE(int slot) {
return new ISTORE(slot);
}
示例10: storeCurrentNode
import com.sun.org.apache.bcel.internal.generic.ISTORE; //导入依赖的package包/类
public Instruction storeCurrentNode() {
return _istoreCurrent != null
? _istoreCurrent
: (_istoreCurrent = new ISTORE(getLocalIndex("current")));
}