Mercurial > hg > truffle
comparison src/share/vm/opto/callnode.cpp @ 366:8261ee795323
6711100: 64bit fastdebug server vm crashes with assert(_base == Int,"Not an Int")
Summary: insert CastII nodes to narrow type of load_array_length() node
Reviewed-by: never, kvn
author | rasbold |
---|---|
date | Wed, 17 Sep 2008 08:29:17 -0700 |
parents | cecd8eb4e0ca |
children | a1980da045cc |
comparison
equal
deleted
inserted
replaced
333:7484fa4b8825 | 366:8261ee795323 |
---|---|
1032 } | 1032 } |
1033 | 1033 |
1034 //============================================================================= | 1034 //============================================================================= |
1035 uint AllocateArrayNode::size_of() const { return sizeof(*this); } | 1035 uint AllocateArrayNode::size_of() const { return sizeof(*this); } |
1036 | 1036 |
1037 // Retrieve the length from the AllocateArrayNode. Narrow the type with a | |
1038 // CastII, if appropriate. If we are not allowed to create new nodes, and | |
1039 // a CastII is appropriate, return NULL. | |
1040 Node *AllocateArrayNode::make_ideal_length(const TypeOopPtr* oop_type, PhaseTransform *phase, bool allow_new_nodes) { | |
1041 Node *length = in(AllocateNode::ALength); | |
1042 assert(length != NULL, "length is not null"); | |
1043 | |
1044 const TypeInt* length_type = phase->find_int_type(length); | |
1045 const TypeAryPtr* ary_type = oop_type->isa_aryptr(); | |
1046 | |
1047 if (ary_type != NULL && length_type != NULL) { | |
1048 const TypeInt* narrow_length_type = ary_type->narrow_size_type(length_type); | |
1049 if (narrow_length_type != length_type) { | |
1050 // Assert one of: | |
1051 // - the narrow_length is 0 | |
1052 // - the narrow_length is not wider than length | |
1053 assert(narrow_length_type == TypeInt::ZERO || | |
1054 (narrow_length_type->_hi <= length_type->_hi && | |
1055 narrow_length_type->_lo >= length_type->_lo), | |
1056 "narrow type must be narrower than length type"); | |
1057 | |
1058 // Return NULL if new nodes are not allowed | |
1059 if (!allow_new_nodes) return NULL; | |
1060 // Create a cast which is control dependent on the initialization to | |
1061 // propagate the fact that the array length must be positive. | |
1062 length = new (phase->C, 2) CastIINode(length, narrow_length_type); | |
1063 length->set_req(0, initialization()->proj_out(0)); | |
1064 } | |
1065 } | |
1066 | |
1067 return length; | |
1068 } | |
1069 | |
1037 //============================================================================= | 1070 //============================================================================= |
1038 uint LockNode::size_of() const { return sizeof(*this); } | 1071 uint LockNode::size_of() const { return sizeof(*this); } |
1039 | 1072 |
1040 // Redundant lock elimination | 1073 // Redundant lock elimination |
1041 // | 1074 // |