< prev index next >

src/hotspot/cpu/x86/stubGenerator_x86_32.cpp

8199604_cardtablemodrefbs_rename

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.                                                                                                                        
21  *                                                                                                                                   
22  */                                                                                                                                  
23 
24 #include "precompiled.hpp"                                                                                                           
25 #include "asm/macroAssembler.hpp"                                                                                                    
26 #include "asm/macroAssembler.inline.hpp"                                                                                             
27 #include "gc/shared/cardTable.hpp"                                                                                                   
28 #include "gc/shared/cardTableModRefBS.hpp"                                                                                           
29 #include "interpreter/interpreter.hpp"                                                                                               
30 #include "nativeInst_x86.hpp"                                                                                                        
31 #include "oops/instanceOop.hpp"                                                                                                      
32 #include "oops/method.hpp"                                                                                                           
33 #include "oops/objArrayKlass.hpp"                                                                                                    
34 #include "oops/oop.inline.hpp"                                                                                                       
35 #include "prims/methodHandles.hpp"                                                                                                   
36 #include "runtime/frame.inline.hpp"                                                                                                  
37 #include "runtime/handles.inline.hpp"                                                                                                
38 #include "runtime/sharedRuntime.hpp"                                                                                                 
39 #include "runtime/stubCodeGenerator.hpp"                                                                                             
40 #include "runtime/stubRoutines.hpp"                                                                                                  
41 #include "runtime/thread.inline.hpp"                                                                                                 
42 #ifdef COMPILER2                                                                                                                     
43 #include "opto/runtime.hpp"                                                                                                          
44 #endif                                                                                                                               
45 
46 // Declaration and definition of StubGenerator (no .hpp file).                                                                       
47 // For a more detailed description of the stub routine structure                                                                     

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.
21  *
22  */
23 
24 #include "precompiled.hpp"
25 #include "asm/macroAssembler.hpp"
26 #include "asm/macroAssembler.inline.hpp"
27 #include "gc/shared/cardTable.hpp"
28 #include "gc/shared/cardTableBarrierSet.hpp"
29 #include "interpreter/interpreter.hpp"
30 #include "nativeInst_x86.hpp"
31 #include "oops/instanceOop.hpp"
32 #include "oops/method.hpp"
33 #include "oops/objArrayKlass.hpp"
34 #include "oops/oop.inline.hpp"
35 #include "prims/methodHandles.hpp"
36 #include "runtime/frame.inline.hpp"
37 #include "runtime/handles.inline.hpp"
38 #include "runtime/sharedRuntime.hpp"
39 #include "runtime/stubCodeGenerator.hpp"
40 #include "runtime/stubRoutines.hpp"
41 #include "runtime/thread.inline.hpp"
42 #ifdef COMPILER2
43 #include "opto/runtime.hpp"
44 #endif
45 
46 // Declaration and definition of StubGenerator (no .hpp file).
47 // For a more detailed description of the stub routine structure

689                                                SATBMarkQueue::byte_offset_of_active()));                                             
690           // Is marking active?                                                                                                      
691           if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {                                                                
692             __ cmpl(in_progress, 0);                                                                                                 
693           } else {                                                                                                                   
694             assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");                                              
695             __ cmpb(in_progress, 0);                                                                                                 
696           }                                                                                                                          
697           __ pop(thread);                                                                                                            
698           __ jcc(Assembler::equal, filtered);                                                                                        
699 
700            __ pusha();                      // push registers                                                                        
701            __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre),                                        
702                            start, count);                                                                                            
703            __ popa();                                                                                                                
704 
705            __ bind(filtered);                                                                                                        
706          }                                                                                                                           
707         break;                                                                                                                       
708 #endif // INCLUDE_ALL_GCS                                                                                                            
709       case BarrierSet::CardTableModRef:                                                                                              
710         break;                                                                                                                       
711       default      :                                                                                                                 
712         ShouldNotReachHere();                                                                                                        
713 
714     }                                                                                                                                
715   }                                                                                                                                  
716 
717 
718   //                                                                                                                                 
719   // Generate a post-barrier for an array store                                                                                      
720   //                                                                                                                                 
721   //     start    -  starting address                                                                                                
722   //     count    -  element count                                                                                                   
723   //                                                                                                                                 
724   //  The two input registers are overwritten.                                                                                       
725   //                                                                                                                                 
726   void  gen_write_ref_array_post_barrier(Register start, Register count) {                                                           
727     BarrierSet* bs = Universe::heap()->barrier_set();                                                                                
728     assert_different_registers(start, count);                                                                                        
729     switch (bs->kind()) {                                                                                                            
730 #if INCLUDE_ALL_GCS                                                                                                                  
731       case BarrierSet::G1BarrierSet:                                                                                                 
732         {                                                                                                                            
733           __ pusha();                      // push registers                                                                         
734           __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post),                                        
735                           start, count);                                                                                             
736           __ popa();                                                                                                                 
737         }                                                                                                                            
738         break;                                                                                                                       
739 #endif // INCLUDE_ALL_GCS                                                                                                            
740 
741       case BarrierSet::CardTableModRef:                                                                                              
742         {                                                                                                                            
743           CardTableModRefBS* ctbs = barrier_set_cast<CardTableModRefBS>(bs);                                                         
744           CardTable* ct = ctbs->card_table();                                                                                        
745           assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");                                                 
746 
747           Label L_loop;                                                                                                              
748           const Register end = count;  // elements count; end == start+count-1                                                       
749           assert_different_registers(start, end);                                                                                    
750 
751           __ lea(end,  Address(start, count, Address::times_ptr, -wordSize));                                                        
752           __ shrptr(start, CardTable::card_shift);                                                                                   
753           __ shrptr(end,   CardTable::card_shift);                                                                                   
754           __ subptr(end, start); // end --> count                                                                                    
755         __ BIND(L_loop);                                                                                                             
756         intptr_t disp = (intptr_t) ct->byte_map_base();                                                                              
757           Address cardtable(start, count, Address::times_1, disp);                                                                   
758           __ movb(cardtable, 0);                                                                                                     
759           __ decrement(count);                                                                                                       
760           __ jcc(Assembler::greaterEqual, L_loop);                                                                                   
761         }                                                                                                                            
762         break;                                                                                                                       

689                                                SATBMarkQueue::byte_offset_of_active()));
690           // Is marking active?
691           if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
692             __ cmpl(in_progress, 0);
693           } else {
694             assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
695             __ cmpb(in_progress, 0);
696           }
697           __ pop(thread);
698           __ jcc(Assembler::equal, filtered);
699 
700            __ pusha();                      // push registers
701            __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre),
702                            start, count);
703            __ popa();
704 
705            __ bind(filtered);
706          }
707         break;
708 #endif // INCLUDE_ALL_GCS
709       case BarrierSet::CardTableBarrierSet:
710         break;
711       default      :
712         ShouldNotReachHere();
713 
714     }
715   }
716 
717 
718   //
719   // Generate a post-barrier for an array store
720   //
721   //     start    -  starting address
722   //     count    -  element count
723   //
724   //  The two input registers are overwritten.
725   //
726   void  gen_write_ref_array_post_barrier(Register start, Register count) {
727     BarrierSet* bs = Universe::heap()->barrier_set();
728     assert_different_registers(start, count);
729     switch (bs->kind()) {
730 #if INCLUDE_ALL_GCS
731       case BarrierSet::G1BarrierSet:
732         {
733           __ pusha();                      // push registers
734           __ call_VM_leaf(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post),
735                           start, count);
736           __ popa();
737         }
738         break;
739 #endif // INCLUDE_ALL_GCS
740 
741       case BarrierSet::CardTableBarrierSet:
742         {
743           CardTableBarrierSet* ctbs = barrier_set_cast<CardTableBarrierSet>(bs);
744           CardTable* ct = ctbs->card_table();
745           assert(sizeof(*ct->byte_map_base()) == sizeof(jbyte), "adjust this code");
746 
747           Label L_loop;
748           const Register end = count;  // elements count; end == start+count-1
749           assert_different_registers(start, end);
750 
751           __ lea(end,  Address(start, count, Address::times_ptr, -wordSize));
752           __ shrptr(start, CardTable::card_shift);
753           __ shrptr(end,   CardTable::card_shift);
754           __ subptr(end, start); // end --> count
755         __ BIND(L_loop);
756         intptr_t disp = (intptr_t) ct->byte_map_base();
757           Address cardtable(start, count, Address::times_1, disp);
758           __ movb(cardtable, 0);
759           __ decrement(count);
760           __ jcc(Assembler::greaterEqual, L_loop);
761         }
762         break;
< prev index next >