/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/** This class contains the CharacterRangeTable for some method
* and the hashtable for mapping trees or lists of trees to their
* ending positions.
*
* <p><b>This is NOT part of any supported API.
* If you write code that depends on this, you do so at your own risk.
* This code and its internal interfaces are subject to change or
* deletion without notice.</b>
*/
public class CRTable
implements CRTFlags {
private final boolean crtDebug = false;
/** The list of CRTable entries.
*/
/** The hashtable for source positions.
*/
/** The hashtable for ending positions stored in the parser.
*/
/** The tree of the method this table is intended for.
* We should traverse this tree to get source ranges.
*/
/** Constructor
*/
this.methodTree = tree;
this.endPositions = endPositions;
}
/** Create a new CRTEntry and add it to the entries.
* @param tree The tree or the list of trees for which
* we are storing the code pointers.
* @param flags The set of flags designating type of the entry.
* @param startPc The starting code position.
* @param endPc The ending code position.
*/
}
/** Compute source positions and write CRT to the databuf.
* @param databuf The buffer to write bytecodes to.
*/
int crtEntries = 0;
// compute source positions for the method
// eliminate entries that do not produce bytecodes:
// for example, empty blocks and statements
continue;
continue;
if (crtDebug) {
}
continue;
if (crtDebug) {
}
continue;
// write attribute
// 'endPc - 1' because endPc actually points to start of the next command
crtEntries++;
}
return crtEntries;
}
/** Return the number of the entries.
*/
public int length() {
}
/** Return string describing flags enabled.
*/
return types;
}
/** Source file positions in CRT are integers in the format:
* line-number << LINESHIFT + column-number
*/
if (crtDebug) {
", new_pos = " + new_pos);
}
return new_pos;
}
/* ************************************************************************
* Traversal methods
*************************************************************************/
/**
* This class contains methods to compute source positions for trees.
* Extends Tree.Visitor to traverse the abstract syntax tree.
*/
/** The result of the tree traversal methods.
*/
/** Visitor method: compute source positions for a single node.
*/
}
return result;
}
/** Visitor method: compute source positions for a list of nodes.
*/
}
return list_sr;
}
/** Visitor method: compute source positions for
* a list of case blocks of switch statements.
*/
}
return list_sr;
}
/** Visitor method: compute source positions for
* a list of catch clauses in try statements.
*/
}
return list_sr;
}
}
}
// endPos is the same as startPos for the empty statement
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
/** The start position of given tree.
*/
}
/** The end position of given tree, if it has
* defined endpos, NOPOS otherwise.
*/
}
}
/** This class contains a CharacterRangeTableEntry.
*/
static class CRTEntry {
/** A tree or a list of trees to obtain source positions.
*/
/** The flags described in the CharacterRangeTable spec.
*/
int flags;
/** The starting code position of this entry.
*/
int startPc;
/** The ending code position of this entry.
*/
int endPc;
/** Constructor */
}
}
/** This class contains source positions
* for some tree or list of trees.
*/
static class SourceRange {
/** The starting source position.
*/
int startPos;
/** The ending source position.
*/
int endPos;
/** Constructor */
SourceRange() {
}
/** Constructor */
}
/** Compare the starting and the ending positions
* of the source range and combines them assigning
* the widest range to this.
*/
return this;
}
}
}