< prev index next >

src/hotspot/share/c1/c1_CodeStubs.hpp

BarrierSetC1

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

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

514  public:                                                                                                                             
515   ArrayCopyStub(LIR_OpArrayCopy* op): _op(op) { }                                                                                    
516 
517   LIR_Opr src() const                         { return _op->src(); }                                                                 
518   LIR_Opr src_pos() const                     { return _op->src_pos(); }                                                             
519   LIR_Opr dst() const                         { return _op->dst(); }                                                                 
520   LIR_Opr dst_pos() const                     { return _op->dst_pos(); }                                                             
521   LIR_Opr length() const                      { return _op->length(); }                                                              
522   LIR_Opr tmp() const                         { return _op->tmp(); }                                                                 
523 
524   virtual void emit_code(LIR_Assembler* e);                                                                                          
525   virtual CodeEmitInfo* info() const          { return _op->info(); }                                                                
526   virtual void visit(LIR_OpVisitState* visitor) {                                                                                    
527     // don't pass in the code emit info since it's processed in the fast path                                                        
528     visitor->do_slow_case();                                                                                                         
529   }                                                                                                                                  
530 #ifndef PRODUCT                                                                                                                      
531   virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); }                                                  
532 #endif // PRODUCT                                                                                                                    
533 };                                                                                                                                   
534                                                                                                                                      
535 //////////////////////////////////////////////////////////////////////////////////////////                                           
536 #if INCLUDE_ALL_GCS                                                                                                                  
537                                                                                                                                      
538 // Code stubs for Garbage-First barriers.                                                                                            
539 class G1PreBarrierStub: public CodeStub {                                                                                            
540  private:                                                                                                                            
541   bool _do_load;                                                                                                                     
542   LIR_Opr _addr;                                                                                                                     
543   LIR_Opr _pre_val;                                                                                                                  
544   LIR_PatchCode _patch_code;                                                                                                         
545   CodeEmitInfo* _info;                                                                                                               
546                                                                                                                                      
547  public:                                                                                                                             
548   // Version that _does_ generate a load of the previous value from addr.                                                            
549   // addr (the address of the field to be read) must be a LIR_Address                                                                
550   // pre_val (a temporary register) must be a register;                                                                              
551   G1PreBarrierStub(LIR_Opr addr, LIR_Opr pre_val, LIR_PatchCode patch_code, CodeEmitInfo* info) :                                    
552     _addr(addr), _pre_val(pre_val), _do_load(true),                                                                                  
553     _patch_code(patch_code), _info(info)                                                                                             
554   {                                                                                                                                  
555     assert(_pre_val->is_register(), "should be temporary register");                                                                 
556     assert(_addr->is_address(), "should be the address of the field");                                                               
557   }                                                                                                                                  
558                                                                                                                                      
559   // Version that _does not_ generate load of the previous value; the                                                                
560   // previous value is assumed to have already been loaded into pre_val.                                                             
561   G1PreBarrierStub(LIR_Opr pre_val) :                                                                                                
562     _addr(LIR_OprFact::illegalOpr), _pre_val(pre_val), _do_load(false),                                                              
563     _patch_code(lir_patch_none), _info(NULL)                                                                                         
564   {                                                                                                                                  
565     assert(_pre_val->is_register(), "should be a register");                                                                         
566   }                                                                                                                                  
567                                                                                                                                      
568   LIR_Opr addr() const { return _addr; }                                                                                             
569   LIR_Opr pre_val() const { return _pre_val; }                                                                                       
570   LIR_PatchCode patch_code() const { return _patch_code; }                                                                           
571   CodeEmitInfo* info() const { return _info; }                                                                                       
572   bool do_load() const { return _do_load; }                                                                                          
573                                                                                                                                      
574   virtual void emit_code(LIR_Assembler* e);                                                                                          
575   virtual void visit(LIR_OpVisitState* visitor) {                                                                                    
576     if (_do_load) {                                                                                                                  
577       // don't pass in the code emit info since it's processed in the fast                                                           
578       // path                                                                                                                        
579       if (_info != NULL)                                                                                                             
580         visitor->do_slow_case(_info);                                                                                                
581       else                                                                                                                           
582         visitor->do_slow_case();                                                                                                     
583                                                                                                                                      
584       visitor->do_input(_addr);                                                                                                      
585       visitor->do_temp(_pre_val);                                                                                                    
586     } else {                                                                                                                         
587       visitor->do_slow_case();                                                                                                       
588       visitor->do_input(_pre_val);                                                                                                   
589     }                                                                                                                                
590   }                                                                                                                                  
591 #ifndef PRODUCT                                                                                                                      
592   virtual void print_name(outputStream* out) const { out->print("G1PreBarrierStub"); }                                               
593 #endif // PRODUCT                                                                                                                    
594 };                                                                                                                                   
595                                                                                                                                      
596 class G1PostBarrierStub: public CodeStub {                                                                                           
597  private:                                                                                                                            
598   LIR_Opr _addr;                                                                                                                     
599   LIR_Opr _new_val;                                                                                                                  
600                                                                                                                                      
601  public:                                                                                                                             
602   // addr (the address of the object head) and new_val must be registers.                                                            
603   G1PostBarrierStub(LIR_Opr addr, LIR_Opr new_val): _addr(addr), _new_val(new_val) { }                                               
604                                                                                                                                      
605   LIR_Opr addr() const { return _addr; }                                                                                             
606   LIR_Opr new_val() const { return _new_val; }                                                                                       
607                                                                                                                                      
608   virtual void emit_code(LIR_Assembler* e);                                                                                          
609   virtual void visit(LIR_OpVisitState* visitor) {                                                                                    
610     // don't pass in the code emit info since it's processed in the fast path                                                        
611     visitor->do_slow_case();                                                                                                         
612     visitor->do_input(_addr);                                                                                                        
613     visitor->do_input(_new_val);                                                                                                     
614   }                                                                                                                                  
615 #ifndef PRODUCT                                                                                                                      
616   virtual void print_name(outputStream* out) const { out->print("G1PostBarrierStub"); }                                              
617 #endif // PRODUCT                                                                                                                    
618 };                                                                                                                                   
619                                                                                                                                      
620 #endif // INCLUDE_ALL_GCS                                                                                                            
621 //////////////////////////////////////////////////////////////////////////////////////////                                           
622 
623 #endif // SHARE_VM_C1_C1_CODESTUBS_HPP                                                                                               

514  public:
515   ArrayCopyStub(LIR_OpArrayCopy* op): _op(op) { }
516 
517   LIR_Opr src() const                         { return _op->src(); }
518   LIR_Opr src_pos() const                     { return _op->src_pos(); }
519   LIR_Opr dst() const                         { return _op->dst(); }
520   LIR_Opr dst_pos() const                     { return _op->dst_pos(); }
521   LIR_Opr length() const                      { return _op->length(); }
522   LIR_Opr tmp() const                         { return _op->tmp(); }
523 
524   virtual void emit_code(LIR_Assembler* e);
525   virtual CodeEmitInfo* info() const          { return _op->info(); }
526   virtual void visit(LIR_OpVisitState* visitor) {
527     // don't pass in the code emit info since it's processed in the fast path
528     visitor->do_slow_case();
529   }
530 #ifndef PRODUCT
531   virtual void print_name(outputStream* out) const { out->print("ArrayCopyStub"); }
532 #endif // PRODUCT
533 };
























































































534 
535 #endif // SHARE_VM_C1_C1_CODESTUBS_HPP
< prev index next >