Java Code Examples for com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator#addInstructionList()
The following examples show how to use
com.sun.org.apache.xalan.internal.xsltc.compiler.util.MethodGenerator#addInstructionList() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSeq.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 2
Source File: TestSeq.java From TencentKona-8 with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 3
Source File: TestSeq.java From jdk8u60 with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 4
Source File: TestSeq.java From JDKSourceCode1.8 with MIT License | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 5
Source File: TestSeq.java From openjdk-jdk8u with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 6
Source File: TestSeq.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 7
Source File: TestSeq.java From Bytecoder with Apache License 2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 8
Source File: TestSeq.java From openjdk-jdk9 with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 9
Source File: TestSeq.java From hottub with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 10
Source File: TestSeq.java From openjdk-8-source with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }
Example 11
Source File: TestSeq.java From openjdk-8 with GNU General Public License v2.0 | 4 votes |
/** * Compile the code for this test sequence. Compile patterns * from highest to lowest priority. Note that since patterns * can be share by multiple test sequences, instruction lists * must be copied before backpatching. */ public InstructionHandle compile(ClassGenerator classGen, MethodGenerator methodGen, InstructionHandle continuation) { // Returned cached value if already compiled if (_start != null) { return _start; } // If not patterns, then return handle for default template final int count = _patterns.size(); if (count == 0) { return (_start = getTemplateHandle(_default)); } // Init handle to jump when all patterns failed InstructionHandle fail = (_default == null) ? continuation : getTemplateHandle(_default); // Compile all patterns in reverse order for (int n = count - 1; n >= 0; n--) { final LocationPathPattern pattern = getPattern(n); final Template template = pattern.getTemplate(); final InstructionList il = new InstructionList(); // Patterns expect current node on top of stack il.append(methodGen.loadCurrentNode()); // Apply the test-code compiled for the pattern InstructionList ilist = methodGen.getInstructionList(pattern); if (ilist == null) { ilist = pattern.compile(classGen, methodGen); methodGen.addInstructionList(pattern, ilist); } // Make a copy of the instruction list for backpatching InstructionList copyOfilist = ilist.copy(); FlowList trueList = pattern.getTrueList(); if (trueList != null) { trueList = trueList.copyAndRedirect(ilist, copyOfilist); } FlowList falseList = pattern.getFalseList(); if (falseList != null) { falseList = falseList.copyAndRedirect(ilist, copyOfilist); } il.append(copyOfilist); // On success branch to the template code final InstructionHandle gtmpl = getTemplateHandle(template); final InstructionHandle success = il.append(new GOTO_W(gtmpl)); if (trueList != null) { trueList.backPatch(success); } if (falseList != null) { falseList.backPatch(fail); } // Next pattern's 'fail' target is this pattern's first instruction fail = il.getStart(); // Append existing instruction list to the end of this one if (_instructionList != null) { il.append(_instructionList); } // Set current instruction list to be this one _instructionList = il; } return (_start = fail); }