< prev index next >

src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp

Print this page
rev 55672 : 8227637: Adjust Shenandoah C2 verifier to recognize IN_NATIVE barriers


 191         assert(!in->in(AddPNode::Address)->is_top(), "no raw memory access");
 192         in = in->in(AddPNode::Address);
 193         continue;
 194       } else if (in->is_Con()) {
 195         if (trace) {
 196           tty->print("Found constant");
 197           in->dump();
 198         }
 199       } else if (in->Opcode() == Op_Parm) {
 200         if (trace) {
 201           tty->print("Found argument");
 202         }
 203       } else if (in->Opcode() == Op_CreateEx) {
 204         if (trace) {
 205           tty->print("Found create-exception");
 206         }
 207       } else if (in->Opcode() == Op_LoadP && in->adr_type() == TypeRawPtr::BOTTOM) {
 208         if (trace) {
 209           tty->print("Found raw LoadP (OSR argument?)");
 210         }
 211       } else if (in->Opcode() == Op_ShenandoahLoadReferenceBarrier) {



 212         if (t == ShenandoahOopStore) {
 213           uint i = 0;
 214           for (; i < phis.size(); i++) {
 215             Node* n = phis.node_at(i);
 216             if (n->Opcode() == Op_ShenandoahEnqueueBarrier) {
 217               break;
 218             }
 219           }
 220           if (i == phis.size()) {
 221             return false;
 222           }
 223         }
 224         barriers_used.push(in);
 225         if (trace) {tty->print("Found barrier"); in->dump();}
 226       } else if (in->Opcode() == Op_ShenandoahEnqueueBarrier) {
 227         if (t != ShenandoahOopStore) {
 228           in = in->in(1);
 229           continue;
 230         }
 231         if (trace) {tty->print("Found enqueue barrier"); in->dump();}


 510         Node* dest = NULL;
 511         const TypeTuple* args = n->as_Call()->_tf->domain();
 512         for (uint i = TypeFunc::Parms, j = 0; i < args->cnt(); i++) {
 513           if (args->field_at(i)->isa_ptr()) {
 514             j++;
 515             if (j == 2) {
 516               dest = n->in(i);
 517               break;
 518             }
 519           }
 520         }
 521         if (!verify_helper(n->in(TypeFunc::Parms), phis, visited, ShenandoahLoad, trace, barriers_used) ||
 522             !verify_helper(dest, phis, visited, ShenandoahStore, trace, barriers_used)) {
 523           report_verify_failure("Shenandoah verification: ArrayCopy should have barriers", n);
 524         }
 525       } else if (strlen(call->_name) > 5 &&
 526                  !strcmp(call->_name + strlen(call->_name) - 5, "_fill")) {
 527         if (!verify_helper(n->in(TypeFunc::Parms), phis, visited, ShenandoahStore, trace, barriers_used)) {
 528           report_verify_failure("Shenandoah verification: _fill should have barriers", n);
 529         }
 530       } else if (!strcmp(call->_name, "shenandoah_wb_pre")) {
 531         // skip
 532       } else {
 533         const int calls_len = sizeof(calls) / sizeof(calls[0]);
 534         int i = 0;
 535         for (; i < calls_len; i++) {
 536           if (!strcmp(calls[i].name, call->_name)) {
 537             break;
 538           }
 539         }
 540         if (i != calls_len) {
 541           const uint args_len = sizeof(calls[0].args) / sizeof(calls[0].args[0]);
 542           for (uint j = 0; j < args_len; j++) {
 543             int pos = calls[i].args[j].pos;
 544             if (pos == -1) {
 545               break;
 546             }
 547             if (!verify_helper(call->in(pos), phis, visited, calls[i].args[j].t, trace, barriers_used)) {
 548               report_verify_failure("Shenandoah verification: intrinsic calls should have barriers", n);
 549             }
 550           }




 191         assert(!in->in(AddPNode::Address)->is_top(), "no raw memory access");
 192         in = in->in(AddPNode::Address);
 193         continue;
 194       } else if (in->is_Con()) {
 195         if (trace) {
 196           tty->print("Found constant");
 197           in->dump();
 198         }
 199       } else if (in->Opcode() == Op_Parm) {
 200         if (trace) {
 201           tty->print("Found argument");
 202         }
 203       } else if (in->Opcode() == Op_CreateEx) {
 204         if (trace) {
 205           tty->print("Found create-exception");
 206         }
 207       } else if (in->Opcode() == Op_LoadP && in->adr_type() == TypeRawPtr::BOTTOM) {
 208         if (trace) {
 209           tty->print("Found raw LoadP (OSR argument?)");
 210         }
 211       } else if (in->Opcode() == Op_ShenandoahLoadReferenceBarrier ||
 212                  (in->Opcode() == Op_Proj &&
 213                   in->in(0)->Opcode() == Op_CallLeaf &&
 214                   strcmp(in->in(0)->as_Call()->_name, "ShenandoahRuntime::oop_load_from_native_barrier") == 0)) {
 215         if (t == ShenandoahOopStore) {
 216           uint i = 0;
 217           for (; i < phis.size(); i++) {
 218             Node* n = phis.node_at(i);
 219             if (n->Opcode() == Op_ShenandoahEnqueueBarrier) {
 220               break;
 221             }
 222           }
 223           if (i == phis.size()) {
 224             return false;
 225           }
 226         }
 227         barriers_used.push(in);
 228         if (trace) {tty->print("Found barrier"); in->dump();}
 229       } else if (in->Opcode() == Op_ShenandoahEnqueueBarrier) {
 230         if (t != ShenandoahOopStore) {
 231           in = in->in(1);
 232           continue;
 233         }
 234         if (trace) {tty->print("Found enqueue barrier"); in->dump();}


 513         Node* dest = NULL;
 514         const TypeTuple* args = n->as_Call()->_tf->domain();
 515         for (uint i = TypeFunc::Parms, j = 0; i < args->cnt(); i++) {
 516           if (args->field_at(i)->isa_ptr()) {
 517             j++;
 518             if (j == 2) {
 519               dest = n->in(i);
 520               break;
 521             }
 522           }
 523         }
 524         if (!verify_helper(n->in(TypeFunc::Parms), phis, visited, ShenandoahLoad, trace, barriers_used) ||
 525             !verify_helper(dest, phis, visited, ShenandoahStore, trace, barriers_used)) {
 526           report_verify_failure("Shenandoah verification: ArrayCopy should have barriers", n);
 527         }
 528       } else if (strlen(call->_name) > 5 &&
 529                  !strcmp(call->_name + strlen(call->_name) - 5, "_fill")) {
 530         if (!verify_helper(n->in(TypeFunc::Parms), phis, visited, ShenandoahStore, trace, barriers_used)) {
 531           report_verify_failure("Shenandoah verification: _fill should have barriers", n);
 532         }
 533       } else if (!strcmp(call->_name, "shenandoah_wb_pre") || !strcmp(call->_name, "ShenandoahRuntime::oop_load_from_native_barrier")) {
 534         // skip
 535       } else {
 536         const int calls_len = sizeof(calls) / sizeof(calls[0]);
 537         int i = 0;
 538         for (; i < calls_len; i++) {
 539           if (!strcmp(calls[i].name, call->_name)) {
 540             break;
 541           }
 542         }
 543         if (i != calls_len) {
 544           const uint args_len = sizeof(calls[0].args) / sizeof(calls[0].args[0]);
 545           for (uint j = 0; j < args_len; j++) {
 546             int pos = calls[i].args[j].pos;
 547             if (pos == -1) {
 548               break;
 549             }
 550             if (!verify_helper(call->in(pos), phis, visited, calls[i].args[j].t, trace, barriers_used)) {
 551               report_verify_failure("Shenandoah verification: intrinsic calls should have barriers", n);
 552             }
 553           }


< prev index next >