1108 // tmp - scratch register |
1108 // tmp - scratch register |
1109 // |
1109 // |
1110 // The input registers are overwritten. |
1110 // The input registers are overwritten. |
1111 // |
1111 // |
1112 void gen_write_ref_array_pre_barrier(Register addr, Register count) { |
1112 void gen_write_ref_array_pre_barrier(Register addr, Register count) { |
1113 #if 0 // G1 only |
|
1114 BarrierSet* bs = Universe::heap()->barrier_set(); |
1113 BarrierSet* bs = Universe::heap()->barrier_set(); |
1115 if (bs->has_write_ref_pre_barrier()) { |
1114 if (bs->has_write_ref_pre_barrier()) { |
1116 assert(bs->has_write_ref_array_pre_opt(), |
1115 assert(bs->has_write_ref_array_pre_opt(), |
1117 "Else unsupported barrier set."); |
1116 "Else unsupported barrier set."); |
1118 |
1117 |
1119 assert(addr->is_global() && count->is_global(), |
|
1120 "If not, then we have to fix this code to handle more " |
|
1121 "general cases."); |
|
1122 // Get some new fresh output registers. |
|
1123 __ save_frame(0); |
1118 __ save_frame(0); |
1124 // Save the necessary global regs... will be used after. |
1119 // Save the necessary global regs... will be used after. |
1125 __ mov(addr, L0); |
1120 if (addr->is_global()) { |
1126 __ mov(count, L1); |
1121 __ mov(addr, L0); |
1127 |
1122 } |
1128 __ mov(addr, O0); |
1123 if (count->is_global()) { |
|
1124 __ mov(count, L1); |
|
1125 } |
|
1126 __ mov(addr->after_save(), O0); |
1129 // Get the count into O1 |
1127 // Get the count into O1 |
1130 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)); |
1128 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_pre)); |
1131 __ delayed()->mov(count, O1); |
1129 __ delayed()->mov(count->after_save(), O1); |
1132 __ mov(L0, addr); |
1130 if (addr->is_global()) { |
1133 __ mov(L1, count); |
1131 __ mov(L0, addr); |
|
1132 } |
|
1133 if (count->is_global()) { |
|
1134 __ mov(L1, count); |
|
1135 } |
1134 __ restore(); |
1136 __ restore(); |
1135 } |
1137 } |
1136 #endif // 0 |
|
1137 } |
1138 } |
1138 // |
1139 // |
1139 // Generate post-write barrier for array. |
1140 // Generate post-write barrier for array. |
1140 // |
1141 // |
1141 // Input: |
1142 // Input: |
1148 void gen_write_ref_array_post_barrier(Register addr, Register count, |
1149 void gen_write_ref_array_post_barrier(Register addr, Register count, |
1149 Register tmp) { |
1150 Register tmp) { |
1150 BarrierSet* bs = Universe::heap()->barrier_set(); |
1151 BarrierSet* bs = Universe::heap()->barrier_set(); |
1151 |
1152 |
1152 switch (bs->kind()) { |
1153 switch (bs->kind()) { |
1153 #if 0 // G1 - only |
|
1154 case BarrierSet::G1SATBCT: |
1154 case BarrierSet::G1SATBCT: |
1155 case BarrierSet::G1SATBCTLogging: |
1155 case BarrierSet::G1SATBCTLogging: |
1156 { |
1156 { |
1157 assert(addr->is_global() && count->is_global(), |
|
1158 "If not, then we have to fix this code to handle more " |
|
1159 "general cases."); |
|
1160 // Get some new fresh output registers. |
1157 // Get some new fresh output registers. |
1161 __ save_frame(0); |
1158 __ save_frame(0); |
1162 __ mov(addr, O0); |
1159 __ mov(addr->after_save(), O0); |
1163 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); |
1160 __ call(CAST_FROM_FN_PTR(address, BarrierSet::static_write_ref_array_post)); |
1164 __ delayed()->mov(count, O1); |
1161 __ delayed()->mov(count->after_save(), O1); |
1165 __ restore(); |
1162 __ restore(); |
1166 } |
1163 } |
1167 break; |
1164 break; |
1168 #endif // 0 G1 - only |
|
1169 case BarrierSet::CardTableModRef: |
1165 case BarrierSet::CardTableModRef: |
1170 case BarrierSet::CardTableExtension: |
1166 case BarrierSet::CardTableExtension: |
1171 { |
1167 { |
1172 CardTableModRefBS* ct = (CardTableModRefBS*)bs; |
1168 CardTableModRefBS* ct = (CardTableModRefBS*)bs; |
1173 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); |
1169 assert(sizeof(*ct->byte_map_base) == sizeof(jbyte), "adjust this code"); |
2410 |
2406 |
2411 __ align(CodeEntryAlignment); |
2407 __ align(CodeEntryAlignment); |
2412 StubCodeMark mark(this, "StubRoutines", name); |
2408 StubCodeMark mark(this, "StubRoutines", name); |
2413 address start = __ pc(); |
2409 address start = __ pc(); |
2414 |
2410 |
2415 gen_write_ref_array_pre_barrier(G1, G5); |
2411 gen_write_ref_array_pre_barrier(O1, O2); |
2416 |
|
2417 |
2412 |
2418 #ifdef ASSERT |
2413 #ifdef ASSERT |
2419 // We sometimes save a frame (see partial_subtype_check below). |
2414 // We sometimes save a frame (see partial_subtype_check below). |
2420 // If this will cause trouble, let's fail now instead of later. |
2415 // If this will cause trouble, let's fail now instead of later. |
2421 __ save_frame(0); |
2416 __ save_frame(0); |