src/share/vm/opto/memnode.cpp

changeset 8879
6bc9abf210fd
parent 8772
5c6e2c667464
child 9013
18366fa39fe0
equal deleted inserted replaced
8878:d3cc20285653 8879:6bc9abf210fd
1 /* 1 /*
2 * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 * 4 *
5 * This code is free software; you can redistribute it and/or modify it 5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as 6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. 7 * published by the Free Software Foundation.
51 const TypePtr *MemNode::adr_type() const { 51 const TypePtr *MemNode::adr_type() const {
52 Node* adr = in(Address); 52 Node* adr = in(Address);
53 const TypePtr* cross_check = NULL; 53 const TypePtr* cross_check = NULL;
54 DEBUG_ONLY(cross_check = _adr_type); 54 DEBUG_ONLY(cross_check = _adr_type);
55 return calculate_adr_type(adr->bottom_type(), cross_check); 55 return calculate_adr_type(adr->bottom_type(), cross_check);
56 }
57
58 bool MemNode::check_if_adr_maybe_raw(Node* adr) {
59 if (adr != NULL) {
60 if (adr->bottom_type()->base() == Type::RawPtr || adr->bottom_type()->base() == Type::AnyPtr) {
61 return true;
62 }
63 }
64 return false;
56 } 65 }
57 66
58 #ifndef PRODUCT 67 #ifndef PRODUCT
59 void MemNode::dump_spec(outputStream *st) const { 68 void MemNode::dump_spec(outputStream *st) const {
60 if (in(Address) == NULL) return; // node is dead 69 if (in(Address) == NULL) return; // node is dead
501 AllocateNode* alloc = AllocateNode::Ideal_allocation(base, phase); 510 AllocateNode* alloc = AllocateNode::Ideal_allocation(base, phase);
502 511
503 if (offset == Type::OffsetBot) 512 if (offset == Type::OffsetBot)
504 return NULL; // cannot unalias unless there are precise offsets 513 return NULL; // cannot unalias unless there are precise offsets
505 514
515 const bool adr_maybe_raw = check_if_adr_maybe_raw(adr);
506 const TypeOopPtr *addr_t = adr->bottom_type()->isa_oopptr(); 516 const TypeOopPtr *addr_t = adr->bottom_type()->isa_oopptr();
507 517
508 intptr_t size_in_bytes = memory_size(); 518 intptr_t size_in_bytes = memory_size();
509 519
510 Node* mem = in(MemNode::Memory); // start searching here... 520 Node* mem = in(MemNode::Memory); // start searching here...
517 Node* st_adr = mem->in(MemNode::Address); 527 Node* st_adr = mem->in(MemNode::Address);
518 intptr_t st_offset = 0; 528 intptr_t st_offset = 0;
519 Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset); 529 Node* st_base = AddPNode::Ideal_base_and_offset(st_adr, phase, st_offset);
520 if (st_base == NULL) 530 if (st_base == NULL)
521 break; // inscrutable pointer 531 break; // inscrutable pointer
532
533 // For raw accesses it's not enough to prove that constant offsets don't intersect.
534 // We need the bases to be the equal in order for the offset check to make sense.
535 if ((adr_maybe_raw || check_if_adr_maybe_raw(st_adr)) && st_base != base) {
536 break;
537 }
538
522 if (st_offset != offset && st_offset != Type::OffsetBot) { 539 if (st_offset != offset && st_offset != Type::OffsetBot) {
523 const int MAX_STORE = BytesPerLong; 540 const int MAX_STORE = BytesPerLong;
524 if (st_offset >= offset + size_in_bytes || 541 if (st_offset >= offset + size_in_bytes ||
525 st_offset <= offset - MAX_STORE || 542 st_offset <= offset - MAX_STORE ||
526 st_offset <= offset - mem->as_Store()->memory_size()) { 543 st_offset <= offset - mem->as_Store()->memory_size()) {

mercurial