1 /*
2 * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
113 public boolean isWide() { return _is_wide; }
114 public boolean isActiveBreakpoint() { return Bytecodes.isActiveBreakpointAt(_method, _bci); }
115 public boolean isLastBytecode() { return _next_bci >= _end_bci; }
116
117 // State changes
118 public void setNextBCI(int bci) {
119 if (Assert.ASSERTS_ENABLED) {
120 Assert.that(0 <= bci && bci <= _method.getCodeSize(), "illegal bci");
121 }
122 _next_bci = bci;
123 }
124
125 // Bytecode-specific attributes
126 public int dest() { return bci() + _method.getBytecodeShortArg(bci() + 1); }
127 public int dest_w() { return bci() + _method.getBytecodeIntArg(bci() + 1); }
128
129 // Unsigned indices, widening
130 public int getIndex() { return (isWide())
131 ? (_method.getBytecodeShortArg(bci() + 2) & 0xFFFF)
132 : (_method.getBytecodeOrBPAt(bci() + 1) & 0xFF); }
133 public int getIndexBig() { return _method.getBytecodeShortArg(bci() + 1); }
134
135 // Fetch at absolute BCI (for manual parsing of certain bytecodes)
136 public int codeAt(int bci) {
137 return _method.getBytecodeOrBPAt(bci);
138 }
139 }
|
1 /*
2 * Copyright (c) 2001, 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 *
113 public boolean isWide() { return _is_wide; }
114 public boolean isActiveBreakpoint() { return Bytecodes.isActiveBreakpointAt(_method, _bci); }
115 public boolean isLastBytecode() { return _next_bci >= _end_bci; }
116
117 // State changes
118 public void setNextBCI(int bci) {
119 if (Assert.ASSERTS_ENABLED) {
120 Assert.that(0 <= bci && bci <= _method.getCodeSize(), "illegal bci");
121 }
122 _next_bci = bci;
123 }
124
125 // Bytecode-specific attributes
126 public int dest() { return bci() + _method.getBytecodeShortArg(bci() + 1); }
127 public int dest_w() { return bci() + _method.getBytecodeIntArg(bci() + 1); }
128
129 // Unsigned indices, widening
130 public int getIndex() { return (isWide())
131 ? (_method.getBytecodeShortArg(bci() + 2) & 0xFFFF)
132 : (_method.getBytecodeOrBPAt(bci() + 1) & 0xFF); }
133 public int getIndexU1() { return _method.getBytecodeOrBPAt(bci() + 1) & 0xFF; }
134 public int getIndexU2() { return _method.getBytecodeShortArg(bci() + 1) & 0xFFFF; }
135 public int getIndexU4() { return _method.getNativeIntArg(bci() + 1); }
136 public boolean hasIndexU4() { return code() == Bytecodes._invokedynamic; }
137
138 public int getIndexU1Cpcache() { return _method.getBytecodeOrBPAt(bci() + 1) & 0xFF; }
139 public int getIndexU2Cpcache() { return _method.getNativeShortArg(bci() + 1) & 0xFFFF; }
140
141 // Fetch at absolute BCI (for manual parsing of certain bytecodes)
142 public int codeAt(int bci) {
143 return _method.getBytecodeOrBPAt(bci);
144 }
145 }
|