502 // further to JVM_ArrayCopy on the first per-oop check that fails.
503 // (Actually, we don't move raw bits only; the GC requires card marks.)
504
505 // Get the klass* for both src and dest
506 Node* src_klass = ac->in(ArrayCopyNode::SrcKlass);
507 Node* dest_klass = ac->in(ArrayCopyNode::DestKlass);
508
509 assert(src_klass != NULL && dest_klass != NULL, "should have klasses");
510
511 // Generate the subtype check.
512 // This might fold up statically, or then again it might not.
513 //
514 // Non-static example: Copying List<String>.elements to a new String[].
515 // The backing store for a List<String> is always an Object[],
516 // but its elements are always type String, if the generic types
517 // are correct at the source level.
518 //
519 // Test S[] against D[], not S against D, because (probably)
520 // the secondary supertype cache is less busy for S[] than S.
521 // This usually only matters when D is an interface.
522 Node* not_subtype_ctrl = ac->is_arraycopy_validated() ? top() :
523 Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
524 // Plug failing path into checked_oop_disjoint_arraycopy
525 if (not_subtype_ctrl != top()) {
526 Node* local_ctrl = not_subtype_ctrl;
527 MergeMemNode* local_mem = MergeMemNode::make(mem);
528 transform_later(local_mem);
529
530 // (At this point we can assume disjoint_bases, since types differ.)
531 int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
532 Node* p1 = basic_plus_adr(dest_klass, ek_offset);
533 Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
534 Node* dest_elem_klass = transform_later(n1);
535 Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
536 adr_type,
537 dest_elem_klass,
538 src, src_offset, dest, dest_offset,
539 ConvI2X(copy_length), dest_uninitialized);
540 if (cv == NULL) cv = intcon(-1); // failure (no stub available)
541 checked_control = local_ctrl;
542 checked_i_o = *io;
|
502 // further to JVM_ArrayCopy on the first per-oop check that fails.
503 // (Actually, we don't move raw bits only; the GC requires card marks.)
504
505 // Get the klass* for both src and dest
506 Node* src_klass = ac->in(ArrayCopyNode::SrcKlass);
507 Node* dest_klass = ac->in(ArrayCopyNode::DestKlass);
508
509 assert(src_klass != NULL && dest_klass != NULL, "should have klasses");
510
511 // Generate the subtype check.
512 // This might fold up statically, or then again it might not.
513 //
514 // Non-static example: Copying List<String>.elements to a new String[].
515 // The backing store for a List<String> is always an Object[],
516 // but its elements are always type String, if the generic types
517 // are correct at the source level.
518 //
519 // Test S[] against D[], not S against D, because (probably)
520 // the secondary supertype cache is less busy for S[] than S.
521 // This usually only matters when D is an interface.
522 Node* not_subtype_ctrl = (ac->is_arraycopy_validated() || ac->is_copyof_validated() || ac->is_copyofrange_validated()) ? top() :
523 Phase::gen_subtype_check(src_klass, dest_klass, ctrl, mem, &_igvn);
524 // Plug failing path into checked_oop_disjoint_arraycopy
525 if (not_subtype_ctrl != top()) {
526 Node* local_ctrl = not_subtype_ctrl;
527 MergeMemNode* local_mem = MergeMemNode::make(mem);
528 transform_later(local_mem);
529
530 // (At this point we can assume disjoint_bases, since types differ.)
531 int ek_offset = in_bytes(ObjArrayKlass::element_klass_offset());
532 Node* p1 = basic_plus_adr(dest_klass, ek_offset);
533 Node* n1 = LoadKlassNode::make(_igvn, NULL, C->immutable_memory(), p1, TypeRawPtr::BOTTOM);
534 Node* dest_elem_klass = transform_later(n1);
535 Node* cv = generate_checkcast_arraycopy(&local_ctrl, &local_mem,
536 adr_type,
537 dest_elem_klass,
538 src, src_offset, dest, dest_offset,
539 ConvI2X(copy_length), dest_uninitialized);
540 if (cv == NULL) cv = intcon(-1); // failure (no stub available)
541 checked_control = local_ctrl;
542 checked_i_o = *io;
|