hotspot/src/share/vm/opto/stringopts.cpp
changeset 4891 7c8755dd5bb2
parent 4450 6d700b859b3e
child 5547 f4b087cbb361
equal deleted inserted replaced
4760:70aa3bc938c2 4891:7c8755dd5bb2
     1 /*
     1 /*
     2  * Copyright 2009 Sun Microsystems, Inc.  All Rights Reserved.
     2  * Copyright 2009-2010 Sun Microsystems, Inc.  All Rights Reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
  1071     Node *mem = PhiNode::make(head, kit.memory(char_adr_idx), Type::MEMORY, TypeAryPtr::CHARS);
  1071     Node *mem = PhiNode::make(head, kit.memory(char_adr_idx), Type::MEMORY, TypeAryPtr::CHARS);
  1072     kit.gvn().set_type(mem, Type::MEMORY);
  1072     kit.gvn().set_type(mem, Type::MEMORY);
  1073     kit.set_control(head);
  1073     kit.set_control(head);
  1074     kit.set_memory(mem, char_adr_idx);
  1074     kit.set_memory(mem, char_adr_idx);
  1075 
  1075 
  1076     Node* q = __ DivI(kit.null(), i_phi, __ intcon(10));
  1076     Node* q = __ DivI(NULL, i_phi, __ intcon(10));
  1077     Node* r = __ SubI(i_phi, __ AddI(__ LShiftI(q, __ intcon(3)),
  1077     Node* r = __ SubI(i_phi, __ AddI(__ LShiftI(q, __ intcon(3)),
  1078                                      __ LShiftI(q, __ intcon(1))));
  1078                                      __ LShiftI(q, __ intcon(1))));
  1079     Node* m1 = __ SubI(charPos, __ intcon(1));
  1079     Node* m1 = __ SubI(charPos, __ intcon(1));
  1080     Node* ch = __ AddI(r, __ intcon('0'));
  1080     Node* ch = __ AddI(r, __ intcon('0'));
  1081 
  1081 
  1268         } else if (!type->higher_equal(TypeInstPtr::NOTNULL)) {
  1268         } else if (!type->higher_equal(TypeInstPtr::NOTNULL)) {
  1269           // s = s != null ? s : "null";
  1269           // s = s != null ? s : "null";
  1270           // length = length + (s.count - s.offset);
  1270           // length = length + (s.count - s.offset);
  1271           RegionNode *r = new (C, 3) RegionNode(3);
  1271           RegionNode *r = new (C, 3) RegionNode(3);
  1272           kit.gvn().set_type(r, Type::CONTROL);
  1272           kit.gvn().set_type(r, Type::CONTROL);
  1273           Node *phi = new (C, 3) PhiNode(r, type->join(TypeInstPtr::NOTNULL));
  1273           Node *phi = new (C, 3) PhiNode(r, type);
  1274           kit.gvn().set_type(phi, phi->bottom_type());
  1274           kit.gvn().set_type(phi, phi->bottom_type());
  1275           Node* p = __ Bool(__ CmpP(arg, kit.null()), BoolTest::ne);
  1275           Node* p = __ Bool(__ CmpP(arg, kit.null()), BoolTest::ne);
  1276           IfNode* iff = kit.create_and_map_if(kit.control(), p, PROB_MIN, COUNT_UNKNOWN);
  1276           IfNode* iff = kit.create_and_map_if(kit.control(), p, PROB_MIN, COUNT_UNKNOWN);
  1277           Node* notnull = __ IfTrue(iff);
  1277           Node* notnull = __ IfTrue(iff);
  1278           Node* isnull =  __ IfFalse(iff);
  1278           Node* isnull =  __ IfFalse(iff);
       
  1279           kit.set_control(notnull); // set control for the cast_not_null
  1279           r->init_req(1, notnull);
  1280           r->init_req(1, notnull);
  1280           phi->init_req(1, arg);
  1281           phi->init_req(1, kit.cast_not_null(arg, false));
  1281           r->init_req(2, isnull);
  1282           r->init_req(2, isnull);
  1282           phi->init_req(2, null_string);
  1283           phi->init_req(2, null_string);
  1283           kit.set_control(r);
  1284           kit.set_control(r);
  1284           C->record_for_igvn(r);
  1285           C->record_for_igvn(r);
  1285           C->record_for_igvn(phi);
  1286           C->record_for_igvn(phi);