4146 assert(n_adr_type != NULL, "new memory must have a well-defined adr_type");
4147 assert(C->must_alias(n_adr_type, alias_idx), "new memory must match selected slice");
4148 } else {
4149 // A few places like make_runtime_call "know" that VM calls are narrow,
4150 // and can be used to update only the VM bits stored as TypeRawPtr::BOTTOM.
4151 bool expected_wide_mem = false;
4152 if (n == m->base_memory()) {
4153 expected_wide_mem = true;
4154 } else if (alias_idx == Compile::AliasIdxRaw ||
4155 n == m->memory_at(Compile::AliasIdxRaw)) {
4156 expected_wide_mem = true;
4157 } else if (!C->alias_type(alias_idx)->is_rewritable()) {
4158 // memory can "leak through" calls on channels that
4159 // are write-once. Allow this also.
4160 expected_wide_mem = true;
4161 }
4162 assert(expected_wide_mem, "expected narrow slice replacement");
4163 }
4164 }
4165 #else // !ASSERT
4166 #define verify_memory_slice(m,i,n) (0) // PRODUCT version is no-op
4167 #endif
4168
4169
4170 //-----------------------------memory_at---------------------------------------
4171 Node* MergeMemNode::memory_at(uint alias_idx) const {
4172 assert(alias_idx >= Compile::AliasIdxRaw ||
4173 alias_idx == Compile::AliasIdxBot && Compile::current()->AliasLevel() == 0,
4174 "must avoid base_memory and AliasIdxTop");
4175
4176 // Otherwise, it is a narrow slice.
4177 Node* n = alias_idx < req() ? in(alias_idx) : empty_memory();
4178 Compile *C = Compile::current();
4179 if (is_empty_memory(n)) {
4180 // the array is sparse; empty slots are the "top" node
4181 n = base_memory();
4182 assert(Node::in_dump()
4183 || n == NULL || n->bottom_type() == Type::TOP
4184 || n->adr_type() == NULL // address is TOP
4185 || n->adr_type() == TypePtr::BOTTOM
4186 || n->adr_type() == TypeRawPtr::BOTTOM
|
4146 assert(n_adr_type != NULL, "new memory must have a well-defined adr_type");
4147 assert(C->must_alias(n_adr_type, alias_idx), "new memory must match selected slice");
4148 } else {
4149 // A few places like make_runtime_call "know" that VM calls are narrow,
4150 // and can be used to update only the VM bits stored as TypeRawPtr::BOTTOM.
4151 bool expected_wide_mem = false;
4152 if (n == m->base_memory()) {
4153 expected_wide_mem = true;
4154 } else if (alias_idx == Compile::AliasIdxRaw ||
4155 n == m->memory_at(Compile::AliasIdxRaw)) {
4156 expected_wide_mem = true;
4157 } else if (!C->alias_type(alias_idx)->is_rewritable()) {
4158 // memory can "leak through" calls on channels that
4159 // are write-once. Allow this also.
4160 expected_wide_mem = true;
4161 }
4162 assert(expected_wide_mem, "expected narrow slice replacement");
4163 }
4164 }
4165 #else // !ASSERT
4166 #define verify_memory_slice(m,i,n) (void)(0) // PRODUCT version is no-op
4167 #endif
4168
4169
4170 //-----------------------------memory_at---------------------------------------
4171 Node* MergeMemNode::memory_at(uint alias_idx) const {
4172 assert(alias_idx >= Compile::AliasIdxRaw ||
4173 alias_idx == Compile::AliasIdxBot && Compile::current()->AliasLevel() == 0,
4174 "must avoid base_memory and AliasIdxTop");
4175
4176 // Otherwise, it is a narrow slice.
4177 Node* n = alias_idx < req() ? in(alias_idx) : empty_memory();
4178 Compile *C = Compile::current();
4179 if (is_empty_memory(n)) {
4180 // the array is sparse; empty slots are the "top" node
4181 n = base_memory();
4182 assert(Node::in_dump()
4183 || n == NULL || n->bottom_type() == Type::TOP
4184 || n->adr_type() == NULL // address is TOP
4185 || n->adr_type() == TypePtr::BOTTOM
4186 || n->adr_type() == TypeRawPtr::BOTTOM
|