7172640: C2: instrinsic implementations in LibraryCallKit should use argument() instead of pop()
Reviewed-by: kvn, jrose
This commit is contained in:
parent
7f0d3fe5e7
commit
31411dbc32
@ -741,6 +741,24 @@ int ciMethod::interpreter_call_site_count(int bci) {
|
|||||||
return -1; // unknown
|
return -1; // unknown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// ciMethod::get_field_at_bci
|
||||||
|
ciField* ciMethod::get_field_at_bci(int bci, bool &will_link) {
|
||||||
|
ciBytecodeStream iter(this);
|
||||||
|
iter.reset_to_bci(bci);
|
||||||
|
iter.next();
|
||||||
|
return iter.get_field(will_link);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ------------------------------------------------------------------
|
||||||
|
// ciMethod::get_method_at_bci
|
||||||
|
ciMethod* ciMethod::get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature) {
|
||||||
|
ciBytecodeStream iter(this);
|
||||||
|
iter.reset_to_bci(bci);
|
||||||
|
iter.next();
|
||||||
|
return iter.get_method(will_link, declared_signature);
|
||||||
|
}
|
||||||
|
|
||||||
// ------------------------------------------------------------------
|
// ------------------------------------------------------------------
|
||||||
// Adjust a CounterData count to be commensurate with
|
// Adjust a CounterData count to be commensurate with
|
||||||
// interpreter_invocation_count. If the MDO exists for
|
// interpreter_invocation_count. If the MDO exists for
|
||||||
|
@ -226,6 +226,9 @@ class ciMethod : public ciMetadata {
|
|||||||
ciCallProfile call_profile_at_bci(int bci);
|
ciCallProfile call_profile_at_bci(int bci);
|
||||||
int interpreter_call_site_count(int bci);
|
int interpreter_call_site_count(int bci);
|
||||||
|
|
||||||
|
ciField* get_field_at_bci( int bci, bool &will_link);
|
||||||
|
ciMethod* get_method_at_bci(int bci, bool &will_link, ciSignature* *declared_signature);
|
||||||
|
|
||||||
// Given a certain calling environment, find the monomorphic target
|
// Given a certain calling environment, find the monomorphic target
|
||||||
// for the call. Return NULL if the call is not monomorphic in
|
// for the call. Return NULL if the call is not monomorphic in
|
||||||
// its calling environment.
|
// its calling environment.
|
||||||
|
@ -63,6 +63,8 @@ public:
|
|||||||
int size() const { return _size; }
|
int size() const { return _size; }
|
||||||
int count() const { return _count; }
|
int count() const { return _count; }
|
||||||
|
|
||||||
|
int arg_size_for_bc(Bytecodes::Code bc) { return size() + (Bytecodes::has_receiver(bc) ? 1 : 0); }
|
||||||
|
|
||||||
bool equals(ciSignature* that);
|
bool equals(ciSignature* that);
|
||||||
|
|
||||||
void print_signature();
|
void print_signature();
|
||||||
|
@ -423,7 +423,9 @@ class Bytecodes: AllStatic {
|
|||||||
static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0
|
static bool is_zero_const (Code code) { return (code == _aconst_null || code == _iconst_0
|
||||||
|| code == _fconst_0 || code == _dconst_0); }
|
|| code == _fconst_0 || code == _dconst_0); }
|
||||||
static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); }
|
static bool is_invoke (Code code) { return (_invokevirtual <= code && code <= _invokedynamic); }
|
||||||
|
static bool has_receiver (Code code) { assert(is_invoke(code), ""); return code == _invokevirtual ||
|
||||||
|
code == _invokespecial ||
|
||||||
|
code == _invokeinterface; }
|
||||||
static bool has_optional_appendix(Code code) { return code == _invokedynamic || code == _invokehandle; }
|
static bool has_optional_appendix(Code code) { return code == _invokedynamic || code == _invokehandle; }
|
||||||
|
|
||||||
static int compute_flags (const char* format, int more_flags = 0); // compute the flags
|
static int compute_flags (const char* format, int more_flags = 0); // compute the flags
|
||||||
|
@ -139,7 +139,7 @@ JVMState* DirectCallGenerator::generate(JVMState* jvms) {
|
|||||||
if (!is_static) {
|
if (!is_static) {
|
||||||
// Make an explicit receiver null_check as part of this call.
|
// Make an explicit receiver null_check as part of this call.
|
||||||
// Since we share a map with the caller, his JVMS gets adjusted.
|
// Since we share a map with the caller, his JVMS gets adjusted.
|
||||||
kit.null_check_receiver(method());
|
kit.null_check_receiver_before_call(method());
|
||||||
if (kit.stopped()) {
|
if (kit.stopped()) {
|
||||||
// And dump it back to the caller, decorated with any exceptions:
|
// And dump it back to the caller, decorated with any exceptions:
|
||||||
return kit.transfer_exceptions_into_jvms();
|
return kit.transfer_exceptions_into_jvms();
|
||||||
@ -207,7 +207,7 @@ JVMState* VirtualCallGenerator::generate(JVMState* jvms) {
|
|||||||
>= (uint)ImplicitNullCheckThreshold))) {
|
>= (uint)ImplicitNullCheckThreshold))) {
|
||||||
// Make an explicit receiver null_check as part of this call.
|
// Make an explicit receiver null_check as part of this call.
|
||||||
// Since we share a map with the caller, his JVMS gets adjusted.
|
// Since we share a map with the caller, his JVMS gets adjusted.
|
||||||
receiver = kit.null_check_receiver(method());
|
receiver = kit.null_check_receiver_before_call(method());
|
||||||
if (kit.stopped()) {
|
if (kit.stopped()) {
|
||||||
// And dump it back to the caller, decorated with any exceptions:
|
// And dump it back to the caller, decorated with any exceptions:
|
||||||
return kit.transfer_exceptions_into_jvms();
|
return kit.transfer_exceptions_into_jvms();
|
||||||
@ -491,7 +491,7 @@ JVMState* PredictedCallGenerator::generate(JVMState* jvms) {
|
|||||||
jvms->bci(), log->identify(_predicted_receiver));
|
jvms->bci(), log->identify(_predicted_receiver));
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver = kit.null_check_receiver(method());
|
receiver = kit.null_check_receiver_before_call(method());
|
||||||
if (kit.stopped()) {
|
if (kit.stopped()) {
|
||||||
return kit.transfer_exceptions_into_jvms();
|
return kit.transfer_exceptions_into_jvms();
|
||||||
}
|
}
|
||||||
@ -597,7 +597,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
|
|||||||
switch (iid) {
|
switch (iid) {
|
||||||
case vmIntrinsics::_invokeBasic:
|
case vmIntrinsics::_invokeBasic:
|
||||||
{
|
{
|
||||||
// get MethodHandle receiver
|
// Get MethodHandle receiver:
|
||||||
Node* receiver = kit.argument(0);
|
Node* receiver = kit.argument(0);
|
||||||
if (receiver->Opcode() == Op_ConP) {
|
if (receiver->Opcode() == Op_ConP) {
|
||||||
const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
|
const TypeOopPtr* oop_ptr = receiver->bottom_type()->is_oopptr();
|
||||||
@ -618,7 +618,7 @@ CallGenerator* CallGenerator::for_method_handle_inline(JVMState* jvms, ciMethod*
|
|||||||
case vmIntrinsics::_linkToSpecial:
|
case vmIntrinsics::_linkToSpecial:
|
||||||
case vmIntrinsics::_linkToInterface:
|
case vmIntrinsics::_linkToInterface:
|
||||||
{
|
{
|
||||||
// pop MemberName argument
|
// Get MemberName argument:
|
||||||
Node* member_name = kit.argument(callee->arg_size() - 1);
|
Node* member_name = kit.argument(callee->arg_size() - 1);
|
||||||
if (member_name->Opcode() == Op_ConP) {
|
if (member_name->Opcode() == Op_ConP) {
|
||||||
const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
|
const TypeOopPtr* oop_ptr = member_name->bottom_type()->is_oopptr();
|
||||||
|
@ -344,17 +344,26 @@ public:
|
|||||||
OopMap *oop_map() const { return _oop_map; }
|
OopMap *oop_map() const { return _oop_map; }
|
||||||
void set_oop_map(OopMap *om) { _oop_map = om; }
|
void set_oop_map(OopMap *om) { _oop_map = om; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
void verify_input(JVMState* jvms, uint idx) const {
|
||||||
|
assert(verify_jvms(jvms), "jvms must match");
|
||||||
|
Node* n = in(idx);
|
||||||
|
assert((!n->bottom_type()->isa_long() && !n->bottom_type()->isa_double()) ||
|
||||||
|
in(idx + 1)->is_top(), "2nd half of long/double");
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
// Functionality from old debug nodes which has changed
|
// Functionality from old debug nodes which has changed
|
||||||
Node *local(JVMState* jvms, uint idx) const {
|
Node *local(JVMState* jvms, uint idx) const {
|
||||||
assert(verify_jvms(jvms), "jvms must match");
|
verify_input(jvms, jvms->locoff() + idx);
|
||||||
return in(jvms->locoff() + idx);
|
return in(jvms->locoff() + idx);
|
||||||
}
|
}
|
||||||
Node *stack(JVMState* jvms, uint idx) const {
|
Node *stack(JVMState* jvms, uint idx) const {
|
||||||
assert(verify_jvms(jvms), "jvms must match");
|
verify_input(jvms, jvms->stkoff() + idx);
|
||||||
return in(jvms->stkoff() + idx);
|
return in(jvms->stkoff() + idx);
|
||||||
}
|
}
|
||||||
Node *argument(JVMState* jvms, uint idx) const {
|
Node *argument(JVMState* jvms, uint idx) const {
|
||||||
assert(verify_jvms(jvms), "jvms must match");
|
verify_input(jvms, jvms->argoff() + idx);
|
||||||
return in(jvms->argoff() + idx);
|
return in(jvms->argoff() + idx);
|
||||||
}
|
}
|
||||||
Node *monitor_box(JVMState* jvms, uint idx) const {
|
Node *monitor_box(JVMState* jvms, uint idx) const {
|
||||||
|
@ -350,7 +350,7 @@ void Parse::do_call() {
|
|||||||
// Set frequently used booleans
|
// Set frequently used booleans
|
||||||
const bool is_virtual = bc() == Bytecodes::_invokevirtual;
|
const bool is_virtual = bc() == Bytecodes::_invokevirtual;
|
||||||
const bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface;
|
const bool is_virtual_or_interface = is_virtual || bc() == Bytecodes::_invokeinterface;
|
||||||
const bool has_receiver = is_virtual_or_interface || bc() == Bytecodes::_invokespecial;
|
const bool has_receiver = Bytecodes::has_receiver(bc());
|
||||||
|
|
||||||
// Find target being called
|
// Find target being called
|
||||||
bool will_link;
|
bool will_link;
|
||||||
@ -380,6 +380,8 @@ void Parse::do_call() {
|
|||||||
// Note: In the absence of miranda methods, an abstract class K can perform
|
// Note: In the absence of miranda methods, an abstract class K can perform
|
||||||
// an invokevirtual directly on an interface method I.m if K implements I.
|
// an invokevirtual directly on an interface method I.m if K implements I.
|
||||||
|
|
||||||
|
// orig_callee is the resolved callee which's signature includes the
|
||||||
|
// appendix argument.
|
||||||
const int nargs = orig_callee->arg_size();
|
const int nargs = orig_callee->arg_size();
|
||||||
|
|
||||||
// Push appendix argument (MethodType, CallSite, etc.), if one.
|
// Push appendix argument (MethodType, CallSite, etc.), if one.
|
||||||
@ -572,7 +574,7 @@ void Parse::do_call() {
|
|||||||
}
|
}
|
||||||
// If there is going to be a trap, put it at the next bytecode:
|
// If there is going to be a trap, put it at the next bytecode:
|
||||||
set_bci(iter().next_bci());
|
set_bci(iter().next_bci());
|
||||||
do_null_assert(peek(), T_OBJECT);
|
null_assert(peek());
|
||||||
set_bci(iter().cur_bci()); // put it back
|
set_bci(iter().cur_bci()); // put it back
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -93,6 +93,16 @@ JVMState* GraphKit::sync_jvms() const {
|
|||||||
return jvms;
|
return jvms;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//--------------------------------sync_jvms_for_reexecute---------------------
|
||||||
|
// Make sure our current jvms agrees with our parse state. This version
|
||||||
|
// uses the reexecute_sp for reexecuting bytecodes.
|
||||||
|
JVMState* GraphKit::sync_jvms_for_reexecute() {
|
||||||
|
JVMState* jvms = this->jvms();
|
||||||
|
jvms->set_bci(bci()); // Record the new bci in the JVMState
|
||||||
|
jvms->set_sp(reexecute_sp()); // Record the new sp in the JVMState
|
||||||
|
return jvms;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
bool GraphKit::jvms_in_sync() const {
|
bool GraphKit::jvms_in_sync() const {
|
||||||
Parse* parse = is_Parse();
|
Parse* parse = is_Parse();
|
||||||
@ -826,7 +836,16 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
|||||||
// Walk the inline list to fill in the correct set of JVMState's
|
// Walk the inline list to fill in the correct set of JVMState's
|
||||||
// Also fill in the associated edges for each JVMState.
|
// Also fill in the associated edges for each JVMState.
|
||||||
|
|
||||||
JVMState* youngest_jvms = sync_jvms();
|
// If the bytecode needs to be reexecuted we need to put
|
||||||
|
// the arguments back on the stack.
|
||||||
|
const bool should_reexecute = jvms()->should_reexecute();
|
||||||
|
JVMState* youngest_jvms = should_reexecute ? sync_jvms_for_reexecute() : sync_jvms();
|
||||||
|
|
||||||
|
// NOTE: set_bci (called from sync_jvms) might reset the reexecute bit to
|
||||||
|
// undefined if the bci is different. This is normal for Parse but it
|
||||||
|
// should not happen for LibraryCallKit because only one bci is processed.
|
||||||
|
assert(!is_LibraryCallKit() || (jvms()->should_reexecute() == should_reexecute),
|
||||||
|
"in LibraryCallKit the reexecute bit should not change");
|
||||||
|
|
||||||
// If we are guaranteed to throw, we can prune everything but the
|
// If we are guaranteed to throw, we can prune everything but the
|
||||||
// input to the current bytecode.
|
// input to the current bytecode.
|
||||||
@ -860,7 +879,7 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Presize the call:
|
// Presize the call:
|
||||||
debug_only(uint non_debug_edges = call->req());
|
DEBUG_ONLY(uint non_debug_edges = call->req());
|
||||||
call->add_req_batch(top(), youngest_jvms->debug_depth());
|
call->add_req_batch(top(), youngest_jvms->debug_depth());
|
||||||
assert(call->req() == non_debug_edges + youngest_jvms->debug_depth(), "");
|
assert(call->req() == non_debug_edges + youngest_jvms->debug_depth(), "");
|
||||||
|
|
||||||
@ -965,7 +984,7 @@ void GraphKit::add_safepoint_edges(SafePointNode* call, bool must_throw) {
|
|||||||
assert(call->jvms()->debug_depth() == call->req() - non_debug_edges, "");
|
assert(call->jvms()->debug_depth() == call->req() - non_debug_edges, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GraphKit::compute_stack_effects(int& inputs, int& depth, bool for_parse) {
|
bool GraphKit::compute_stack_effects(int& inputs, int& depth) {
|
||||||
Bytecodes::Code code = java_bc();
|
Bytecodes::Code code = java_bc();
|
||||||
if (code == Bytecodes::_wide) {
|
if (code == Bytecodes::_wide) {
|
||||||
code = method()->java_code_at_bci(bci() + 1);
|
code = method()->java_code_at_bci(bci() + 1);
|
||||||
@ -1005,13 +1024,10 @@ bool GraphKit::compute_stack_effects(int& inputs, int& depth, bool for_parse) {
|
|||||||
case Bytecodes::_getfield:
|
case Bytecodes::_getfield:
|
||||||
case Bytecodes::_putfield:
|
case Bytecodes::_putfield:
|
||||||
{
|
{
|
||||||
bool is_get = (depth >= 0), is_static = (depth & 1);
|
|
||||||
ciBytecodeStream iter(method());
|
|
||||||
iter.reset_to_bci(bci());
|
|
||||||
iter.next();
|
|
||||||
bool ignored_will_link;
|
bool ignored_will_link;
|
||||||
ciField* field = iter.get_field(ignored_will_link);
|
ciField* field = method()->get_field_at_bci(bci(), ignored_will_link);
|
||||||
int size = field->type()->size();
|
int size = field->type()->size();
|
||||||
|
bool is_get = (depth >= 0), is_static = (depth & 1);
|
||||||
inputs = (is_static ? 0 : 1);
|
inputs = (is_static ? 0 : 1);
|
||||||
if (is_get) {
|
if (is_get) {
|
||||||
depth = size - inputs;
|
depth = size - inputs;
|
||||||
@ -1028,26 +1044,11 @@ bool GraphKit::compute_stack_effects(int& inputs, int& depth, bool for_parse) {
|
|||||||
case Bytecodes::_invokedynamic:
|
case Bytecodes::_invokedynamic:
|
||||||
case Bytecodes::_invokeinterface:
|
case Bytecodes::_invokeinterface:
|
||||||
{
|
{
|
||||||
ciBytecodeStream iter(method());
|
|
||||||
iter.reset_to_bci(bci());
|
|
||||||
iter.next();
|
|
||||||
bool ignored_will_link;
|
bool ignored_will_link;
|
||||||
ciSignature* declared_signature = NULL;
|
ciSignature* declared_signature = NULL;
|
||||||
ciMethod* callee = iter.get_method(ignored_will_link, &declared_signature);
|
ciMethod* ignored_callee = method()->get_method_at_bci(bci(), ignored_will_link, &declared_signature);
|
||||||
assert(declared_signature != NULL, "cannot be null");
|
assert(declared_signature != NULL, "cannot be null");
|
||||||
// (Do not use ciMethod::arg_size(), because
|
inputs = declared_signature->arg_size_for_bc(code);
|
||||||
// it might be an unloaded method, which doesn't
|
|
||||||
// know whether it is static or not.)
|
|
||||||
if (for_parse) {
|
|
||||||
// Case 1: When called from parse we are *before* the invoke (in the
|
|
||||||
// caller) and need to to adjust the inputs by an appendix
|
|
||||||
// argument that will be pushed implicitly.
|
|
||||||
inputs = callee->invoke_arg_size(code) - (iter.has_appendix() ? 1 : 0);
|
|
||||||
} else {
|
|
||||||
// Case 2: Here we are *after* the invoke (in the callee) and need to
|
|
||||||
// remove any appendix arguments that were popped.
|
|
||||||
inputs = callee->invoke_arg_size(code) - (callee->has_member_arg() ? 1 : 0);
|
|
||||||
}
|
|
||||||
int size = declared_signature->return_type()->size();
|
int size = declared_signature->return_type()->size();
|
||||||
depth = size - inputs;
|
depth = size - inputs;
|
||||||
}
|
}
|
||||||
@ -1229,7 +1230,8 @@ Node* GraphKit::null_check_common(Node* value, BasicType type,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
default : ShouldNotReachHere();
|
default:
|
||||||
|
fatal(err_msg_res("unexpected type: %s", type2name(type)));
|
||||||
}
|
}
|
||||||
assert(chk != NULL, "sanity check");
|
assert(chk != NULL, "sanity check");
|
||||||
chk = _gvn.transform(chk);
|
chk = _gvn.transform(chk);
|
||||||
@ -1861,15 +1863,17 @@ void GraphKit::uncommon_trap(int trap_request,
|
|||||||
// occurs here, the runtime will make sure an MDO exists. There is
|
// occurs here, the runtime will make sure an MDO exists. There is
|
||||||
// no need to call method()->ensure_method_data() at this point.
|
// no need to call method()->ensure_method_data() at this point.
|
||||||
|
|
||||||
|
// Set the stack pointer to the right value for reexecution:
|
||||||
|
set_sp(reexecute_sp());
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
if (!must_throw) {
|
if (!must_throw) {
|
||||||
// Make sure the stack has at least enough depth to execute
|
// Make sure the stack has at least enough depth to execute
|
||||||
// the current bytecode.
|
// the current bytecode.
|
||||||
int inputs, ignore;
|
int inputs, ignored_depth;
|
||||||
if (compute_stack_effects(inputs, ignore)) {
|
if (compute_stack_effects(inputs, ignored_depth)) {
|
||||||
assert(sp() >= inputs, "must have enough JVMS stack to execute");
|
assert(sp() >= inputs, err_msg_res("must have enough JVMS stack to execute %s: sp=%d, inputs=%d",
|
||||||
// It is a frequent error in library_call.cpp to issue an
|
Bytecodes::name(java_bc()), sp(), inputs));
|
||||||
// uncommon trap with the _sp value already popped.
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -1900,7 +1904,8 @@ void GraphKit::uncommon_trap(int trap_request,
|
|||||||
case Deoptimization::Action_make_not_compilable:
|
case Deoptimization::Action_make_not_compilable:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
assert(false, "bad action");
|
fatal(err_msg_res("unknown action %d: %s", action, Deoptimization::trap_action_name(action)));
|
||||||
|
break;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2667,7 +2672,7 @@ Node* GraphKit::gen_checkcast(Node *obj, Node* superklass,
|
|||||||
case SSC_always_false:
|
case SSC_always_false:
|
||||||
// It needs a null check because a null will *pass* the cast check.
|
// It needs a null check because a null will *pass* the cast check.
|
||||||
// A non-null value will always produce an exception.
|
// A non-null value will always produce an exception.
|
||||||
return do_null_assert(obj, T_OBJECT);
|
return null_assert(obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3148,7 +3153,7 @@ Node* GraphKit::new_array(Node* klass_node, // array klass (maybe variable)
|
|||||||
Node* cmp_lh = _gvn.transform( new(C) CmpINode(layout_val, intcon(layout_con)) );
|
Node* cmp_lh = _gvn.transform( new(C) CmpINode(layout_val, intcon(layout_con)) );
|
||||||
Node* bol_lh = _gvn.transform( new(C) BoolNode(cmp_lh, BoolTest::eq) );
|
Node* bol_lh = _gvn.transform( new(C) BoolNode(cmp_lh, BoolTest::eq) );
|
||||||
{ BuildCutout unless(this, bol_lh, PROB_MAX);
|
{ BuildCutout unless(this, bol_lh, PROB_MAX);
|
||||||
_sp += nargs;
|
inc_sp(nargs);
|
||||||
uncommon_trap(Deoptimization::Reason_class_check,
|
uncommon_trap(Deoptimization::Reason_class_check,
|
||||||
Deoptimization::Action_maybe_recompile);
|
Deoptimization::Action_maybe_recompile);
|
||||||
}
|
}
|
||||||
@ -3391,7 +3396,7 @@ void GraphKit::add_predicate_impl(Deoptimization::DeoptReason reason, int nargs)
|
|||||||
{
|
{
|
||||||
PreserveJVMState pjvms(this);
|
PreserveJVMState pjvms(this);
|
||||||
set_control(iffalse);
|
set_control(iffalse);
|
||||||
_sp += nargs;
|
inc_sp(nargs);
|
||||||
uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
|
uncommon_trap(reason, Deoptimization::Action_maybe_recompile);
|
||||||
}
|
}
|
||||||
Node* iftrue = _gvn.transform(new (C) IfTrueNode(iff));
|
Node* iftrue = _gvn.transform(new (C) IfTrueNode(iff));
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
class FastLockNode;
|
class FastLockNode;
|
||||||
class FastUnlockNode;
|
class FastUnlockNode;
|
||||||
class IdealKit;
|
class IdealKit;
|
||||||
|
class LibraryCallKit;
|
||||||
class Parse;
|
class Parse;
|
||||||
class RootNode;
|
class RootNode;
|
||||||
|
|
||||||
@ -60,10 +61,12 @@ class GraphKit : public Phase {
|
|||||||
PhaseGVN &_gvn; // Some optimizations while parsing
|
PhaseGVN &_gvn; // Some optimizations while parsing
|
||||||
SafePointNode* _map; // Parser map from JVM to Nodes
|
SafePointNode* _map; // Parser map from JVM to Nodes
|
||||||
SafePointNode* _exceptions;// Parser map(s) for exception state(s)
|
SafePointNode* _exceptions;// Parser map(s) for exception state(s)
|
||||||
int _sp; // JVM Expression Stack Pointer
|
|
||||||
int _bci; // JVM Bytecode Pointer
|
int _bci; // JVM Bytecode Pointer
|
||||||
ciMethod* _method; // JVM Current Method
|
ciMethod* _method; // JVM Current Method
|
||||||
|
|
||||||
|
private:
|
||||||
|
int _sp; // JVM Expression Stack Pointer; don't modify directly!
|
||||||
|
|
||||||
private:
|
private:
|
||||||
SafePointNode* map_not_null() const {
|
SafePointNode* map_not_null() const {
|
||||||
assert(_map != NULL, "must call stopped() to test for reset compiler map");
|
assert(_map != NULL, "must call stopped() to test for reset compiler map");
|
||||||
@ -81,6 +84,7 @@ class GraphKit : public Phase {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
virtual Parse* is_Parse() const { return NULL; }
|
virtual Parse* is_Parse() const { return NULL; }
|
||||||
|
virtual LibraryCallKit* is_LibraryCallKit() const { return NULL; }
|
||||||
|
|
||||||
ciEnv* env() const { return _env; }
|
ciEnv* env() const { return _env; }
|
||||||
PhaseGVN& gvn() const { return _gvn; }
|
PhaseGVN& gvn() const { return _gvn; }
|
||||||
@ -141,7 +145,7 @@ class GraphKit : public Phase {
|
|||||||
_bci = jvms->bci();
|
_bci = jvms->bci();
|
||||||
_method = jvms->has_method() ? jvms->method() : NULL; }
|
_method = jvms->has_method() ? jvms->method() : NULL; }
|
||||||
void set_map(SafePointNode* m) { _map = m; debug_only(verify_map()); }
|
void set_map(SafePointNode* m) { _map = m; debug_only(verify_map()); }
|
||||||
void set_sp(int i) { assert(i >= 0, "must be non-negative"); _sp = i; }
|
void set_sp(int sp) { assert(sp >= 0, err_msg_res("sp must be non-negative: %d", sp)); _sp = sp; }
|
||||||
void clean_stack(int from_sp); // clear garbage beyond from_sp to top
|
void clean_stack(int from_sp); // clear garbage beyond from_sp to top
|
||||||
|
|
||||||
void inc_sp(int i) { set_sp(sp() + i); }
|
void inc_sp(int i) { set_sp(sp() + i); }
|
||||||
@ -150,6 +154,8 @@ class GraphKit : public Phase {
|
|||||||
|
|
||||||
// Make sure jvms has current bci & sp.
|
// Make sure jvms has current bci & sp.
|
||||||
JVMState* sync_jvms() const;
|
JVMState* sync_jvms() const;
|
||||||
|
JVMState* sync_jvms_for_reexecute();
|
||||||
|
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
// Make sure JVMS has an updated copy of bci and sp.
|
// Make sure JVMS has an updated copy of bci and sp.
|
||||||
// Also sanity-check method, depth, and monitor depth.
|
// Also sanity-check method, depth, and monitor depth.
|
||||||
@ -286,7 +292,7 @@ class GraphKit : public Phase {
|
|||||||
// How many stack inputs does the current BC consume?
|
// How many stack inputs does the current BC consume?
|
||||||
// And, how does the stack change after the bytecode?
|
// And, how does the stack change after the bytecode?
|
||||||
// Returns false if unknown.
|
// Returns false if unknown.
|
||||||
bool compute_stack_effects(int& inputs, int& depth, bool for_parse = false);
|
bool compute_stack_effects(int& inputs, int& depth);
|
||||||
|
|
||||||
// Add a fixed offset to a pointer
|
// Add a fixed offset to a pointer
|
||||||
Node* basic_plus_adr(Node* base, Node* ptr, intptr_t offset) {
|
Node* basic_plus_adr(Node* base, Node* ptr, intptr_t offset) {
|
||||||
@ -337,20 +343,37 @@ class GraphKit : public Phase {
|
|||||||
Node* load_object_klass(Node* object);
|
Node* load_object_klass(Node* object);
|
||||||
// Find out the length of an array.
|
// Find out the length of an array.
|
||||||
Node* load_array_length(Node* array);
|
Node* load_array_length(Node* array);
|
||||||
|
|
||||||
|
|
||||||
// Helper function to do a NULL pointer check or ZERO check based on type.
|
// Helper function to do a NULL pointer check or ZERO check based on type.
|
||||||
Node* null_check_common(Node* value, BasicType type,
|
|
||||||
bool assert_null, Node* *null_control);
|
|
||||||
// Throw an exception if a given value is null.
|
// Throw an exception if a given value is null.
|
||||||
// Return the value cast to not-null.
|
// Return the value cast to not-null.
|
||||||
// Be clever about equivalent dominating null checks.
|
// Be clever about equivalent dominating null checks.
|
||||||
Node* do_null_check(Node* value, BasicType type) {
|
Node* null_check_common(Node* value, BasicType type,
|
||||||
return null_check_common(value, type, false, NULL);
|
bool assert_null = false, Node* *null_control = NULL);
|
||||||
|
Node* null_check(Node* value, BasicType type = T_OBJECT) {
|
||||||
|
return null_check_common(value, type);
|
||||||
|
}
|
||||||
|
Node* null_check_receiver() {
|
||||||
|
assert(argument(0)->bottom_type()->isa_ptr(), "must be");
|
||||||
|
return null_check(argument(0));
|
||||||
|
}
|
||||||
|
Node* zero_check_int(Node* value) {
|
||||||
|
assert(value->bottom_type()->basic_type() == T_INT,
|
||||||
|
err_msg_res("wrong type: %s", type2name(value->bottom_type()->basic_type())));
|
||||||
|
return null_check_common(value, T_INT);
|
||||||
|
}
|
||||||
|
Node* zero_check_long(Node* value) {
|
||||||
|
assert(value->bottom_type()->basic_type() == T_LONG,
|
||||||
|
err_msg_res("wrong type: %s", type2name(value->bottom_type()->basic_type())));
|
||||||
|
return null_check_common(value, T_LONG);
|
||||||
}
|
}
|
||||||
// Throw an uncommon trap if a given value is __not__ null.
|
// Throw an uncommon trap if a given value is __not__ null.
|
||||||
// Return the value cast to null, and be clever about dominating checks.
|
// Return the value cast to null, and be clever about dominating checks.
|
||||||
Node* do_null_assert(Node* value, BasicType type) {
|
Node* null_assert(Node* value, BasicType type = T_OBJECT) {
|
||||||
return null_check_common(value, type, true, NULL);
|
return null_check_common(value, type, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Null check oop. Return null-path control into (*null_control).
|
// Null check oop. Return null-path control into (*null_control).
|
||||||
// Return a cast-not-null node which depends on the not-null control.
|
// Return a cast-not-null node which depends on the not-null control.
|
||||||
// If never_see_null, use an uncommon trap (*null_control sees a top).
|
// If never_see_null, use an uncommon trap (*null_control sees a top).
|
||||||
@ -580,19 +603,15 @@ class GraphKit : public Phase {
|
|||||||
|
|
||||||
//---------- help for generating calls --------------
|
//---------- help for generating calls --------------
|
||||||
|
|
||||||
// Do a null check on the receiver, which is in argument(0).
|
// Do a null check on the receiver as it would happen before the call to
|
||||||
Node* null_check_receiver(ciMethod* callee) {
|
// callee (with all arguments still on the stack).
|
||||||
|
Node* null_check_receiver_before_call(ciMethod* callee) {
|
||||||
assert(!callee->is_static(), "must be a virtual method");
|
assert(!callee->is_static(), "must be a virtual method");
|
||||||
int nargs = 1 + callee->signature()->size();
|
const int nargs = callee->arg_size();
|
||||||
// Null check on self without removing any arguments. The argument
|
inc_sp(nargs);
|
||||||
// null check technically happens in the wrong place, which can lead to
|
Node* n = null_check_receiver();
|
||||||
// invalid stack traces when the primitive is inlined into a method
|
dec_sp(nargs);
|
||||||
// which handles NullPointerExceptions.
|
return n;
|
||||||
Node* receiver = argument(0);
|
|
||||||
_sp += nargs;
|
|
||||||
receiver = do_null_check(receiver, T_OBJECT);
|
|
||||||
_sp -= nargs;
|
|
||||||
return receiver;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fill in argument edges for the call from argument(0), argument(1), ...
|
// Fill in argument edges for the call from argument(0), argument(1), ...
|
||||||
@ -645,6 +664,9 @@ class GraphKit : public Phase {
|
|||||||
klass, reason_string, must_throw, keep_exact_action);
|
klass, reason_string, must_throw, keep_exact_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SP when bytecode needs to be reexecuted.
|
||||||
|
virtual int reexecute_sp() { return sp(); }
|
||||||
|
|
||||||
// Report if there were too many traps at the current method and bci.
|
// Report if there were too many traps at the current method and bci.
|
||||||
// Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded.
|
// Report if a trap was recorded, and/or PerMethodTrapLimit was exceeded.
|
||||||
// If there is no MDO at all, report no trap unless told to assume it.
|
// If there is no MDO at all, report no trap unless told to assume it.
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -165,7 +165,7 @@ void Parse::do_monitor_enter() {
|
|||||||
kill_dead_locals();
|
kill_dead_locals();
|
||||||
|
|
||||||
// Null check; get casted pointer.
|
// Null check; get casted pointer.
|
||||||
Node *obj = do_null_check(peek(), T_OBJECT);
|
Node* obj = null_check(peek());
|
||||||
// Check for locking null object
|
// Check for locking null object
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
|
|
||||||
|
@ -1008,7 +1008,7 @@ SafePointNode* Parse::create_entry_map() {
|
|||||||
// If this is an inlined method, we may have to do a receiver null check.
|
// If this is an inlined method, we may have to do a receiver null check.
|
||||||
if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
|
if (_caller->has_method() && is_normal_parse() && !method()->is_static()) {
|
||||||
GraphKit kit(_caller);
|
GraphKit kit(_caller);
|
||||||
kit.null_check_receiver(method());
|
kit.null_check_receiver_before_call(method());
|
||||||
_caller = kit.transfer_exceptions_into_jvms();
|
_caller = kit.transfer_exceptions_into_jvms();
|
||||||
if (kit.stopped()) {
|
if (kit.stopped()) {
|
||||||
_exits.add_exception_states_from(_caller);
|
_exits.add_exception_states_from(_caller);
|
||||||
@ -1398,7 +1398,7 @@ void Parse::do_one_block() {
|
|||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
int pre_bc_sp = sp();
|
int pre_bc_sp = sp();
|
||||||
int inputs, depth;
|
int inputs, depth;
|
||||||
bool have_se = !stopped() && compute_stack_effects(inputs, depth, /*for_parse*/ true);
|
bool have_se = !stopped() && compute_stack_effects(inputs, depth);
|
||||||
assert(!have_se || pre_bc_sp >= inputs, err_msg_res("have enough stack to execute this BC: pre_bc_sp=%d, inputs=%d", pre_bc_sp, inputs));
|
assert(!have_se || pre_bc_sp >= inputs, err_msg_res("have enough stack to execute this BC: pre_bc_sp=%d, inputs=%d", pre_bc_sp, inputs));
|
||||||
#endif //ASSERT
|
#endif //ASSERT
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ void Parse::array_load(BasicType elem_type) {
|
|||||||
const Type* elem = Type::TOP;
|
const Type* elem = Type::TOP;
|
||||||
Node* adr = array_addressing(elem_type, 0, &elem);
|
Node* adr = array_addressing(elem_type, 0, &elem);
|
||||||
if (stopped()) return; // guaranteed null or range check
|
if (stopped()) return; // guaranteed null or range check
|
||||||
_sp -= 2; // Pop array and index
|
dec_sp(2); // Pop array and index
|
||||||
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
|
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
|
||||||
Node* ld = make_load(control(), adr, elem, elem_type, adr_type);
|
Node* ld = make_load(control(), adr, elem, elem_type, adr_type);
|
||||||
push(ld);
|
push(ld);
|
||||||
@ -60,7 +60,7 @@ void Parse::array_store(BasicType elem_type) {
|
|||||||
Node* adr = array_addressing(elem_type, 1);
|
Node* adr = array_addressing(elem_type, 1);
|
||||||
if (stopped()) return; // guaranteed null or range check
|
if (stopped()) return; // guaranteed null or range check
|
||||||
Node* val = pop();
|
Node* val = pop();
|
||||||
_sp -= 2; // Pop array and index
|
dec_sp(2); // Pop array and index
|
||||||
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
|
const TypeAryPtr* adr_type = TypeAryPtr::get_array_body_type(elem_type);
|
||||||
store_to_memory(control(), adr, val, elem_type, adr_type);
|
store_to_memory(control(), adr, val, elem_type, adr_type);
|
||||||
}
|
}
|
||||||
@ -73,7 +73,7 @@ Node* Parse::array_addressing(BasicType type, int vals, const Type* *result2) {
|
|||||||
Node *ary = peek(1+vals); // in case of exception
|
Node *ary = peek(1+vals); // in case of exception
|
||||||
|
|
||||||
// Null check the array base, with correct stack contents
|
// Null check the array base, with correct stack contents
|
||||||
ary = do_null_check(ary, T_ARRAY);
|
ary = null_check(ary, T_ARRAY);
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return top();
|
if (stopped()) return top();
|
||||||
|
|
||||||
@ -681,7 +681,7 @@ void Parse::l2f() {
|
|||||||
|
|
||||||
void Parse::do_irem() {
|
void Parse::do_irem() {
|
||||||
// Must keep both values on the expression-stack during null-check
|
// Must keep both values on the expression-stack during null-check
|
||||||
do_null_check(peek(), T_INT);
|
zero_check_int(peek());
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
|
|
||||||
@ -958,7 +958,7 @@ inline int Parse::repush_if_args() {
|
|||||||
DEBUG_ONLY(sync_jvms()); // argument(n) requires a synced jvms
|
DEBUG_ONLY(sync_jvms()); // argument(n) requires a synced jvms
|
||||||
assert(argument(0) != NULL, "must exist");
|
assert(argument(0) != NULL, "must exist");
|
||||||
assert(bc_depth == 1 || argument(1) != NULL, "two must exist");
|
assert(bc_depth == 1 || argument(1) != NULL, "two must exist");
|
||||||
_sp += bc_depth;
|
inc_sp(bc_depth);
|
||||||
return bc_depth;
|
return bc_depth;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1581,8 +1581,8 @@ void Parse::do_one_bytecode() {
|
|||||||
set_pair_local( iter().get_index(), dstore_rounding(pop_pair()) );
|
set_pair_local( iter().get_index(), dstore_rounding(pop_pair()) );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Bytecodes::_pop: _sp -= 1; break;
|
case Bytecodes::_pop: dec_sp(1); break;
|
||||||
case Bytecodes::_pop2: _sp -= 2; break;
|
case Bytecodes::_pop2: dec_sp(2); break;
|
||||||
case Bytecodes::_swap:
|
case Bytecodes::_swap:
|
||||||
a = pop();
|
a = pop();
|
||||||
b = pop();
|
b = pop();
|
||||||
@ -1650,7 +1650,7 @@ void Parse::do_one_bytecode() {
|
|||||||
|
|
||||||
case Bytecodes::_arraylength: {
|
case Bytecodes::_arraylength: {
|
||||||
// Must do null-check with value on expression stack
|
// Must do null-check with value on expression stack
|
||||||
Node *ary = do_null_check(peek(), T_ARRAY);
|
Node *ary = null_check(peek(), T_ARRAY);
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
a = pop();
|
a = pop();
|
||||||
@ -1667,14 +1667,14 @@ void Parse::do_one_bytecode() {
|
|||||||
case Bytecodes::_laload: {
|
case Bytecodes::_laload: {
|
||||||
a = array_addressing(T_LONG, 0);
|
a = array_addressing(T_LONG, 0);
|
||||||
if (stopped()) return; // guaranteed null or range check
|
if (stopped()) return; // guaranteed null or range check
|
||||||
_sp -= 2; // Pop array and index
|
dec_sp(2); // Pop array and index
|
||||||
push_pair(make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS));
|
push_pair(make_load(control(), a, TypeLong::LONG, T_LONG, TypeAryPtr::LONGS));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case Bytecodes::_daload: {
|
case Bytecodes::_daload: {
|
||||||
a = array_addressing(T_DOUBLE, 0);
|
a = array_addressing(T_DOUBLE, 0);
|
||||||
if (stopped()) return; // guaranteed null or range check
|
if (stopped()) return; // guaranteed null or range check
|
||||||
_sp -= 2; // Pop array and index
|
dec_sp(2); // Pop array and index
|
||||||
push_pair(make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES));
|
push_pair(make_load(control(), a, Type::DOUBLE, T_DOUBLE, TypeAryPtr::DOUBLES));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1699,7 +1699,7 @@ void Parse::do_one_bytecode() {
|
|||||||
a = array_addressing(T_LONG, 2);
|
a = array_addressing(T_LONG, 2);
|
||||||
if (stopped()) return; // guaranteed null or range check
|
if (stopped()) return; // guaranteed null or range check
|
||||||
c = pop_pair();
|
c = pop_pair();
|
||||||
_sp -= 2; // Pop array and index
|
dec_sp(2); // Pop array and index
|
||||||
store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS);
|
store_to_memory(control(), a, c, T_LONG, TypeAryPtr::LONGS);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1707,7 +1707,7 @@ void Parse::do_one_bytecode() {
|
|||||||
a = array_addressing(T_DOUBLE, 2);
|
a = array_addressing(T_DOUBLE, 2);
|
||||||
if (stopped()) return; // guaranteed null or range check
|
if (stopped()) return; // guaranteed null or range check
|
||||||
c = pop_pair();
|
c = pop_pair();
|
||||||
_sp -= 2; // Pop array and index
|
dec_sp(2); // Pop array and index
|
||||||
c = dstore_rounding(c);
|
c = dstore_rounding(c);
|
||||||
store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES);
|
store_to_memory(control(), a, c, T_DOUBLE, TypeAryPtr::DOUBLES);
|
||||||
break;
|
break;
|
||||||
@ -1733,7 +1733,7 @@ void Parse::do_one_bytecode() {
|
|||||||
break;
|
break;
|
||||||
case Bytecodes::_idiv:
|
case Bytecodes::_idiv:
|
||||||
// Must keep both values on the expression-stack during null-check
|
// Must keep both values on the expression-stack during null-check
|
||||||
do_null_check(peek(), T_INT);
|
zero_check_int(peek());
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
b = pop();
|
b = pop();
|
||||||
@ -2041,7 +2041,7 @@ void Parse::do_one_bytecode() {
|
|||||||
case Bytecodes::_lrem:
|
case Bytecodes::_lrem:
|
||||||
// Must keep both values on the expression-stack during null-check
|
// Must keep both values on the expression-stack during null-check
|
||||||
assert(peek(0) == top(), "long word order");
|
assert(peek(0) == top(), "long word order");
|
||||||
do_null_check(peek(1), T_LONG);
|
zero_check_long(peek(1));
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
b = pop_pair();
|
b = pop_pair();
|
||||||
@ -2053,7 +2053,7 @@ void Parse::do_one_bytecode() {
|
|||||||
case Bytecodes::_ldiv:
|
case Bytecodes::_ldiv:
|
||||||
// Must keep both values on the expression-stack during null-check
|
// Must keep both values on the expression-stack during null-check
|
||||||
assert(peek(0) == top(), "long word order");
|
assert(peek(0) == top(), "long word order");
|
||||||
do_null_check(peek(1), T_LONG);
|
zero_check_long(peek(1));
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
b = pop_pair();
|
b = pop_pair();
|
||||||
@ -2175,7 +2175,7 @@ void Parse::do_one_bytecode() {
|
|||||||
|
|
||||||
case Bytecodes::_athrow:
|
case Bytecodes::_athrow:
|
||||||
// null exception oop throws NULL pointer exception
|
// null exception oop throws NULL pointer exception
|
||||||
do_null_check(peek(), T_OBJECT);
|
null_check(peek());
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
// Hook the thrown exception directly to subsequent handlers.
|
// Hook the thrown exception directly to subsequent handlers.
|
||||||
if (BailoutToInterpreterForThrows) {
|
if (BailoutToInterpreterForThrows) {
|
||||||
|
@ -116,7 +116,7 @@ void Parse::do_field_access(bool is_get, bool is_field) {
|
|||||||
Node* obj;
|
Node* obj;
|
||||||
if (is_field) {
|
if (is_field) {
|
||||||
int obj_depth = is_get ? 0 : field->type()->size();
|
int obj_depth = is_get ? 0 : field->type()->size();
|
||||||
obj = do_null_check(peek(obj_depth), T_OBJECT);
|
obj = null_check(peek(obj_depth));
|
||||||
// Compile-time detect of null-exception?
|
// Compile-time detect of null-exception?
|
||||||
if (stopped()) return;
|
if (stopped()) return;
|
||||||
|
|
||||||
@ -126,11 +126,11 @@ void Parse::do_field_access(bool is_get, bool is_field) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (is_get) {
|
if (is_get) {
|
||||||
--_sp; // pop receiver before getting
|
(void) pop(); // pop receiver before getting
|
||||||
do_get_xxx(obj, field, is_field);
|
do_get_xxx(obj, field, is_field);
|
||||||
} else {
|
} else {
|
||||||
do_put_xxx(obj, field, is_field);
|
do_put_xxx(obj, field, is_field);
|
||||||
--_sp; // pop receiver after putting
|
(void) pop(); // pop receiver after putting
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const TypeInstPtr* tip = TypeInstPtr::make(field_holder->java_mirror());
|
const TypeInstPtr* tip = TypeInstPtr::make(field_holder->java_mirror());
|
||||||
@ -230,7 +230,7 @@ void Parse::do_get_xxx(Node* obj, ciField* field, bool is_field) {
|
|||||||
}
|
}
|
||||||
// If there is going to be a trap, put it at the next bytecode:
|
// If there is going to be a trap, put it at the next bytecode:
|
||||||
set_bci(iter().next_bci());
|
set_bci(iter().next_bci());
|
||||||
do_null_assert(peek(), T_OBJECT);
|
null_assert(peek());
|
||||||
set_bci(iter().cur_bci()); // put it back
|
set_bci(iter().cur_bci()); // put it back
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,7 +463,7 @@ void Parse::do_multianewarray() {
|
|||||||
// Note: the reexecute bit will be set in GraphKit::add_safepoint_edges()
|
// Note: the reexecute bit will be set in GraphKit::add_safepoint_edges()
|
||||||
// when AllocateArray node for newarray is created.
|
// when AllocateArray node for newarray is created.
|
||||||
{ PreserveReexecuteState preexecs(this);
|
{ PreserveReexecuteState preexecs(this);
|
||||||
_sp += ndimensions;
|
inc_sp(ndimensions);
|
||||||
// Pass 0 as nargs since uncommon trap code does not need to restore stack.
|
// Pass 0 as nargs since uncommon trap code does not need to restore stack.
|
||||||
obj = expand_multianewarray(array_klass, &length[0], ndimensions, 0);
|
obj = expand_multianewarray(array_klass, &length[0], ndimensions, 0);
|
||||||
} //original reexecute and sp are set back here
|
} //original reexecute and sp are set back here
|
||||||
@ -492,7 +492,7 @@ void Parse::do_multianewarray() {
|
|||||||
// Create a java array for dimension sizes
|
// Create a java array for dimension sizes
|
||||||
Node* dims = NULL;
|
Node* dims = NULL;
|
||||||
{ PreserveReexecuteState preexecs(this);
|
{ PreserveReexecuteState preexecs(this);
|
||||||
_sp += ndimensions;
|
inc_sp(ndimensions);
|
||||||
Node* dims_array_klass = makecon(TypeKlassPtr::make(ciArrayKlass::make(ciType::make(T_INT))));
|
Node* dims_array_klass = makecon(TypeKlassPtr::make(ciArrayKlass::make(ciType::make(T_INT))));
|
||||||
dims = new_array(dims_array_klass, intcon(ndimensions), 0);
|
dims = new_array(dims_array_klass, intcon(ndimensions), 0);
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ void Parse::do_checkcast() {
|
|||||||
C->log()->identify(tp->klass()));
|
C->log()->identify(tp->klass()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
do_null_assert(obj, T_OBJECT);
|
null_assert(obj);
|
||||||
assert( stopped() || _gvn.type(peek())->higher_equal(TypePtr::NULL_PTR), "what's left behind is null" );
|
assert( stopped() || _gvn.type(peek())->higher_equal(TypePtr::NULL_PTR), "what's left behind is null" );
|
||||||
if (!stopped()) {
|
if (!stopped()) {
|
||||||
profile_null_checkcast();
|
profile_null_checkcast();
|
||||||
@ -116,7 +116,7 @@ void Parse::do_instanceof() {
|
|||||||
C->log()->elem("assert_null reason='instanceof' klass='%d'",
|
C->log()->elem("assert_null reason='instanceof' klass='%d'",
|
||||||
C->log()->identify(klass));
|
C->log()->identify(klass));
|
||||||
}
|
}
|
||||||
do_null_assert(peek(), T_OBJECT);
|
null_assert(peek());
|
||||||
assert( stopped() || _gvn.type(peek())->higher_equal(TypePtr::NULL_PTR), "what's left behind is null" );
|
assert( stopped() || _gvn.type(peek())->higher_equal(TypePtr::NULL_PTR), "what's left behind is null" );
|
||||||
if (!stopped()) {
|
if (!stopped()) {
|
||||||
// The object is now known to be null.
|
// The object is now known to be null.
|
||||||
@ -139,10 +139,10 @@ void Parse::do_instanceof() {
|
|||||||
// pull array from stack and check that the store is valid
|
// pull array from stack and check that the store is valid
|
||||||
void Parse::array_store_check() {
|
void Parse::array_store_check() {
|
||||||
|
|
||||||
// Shorthand access to array store elements
|
// Shorthand access to array store elements without popping them.
|
||||||
Node *obj = stack(_sp-1);
|
Node *obj = peek(0);
|
||||||
Node *idx = stack(_sp-2);
|
Node *idx = peek(1);
|
||||||
Node *ary = stack(_sp-3);
|
Node *ary = peek(2);
|
||||||
|
|
||||||
if (_gvn.type(obj) == TypePtr::NULL_PTR) {
|
if (_gvn.type(obj) == TypePtr::NULL_PTR) {
|
||||||
// There's never a type check on null values.
|
// There's never a type check on null values.
|
||||||
|
@ -242,8 +242,10 @@ public:
|
|||||||
const TypeInt *isa_int() const; // Returns NULL if not an Int
|
const TypeInt *isa_int() const; // Returns NULL if not an Int
|
||||||
const TypeLong *is_long() const;
|
const TypeLong *is_long() const;
|
||||||
const TypeLong *isa_long() const; // Returns NULL if not a Long
|
const TypeLong *isa_long() const; // Returns NULL if not a Long
|
||||||
|
const TypeD *isa_double() const; // Returns NULL if not a Double{Top,Con,Bot}
|
||||||
const TypeD *is_double_constant() const; // Asserts it is a DoubleCon
|
const TypeD *is_double_constant() const; // Asserts it is a DoubleCon
|
||||||
const TypeD *isa_double_constant() const; // Returns NULL if not a DoubleCon
|
const TypeD *isa_double_constant() const; // Returns NULL if not a DoubleCon
|
||||||
|
const TypeF *isa_float() const; // Returns NULL if not a Float{Top,Con,Bot}
|
||||||
const TypeF *is_float_constant() const; // Asserts it is a FloatCon
|
const TypeF *is_float_constant() const; // Asserts it is a FloatCon
|
||||||
const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon
|
const TypeF *isa_float_constant() const; // Returns NULL if not a FloatCon
|
||||||
const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer
|
const TypeTuple *is_tuple() const; // Collection of fields, NOT a pointer
|
||||||
@ -1320,24 +1322,6 @@ inline double Type::getd() const {
|
|||||||
return ((TypeD*)this)->_d;
|
return ((TypeD*)this)->_d;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline const TypeF *Type::is_float_constant() const {
|
|
||||||
assert( _base == FloatCon, "Not a Float" );
|
|
||||||
return (TypeF*)this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const TypeF *Type::isa_float_constant() const {
|
|
||||||
return ( _base == FloatCon ? (TypeF*)this : NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const TypeD *Type::is_double_constant() const {
|
|
||||||
assert( _base == DoubleCon, "Not a Double" );
|
|
||||||
return (TypeD*)this;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const TypeD *Type::isa_double_constant() const {
|
|
||||||
return ( _base == DoubleCon ? (TypeD*)this : NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
inline const TypeInt *Type::is_int() const {
|
inline const TypeInt *Type::is_int() const {
|
||||||
assert( _base == Int, "Not an Int" );
|
assert( _base == Int, "Not an Int" );
|
||||||
return (TypeInt*)this;
|
return (TypeInt*)this;
|
||||||
@ -1356,6 +1340,36 @@ inline const TypeLong *Type::isa_long() const {
|
|||||||
return ( _base == Long ? (TypeLong*)this : NULL);
|
return ( _base == Long ? (TypeLong*)this : NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline const TypeF *Type::isa_float() const {
|
||||||
|
return ((_base == FloatTop ||
|
||||||
|
_base == FloatCon ||
|
||||||
|
_base == FloatBot) ? (TypeF*)this : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const TypeF *Type::is_float_constant() const {
|
||||||
|
assert( _base == FloatCon, "Not a Float" );
|
||||||
|
return (TypeF*)this;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const TypeF *Type::isa_float_constant() const {
|
||||||
|
return ( _base == FloatCon ? (TypeF*)this : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const TypeD *Type::isa_double() const {
|
||||||
|
return ((_base == DoubleTop ||
|
||||||
|
_base == DoubleCon ||
|
||||||
|
_base == DoubleBot) ? (TypeD*)this : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const TypeD *Type::is_double_constant() const {
|
||||||
|
assert( _base == DoubleCon, "Not a Double" );
|
||||||
|
return (TypeD*)this;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline const TypeD *Type::isa_double_constant() const {
|
||||||
|
return ( _base == DoubleCon ? (TypeD*)this : NULL);
|
||||||
|
}
|
||||||
|
|
||||||
inline const TypeTuple *Type::is_tuple() const {
|
inline const TypeTuple *Type::is_tuple() const {
|
||||||
assert( _base == Tuple, "Not a Tuple" );
|
assert( _base == Tuple, "Not a Tuple" );
|
||||||
return (TypeTuple*)this;
|
return (TypeTuple*)this;
|
||||||
|
Loading…
Reference in New Issue
Block a user