src/share/vm/opto/node.hpp

changeset 3138
f6f3bb0ee072
parent 3051
11211f7cb5a0
child 3316
f03a3c8bd5e5
equal deleted inserted replaced
3137:e6b1331a51d2 3138:f6f3bb0ee072
1 /* 1 /*
2 * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 2 * Copyright (c) 1997, 2011, Oracle and/or its affiliates. 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.
182 // Control and data are uniformly represented in the graph. Finally, Nodes 182 // Control and data are uniformly represented in the graph. Finally, Nodes
183 // have a unique dense integer index which is used to index into side arrays 183 // have a unique dense integer index which is used to index into side arrays
184 // whenever I have phase-specific information. 184 // whenever I have phase-specific information.
185 185
186 class Node { 186 class Node {
187 friend class VMStructs;
188
187 // Lots of restrictions on cloning Nodes 189 // Lots of restrictions on cloning Nodes
188 Node(const Node&); // not defined; linker error to use these 190 Node(const Node&); // not defined; linker error to use these
189 Node &operator=(const Node &rhs); 191 Node &operator=(const Node &rhs);
190 192
191 public: 193 public:
1284 // Map dense integer indices to Nodes. Uses classic doubling-array trick. 1286 // Map dense integer indices to Nodes. Uses classic doubling-array trick.
1285 // Abstractly provides an infinite array of Node*'s, initialized to NULL. 1287 // Abstractly provides an infinite array of Node*'s, initialized to NULL.
1286 // Note that the constructor just zeros things, and since I use Arena 1288 // Note that the constructor just zeros things, and since I use Arena
1287 // allocation I do not need a destructor to reclaim storage. 1289 // allocation I do not need a destructor to reclaim storage.
1288 class Node_Array : public ResourceObj { 1290 class Node_Array : public ResourceObj {
1291 friend class VMStructs;
1289 protected: 1292 protected:
1290 Arena *_a; // Arena to allocate in 1293 Arena *_a; // Arena to allocate in
1291 uint _max; 1294 uint _max;
1292 Node **_nodes; 1295 Node **_nodes;
1293 void grow( uint i ); // Grow array node to fit 1296 void grow( uint i ); // Grow array node to fit
1314 uint Size() const { return _max; } 1317 uint Size() const { return _max; }
1315 void dump() const; 1318 void dump() const;
1316 }; 1319 };
1317 1320
1318 class Node_List : public Node_Array { 1321 class Node_List : public Node_Array {
1322 friend class VMStructs;
1319 uint _cnt; 1323 uint _cnt;
1320 public: 1324 public:
1321 Node_List() : Node_Array(Thread::current()->resource_area()), _cnt(0) {} 1325 Node_List() : Node_Array(Thread::current()->resource_area()), _cnt(0) {}
1322 Node_List(Arena *a) : Node_Array(a), _cnt(0) {} 1326 Node_List(Arena *a) : Node_Array(a), _cnt(0) {}
1323 bool contains(Node* n) { 1327 bool contains(Node* n) {
1337 void dump() const; 1341 void dump() const;
1338 }; 1342 };
1339 1343
1340 //------------------------------Unique_Node_List------------------------------- 1344 //------------------------------Unique_Node_List-------------------------------
1341 class Unique_Node_List : public Node_List { 1345 class Unique_Node_List : public Node_List {
1346 friend class VMStructs;
1342 VectorSet _in_worklist; 1347 VectorSet _in_worklist;
1343 uint _clock_index; // Index in list where to pop from next 1348 uint _clock_index; // Index in list where to pop from next
1344 public: 1349 public:
1345 Unique_Node_List() : Node_List(), _in_worklist(Thread::current()->resource_area()), _clock_index(0) {} 1350 Unique_Node_List() : Node_List(), _in_worklist(Thread::current()->resource_area()), _clock_index(0) {}
1346 Unique_Node_List(Arena *a) : Node_List(a), _in_worklist(a), _clock_index(0) {} 1351 Unique_Node_List(Arena *a) : Node_List(a), _in_worklist(a), _clock_index(0) {}
1387 _for_igvn->push(n); 1392 _for_igvn->push(n);
1388 } 1393 }
1389 1394
1390 //------------------------------Node_Stack------------------------------------- 1395 //------------------------------Node_Stack-------------------------------------
1391 class Node_Stack { 1396 class Node_Stack {
1397 friend class VMStructs;
1392 protected: 1398 protected:
1393 struct INode { 1399 struct INode {
1394 Node *node; // Processed node 1400 Node *node; // Processed node
1395 uint indx; // Index of next node's child 1401 uint indx; // Index of next node's child
1396 }; 1402 };
1459 1465
1460 //-----------------------------Node_Notes-------------------------------------- 1466 //-----------------------------Node_Notes--------------------------------------
1461 // Debugging or profiling annotations loosely and sparsely associated 1467 // Debugging or profiling annotations loosely and sparsely associated
1462 // with some nodes. See Compile::node_notes_at for the accessor. 1468 // with some nodes. See Compile::node_notes_at for the accessor.
1463 class Node_Notes VALUE_OBJ_CLASS_SPEC { 1469 class Node_Notes VALUE_OBJ_CLASS_SPEC {
1470 friend class VMStructs;
1464 JVMState* _jvms; 1471 JVMState* _jvms;
1465 1472
1466 public: 1473 public:
1467 Node_Notes(JVMState* jvms = NULL) { 1474 Node_Notes(JVMState* jvms = NULL) {
1468 _jvms = jvms; 1475 _jvms = jvms;

mercurial