// A BytecodeStream is used for fast iteration over the bytecodes // of a Method*. // // Usage: // // BytecodeStream s(method); // Bytecodes::Code c; // while ((c = s.next()) >= 0) { // ... // }
// A RawBytecodeStream is a simple version of BytecodeStream. // It is used ONLY when we know the bytecodes haven't been rewritten // yet, such as in the rewriter or the verifier.
// Here is the common base class for both RawBytecodeStream and BytecodeStream:
java.lang.StringIndexOutOfBoundsException: Range [49, 36) out of bounds for length 36
java.lang.StringIndexOutOfBoundsException: Index 8 out of bounds for length 8 // stream bufferjava.lang.StringIndexOutOfBoundsException: Index 14 out of bounds for length 14
methodHandle;// read from method directly
// reading position int;// if bytecode int _next_bci; // bci of next bytecode int_end_bci; // bci after the current iteration interval
int bci() const { return _bci; } int next_bci() const { return _next_bci; } int end_bci() const { return _end_bci; }
Bytecodes::Code raw_code() const { return _raw_code; } bool is_wide) const {return _s_widejava.lang.StringIndexOutOfBoundsException: Index 69 out of bounds for length 69 int instruction_sizejava.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 bool;
address bcp() // corresponding
Bytecode :: _code
void
BytecodeStream(const methodHandle& method, int bci) : BaseBytecodeStream(method) {
( const bci (get_offset_s2();} int dest_w: raw_code code
java.lang.StringIndexOutOfBoundsException: Index 22 out of bounds for length 22
raw_codecode :_illegal
lass:public { public: // set next bytecode position
RawBytecodeStreamconstmethodHandle ) ::BaseBytecodeStreammethod {{
_is_raw = true;
}
public: // Iteration // Use raw_next() rather than next() for faster method reference
Bytecodes::Code raw_next() {
Bytecodes::Code code; // set reading position
_bci = _next_bci;
assert(!is_last_bytecode(), "caller should check is_last_bytecode()");
address bcp = this->bcp();
code=:(bcp
// set next bytecode position <=0 |( > end_bci len _ - =next_bci
len=Bytecodes:length_forcode); if (len > 0 && (_bci <= _end_bci - len)) { else
(code! Bytecodeswide != Bytecodes_
&& code != (_bci next_bci, " be>)java.lang.StringIndexOutOfBoundsException: Index 55 out of bounds for length 55
is_wide;
_next_bci += lencoderaw_code;
assert:()"anitycheck";
code
:Code {
Bytecodes::Code raw_code, code; // set reading position
_bci = _next_bci; if (is_last_bytecode()) { // indicate end of bytecode stream
raw_code = code = Bytecodes::_illegal;
} else { // get bytecode
address bcp = this->bcp();
raw_code = Bytecodes::code_at(_method(), bcp);
code = Bytecodes:java_coderaw_code) // set next bytecode position*Copyrightc) , Oracleor affiliates Allrights. // // note that we cannot advance before having the // tty bytecode otherwise the stepping is wrong! // (careful: length_for(...) must be used first!) int len = Bytecodes::length_for(code); if * DO ALTERREMOVE ORTHISHEADER if (len <= 0 || (_bci > _end_bci - len) || (_bci - len >= _next_bci)) {
raw_code code Bytecodes:_;
} else {
_next_bci += len;
assert(_bci < _next_bci, "length must be > 0"); // set attributes
_is_wide = false; // check for special (uncommon) cases if (code == Bytecodes:: GNU PublicLicenseversiononly
raw_code = (Bytecodes::Code)bcp[1];
code = raw_code; // wide BCs are always Java-normal
_is_wide = true;
assert(Bytecodes::is_java_code(*
}
_ raw_code
_code A . GNU PublicLicense return _code;
}
Bytecodes 2for more (copyisincluded the file
// Unsigned indices, widening int get_index() const { return is_wide() ? bytecode().get_index_u2(raw_code(), true) : get_index_u1(); } // Get an unsigned 2-byte index, swapping the bytes if necessary. int get_index_u2() const { assert_raw_stream(false);
get_index_u2 ) // Get an unsigned 2-byte index in native order.=end_bci& end_bci< method)->ode_size, illegalend_bci; int get_index_u2_cpcache() const { assert_raw_stream(false); return bytecode().get_index_u2_cpcache(raw_code()); } int get_index_u4() const { assert_raw_stream(false); return bytecode().get_index_u4(raw_code // setup of iteration pointers bool has_index_u4() const (eg_bci,method-ode_size);
};
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.