src/share/vm/opto/idealKit.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File 8054033 Sdiff src/share/vm/opto

src/share/vm/opto/idealKit.cpp

Print this page


   1 /*
   2  * Copyright (c) 2005, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 303 
 304 //-----------------------------delay_transform-----------------------------------
 305 Node* IdealKit::delay_transform(Node* n) {
 306   // Delay transform until IterativeGVN
 307   gvn().set_type(n, n->bottom_type());
 308   C->record_for_igvn(n);
 309   return n;
 310 }
 311 
 312 //-----------------------------new_cvstate-----------------------------------
 313 Node* IdealKit::new_cvstate() {
 314   uint sz = _var_ct + first_var;
 315   return new Node(sz);
 316 }
 317 
 318 //-----------------------------copy_cvstate-----------------------------------
 319 Node* IdealKit::copy_cvstate() {
 320   Node* ns = new_cvstate();
 321   for (uint i = 0; i < ns->req(); i++) ns->init_req(i, _cvstate->in(i));
 322   // We must clone memory since it will be updated as we do stores.
 323   ns->set_req(TypeFunc::Memory, MergeMemNode::make(C, ns->in(TypeFunc::Memory)));
 324   return ns;
 325 }
 326 
 327 //-----------------------------clear-----------------------------------
 328 void IdealKit::clear(Node* m) {
 329   for (uint i = 0; i < m->req(); i++) m->set_req(i, NULL);
 330 }
 331 
 332 //-----------------------------IdealVariable----------------------------
 333 IdealVariable::IdealVariable(IdealKit &k) {
 334   k.declare(this);
 335 }
 336 
 337 Node* IdealKit::memory(uint alias_idx) {
 338   MergeMemNode* mem = merged_memory();
 339   Node* p = mem->memory_at(alias_idx);
 340   _gvn.set_type(p, Type::MEMORY);  // must be mapped
 341   return p;
 342 }
 343 
 344 void IdealKit::set_memory(Node* mem, uint alias_idx) {
 345   merged_memory()->set_memory_at(alias_idx, mem);
 346 }
 347 
 348 //----------------------------- make_load ----------------------------
 349 Node* IdealKit::load(Node* ctl,
 350                      Node* adr,
 351                      const Type* t,
 352                      BasicType bt,
 353                      int adr_idx,
 354                      bool require_atomic_access) {
 355 
 356   assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" );
 357   const TypePtr* adr_type = NULL; // debug-mode-only argument
 358   debug_only(adr_type = C->get_adr_type(adr_idx));
 359   Node* mem = memory(adr_idx);
 360   Node* ld;
 361   if (require_atomic_access && bt == T_LONG) {
 362     ld = LoadLNode::make_atomic(C, ctl, mem, adr, adr_type, t, MemNode::unordered);
 363   } else {
 364     ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, MemNode::unordered);
 365   }
 366   return transform(ld);
 367 }
 368 
 369 Node* IdealKit::store(Node* ctl, Node* adr, Node *val, BasicType bt,
 370                       int adr_idx,
 371                       MemNode::MemOrd mo, bool require_atomic_access) {
 372   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory");
 373   const TypePtr* adr_type = NULL;
 374   debug_only(adr_type = C->get_adr_type(adr_idx));
 375   Node *mem = memory(adr_idx);
 376   Node* st;
 377   if (require_atomic_access && bt == T_LONG) {
 378     st = StoreLNode::make_atomic(C, ctl, mem, adr, adr_type, val, mo);
 379   } else {
 380     st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt, mo);
 381   }
 382   st = transform(st);
 383   set_memory(st, adr_idx);
 384 
 385   return st;
 386 }
 387 
 388 // Card mark store. Must be ordered so that it will come after the store of
 389 // the oop.
 390 Node* IdealKit::storeCM(Node* ctl, Node* adr, Node *val, Node* oop_store, int oop_adr_idx,
 391                         BasicType bt,
 392                         int adr_idx) {
 393   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
 394   const TypePtr* adr_type = NULL;
 395   debug_only(adr_type = C->get_adr_type(adr_idx));
 396   Node *mem = memory(adr_idx);
 397 
 398   // Add required edge to oop_store, optimizer does not support precedence edges.


   1 /*
   2  * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   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
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *


 303 
 304 //-----------------------------delay_transform-----------------------------------
 305 Node* IdealKit::delay_transform(Node* n) {
 306   // Delay transform until IterativeGVN
 307   gvn().set_type(n, n->bottom_type());
 308   C->record_for_igvn(n);
 309   return n;
 310 }
 311 
 312 //-----------------------------new_cvstate-----------------------------------
 313 Node* IdealKit::new_cvstate() {
 314   uint sz = _var_ct + first_var;
 315   return new Node(sz);
 316 }
 317 
 318 //-----------------------------copy_cvstate-----------------------------------
 319 Node* IdealKit::copy_cvstate() {
 320   Node* ns = new_cvstate();
 321   for (uint i = 0; i < ns->req(); i++) ns->init_req(i, _cvstate->in(i));
 322   // We must clone memory since it will be updated as we do stores.
 323   ns->set_req(TypeFunc::Memory, MergeMemNode::make(ns->in(TypeFunc::Memory)));
 324   return ns;
 325 }
 326 
 327 //-----------------------------clear-----------------------------------
 328 void IdealKit::clear(Node* m) {
 329   for (uint i = 0; i < m->req(); i++) m->set_req(i, NULL);
 330 }
 331 
 332 //-----------------------------IdealVariable----------------------------
 333 IdealVariable::IdealVariable(IdealKit &k) {
 334   k.declare(this);
 335 }
 336 
 337 Node* IdealKit::memory(uint alias_idx) {
 338   MergeMemNode* mem = merged_memory();
 339   Node* p = mem->memory_at(alias_idx);
 340   _gvn.set_type(p, Type::MEMORY);  // must be mapped
 341   return p;
 342 }
 343 
 344 void IdealKit::set_memory(Node* mem, uint alias_idx) {
 345   merged_memory()->set_memory_at(alias_idx, mem);
 346 }
 347 
 348 //----------------------------- make_load ----------------------------
 349 Node* IdealKit::load(Node* ctl,
 350                      Node* adr,
 351                      const Type* t,
 352                      BasicType bt,
 353                      int adr_idx,
 354                      bool require_atomic_access) {
 355 
 356   assert(adr_idx != Compile::AliasIdxTop, "use other make_load factory" );
 357   const TypePtr* adr_type = NULL; // debug-mode-only argument
 358   debug_only(adr_type = C->get_adr_type(adr_idx));
 359   Node* mem = memory(adr_idx);
 360   Node* ld;
 361   if (require_atomic_access && bt == T_LONG) {
 362     ld = LoadLNode::make_atomic(ctl, mem, adr, adr_type, t, MemNode::unordered);
 363   } else {
 364     ld = LoadNode::make(_gvn, ctl, mem, adr, adr_type, t, bt, MemNode::unordered);
 365   }
 366   return transform(ld);
 367 }
 368 
 369 Node* IdealKit::store(Node* ctl, Node* adr, Node *val, BasicType bt,
 370                       int adr_idx,
 371                       MemNode::MemOrd mo, bool require_atomic_access) {
 372   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory");
 373   const TypePtr* adr_type = NULL;
 374   debug_only(adr_type = C->get_adr_type(adr_idx));
 375   Node *mem = memory(adr_idx);
 376   Node* st;
 377   if (require_atomic_access && bt == T_LONG) {
 378     st = StoreLNode::make_atomic(ctl, mem, adr, adr_type, val, mo);
 379   } else {
 380     st = StoreNode::make(_gvn, ctl, mem, adr, adr_type, val, bt, mo);
 381   }
 382   st = transform(st);
 383   set_memory(st, adr_idx);
 384 
 385   return st;
 386 }
 387 
 388 // Card mark store. Must be ordered so that it will come after the store of
 389 // the oop.
 390 Node* IdealKit::storeCM(Node* ctl, Node* adr, Node *val, Node* oop_store, int oop_adr_idx,
 391                         BasicType bt,
 392                         int adr_idx) {
 393   assert(adr_idx != Compile::AliasIdxTop, "use other store_to_memory factory" );
 394   const TypePtr* adr_type = NULL;
 395   debug_only(adr_type = C->get_adr_type(adr_idx));
 396   Node *mem = memory(adr_idx);
 397 
 398   // Add required edge to oop_store, optimizer does not support precedence edges.


src/share/vm/opto/idealKit.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File