/*
* 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.
*
* 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.
*
*/
#include "interpreter/bytecodes.hpp"
#include "memory/allocation.hpp"
#include "oops/methodOop.hpp"
#ifdef TARGET_ARCH_x86
# include "bytes_x86.hpp"
#endif
#ifdef TARGET_ARCH_sparc
# include "bytes_sparc.hpp"
#endif
#ifdef TARGET_ARCH_zero
# include "bytes_zero.hpp"
#endif
#ifdef TARGET_ARCH_arm
# include "bytes_arm.hpp"
#endif
#ifdef TARGET_ARCH_ppc
# include "bytes_ppc.hpp"
#endif
class ciBytecodeStream;
// The base class for different kinds of bytecode abstractions.
// Provides the primitive operations to manipulate code relative
// to the bcp.
protected:
// Address computation
address aligned_addr_at (int offset) const { return (address)round_to((intptr_t)addr_at(offset), jintSize); }
// Word access:
public:
}
// Defined in ciStreams.hpp
// Attributes
Bytecodes::Code invoke_code() const { return (code() == Bytecodes::_invokehandle) ? code() : java_code(); }
// Static functions for parsing bytecodes in place.
}
return Bytes::get_native_u2(p);
else return Bytes::get_Java_u2(p);
}
}
}
}
}
}
}
}
}
// These are used locally and also from bytecode streams.
static void assert_index_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
static void assert_offset_size(int required_size, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
static void assert_constant_size(int required_size, int where, Bytecodes::Code bc, bool is_wide = false) NOT_DEBUG_RETURN;
return (!Bytes::is_Java_byte_ordering_different() || Bytecodes::native_byte_order(bc /*, is_wide*/));
}
};
// Abstractions for lookupswitch bytecode
private:
public:
};
public:
// Defined in ciStreams.hpp
// Attributes
}
};
public:
// Defined in ciStreams.hpp
// Attributes
int dest_offset_at(int i) const;
};
// Common code for decoding invokes and field references.
protected:
Bytecode_member_ref(methodHandle method, int bci) : Bytecode(method(), method()->bcp_from(bci)), _method(method) {}
ConstantPoolCacheEntry* cpcache_entry() const;
public:
int index() const; // cache index (loaded from instruction)
int pool_index() const; // constant pool index
};
// Abstraction for invoke_{virtual, static, interface, special}
protected:
// Constructor that skips verification
public:
void verify() const;
// Attributes
// Testers
is_invokevirtual() ||
is_invokestatic() ||
is_invokespecial() ||
is_invokedynamic() ||
is_invokehandle(); }
private:
// Helper to skip verification. Used is_valid() to check if the result is really an invoke
};
}
public:
// Testers
is_putfield() ||
is_getstatic() ||
is_putstatic(); }
void verify() const;
};
// Abstraction for checkcast
public:
void verify() const { assert(Bytecodes::java_code(code()) == Bytecodes::_checkcast, "check checkcast"); }
// Returns index
};
// Abstraction for instanceof
public:
// Returns index
};
public:
// Returns index
};
public:
// Returns index
};
public:
// Returns index
};
// Abstraction for ldc, ldc_w and ldc2_w
private:
int raw_index() const;
public:
Bytecode_loadconstant(methodHandle method, int bci): Bytecode(method(), method->bcp_from(bci)), _method(method) { verify(); }
void verify() const {
}
// Only non-standard bytecodes (fast_aldc) have CP cache indexes.
int pool_index() const; // index into constant pool
}
};
#endif // SHARE_VM_INTERPRETER_BYTECODE_HPP