1894 assert(receiver != NULL && receiver->bottom_type()->isa_instptr() != NULL,
1895 "must have non-null instance type");
1896
1897 const TypeInstPtr *tinst = receiver->bottom_type()->isa_instptr();
1898 if (tinst != NULL && tinst->klass()->is_loaded() && !tinst->klass_is_exact()) {
1899 // The type isn't known exactly so see if CHA tells us anything.
1900 ciInstanceKlass* ik = tinst->klass()->as_instance_klass();
1901 if (!Dependencies::has_finalizable_subclass(ik)) {
1902 // No finalizable subclasses so skip the dynamic check.
1903 C->dependencies()->assert_has_no_finalizable_subclasses(ik);
1904 return;
1905 }
1906 }
1907
1908 // Insert a dynamic test for whether the instance needs
1909 // finalization. In general this will fold up since the concrete
1910 // class is often visible so the access flags are constant.
1911 Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
1912 Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) );
1913
1914 Node* access_flags_addr = basic_plus_adr(klass, klass, Klass::access_flags_offset_in_bytes() + sizeof(oopDesc));
1915 Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT);
1916
1917 Node* mask = _gvn.transform(new (C, 3) AndINode(access_flags, intcon(JVM_ACC_HAS_FINALIZER)));
1918 Node* check = _gvn.transform(new (C, 3) CmpINode(mask, intcon(0)));
1919 Node* test = _gvn.transform(new (C, 2) BoolNode(check, BoolTest::ne));
1920
1921 IfNode* iff = create_and_map_if(control(), test, PROB_MAX, COUNT_UNKNOWN);
1922
1923 RegionNode* result_rgn = new (C, 3) RegionNode(3);
1924 record_for_igvn(result_rgn);
1925
1926 Node *skip_register = _gvn.transform(new (C, 1) IfFalseNode(iff));
1927 result_rgn->init_req(1, skip_register);
1928
1929 Node *needs_register = _gvn.transform(new (C, 1) IfTrueNode(iff));
1930 set_control(needs_register);
1931 if (stopped()) {
1932 // There is no slow path.
1933 result_rgn->init_req(2, top());
1934 } else {
|
1894 assert(receiver != NULL && receiver->bottom_type()->isa_instptr() != NULL,
1895 "must have non-null instance type");
1896
1897 const TypeInstPtr *tinst = receiver->bottom_type()->isa_instptr();
1898 if (tinst != NULL && tinst->klass()->is_loaded() && !tinst->klass_is_exact()) {
1899 // The type isn't known exactly so see if CHA tells us anything.
1900 ciInstanceKlass* ik = tinst->klass()->as_instance_klass();
1901 if (!Dependencies::has_finalizable_subclass(ik)) {
1902 // No finalizable subclasses so skip the dynamic check.
1903 C->dependencies()->assert_has_no_finalizable_subclasses(ik);
1904 return;
1905 }
1906 }
1907
1908 // Insert a dynamic test for whether the instance needs
1909 // finalization. In general this will fold up since the concrete
1910 // class is often visible so the access flags are constant.
1911 Node* klass_addr = basic_plus_adr( receiver, receiver, oopDesc::klass_offset_in_bytes() );
1912 Node* klass = _gvn.transform( LoadKlassNode::make(_gvn, immutable_memory(), klass_addr, TypeInstPtr::KLASS) );
1913
1914 Node* access_flags_addr = basic_plus_adr(klass, klass, Klass::access_flags_offset_in_bytes());
1915 Node* access_flags = make_load(NULL, access_flags_addr, TypeInt::INT, T_INT);
1916
1917 Node* mask = _gvn.transform(new (C, 3) AndINode(access_flags, intcon(JVM_ACC_HAS_FINALIZER)));
1918 Node* check = _gvn.transform(new (C, 3) CmpINode(mask, intcon(0)));
1919 Node* test = _gvn.transform(new (C, 2) BoolNode(check, BoolTest::ne));
1920
1921 IfNode* iff = create_and_map_if(control(), test, PROB_MAX, COUNT_UNKNOWN);
1922
1923 RegionNode* result_rgn = new (C, 3) RegionNode(3);
1924 record_for_igvn(result_rgn);
1925
1926 Node *skip_register = _gvn.transform(new (C, 1) IfFalseNode(iff));
1927 result_rgn->init_req(1, skip_register);
1928
1929 Node *needs_register = _gvn.transform(new (C, 1) IfTrueNode(iff));
1930 set_control(needs_register);
1931 if (stopped()) {
1932 // There is no slow path.
1933 result_rgn->init_req(2, top());
1934 } else {
|