Mercurial > hg > graal-compiler
comparison src/share/vm/opto/node.cpp @ 6804:e626685e9f6c
7193318: C2: remove number of inputs requirement from Node's new operator
Summary: Deleted placement new operator of Node - node(size_t, Compile *, int).
Reviewed-by: kvn, twisti
Contributed-by: bharadwaj.yadavalli@oracle.com
author | kvn |
---|---|
date | Thu, 27 Sep 2012 09:38:42 -0700 |
parents | da91efe96a93 |
children | 2aff40cb4703 |
comparison
equal
deleted
inserted
replaced
6803:06f52c4d0e18 | 6804:e626685e9f6c |
---|---|
294 // Shared initialization code. | 294 // Shared initialization code. |
295 inline int Node::Init(int req, Compile* C) { | 295 inline int Node::Init(int req, Compile* C) { |
296 assert(Compile::current() == C, "must use operator new(Compile*)"); | 296 assert(Compile::current() == C, "must use operator new(Compile*)"); |
297 int idx = C->next_unique(); | 297 int idx = C->next_unique(); |
298 | 298 |
299 // Allocate memory for the necessary number of edges. | |
300 if (req > 0) { | |
301 // Allocate space for _in array to have double alignment. | |
302 _in = (Node **) ((char *) (C->node_arena()->Amalloc_D(req * sizeof(void*)))); | |
303 #ifdef ASSERT | |
304 _in[req-1] = this; // magic cookie for assertion check | |
305 #endif | |
306 } | |
299 // If there are default notes floating around, capture them: | 307 // If there are default notes floating around, capture them: |
300 Node_Notes* nn = C->default_node_notes(); | 308 Node_Notes* nn = C->default_node_notes(); |
301 if (nn != NULL) init_node_notes(C, idx, nn); | 309 if (nn != NULL) init_node_notes(C, idx, nn); |
302 | 310 |
303 // Note: At this point, C is dead, | 311 // Note: At this point, C is dead, |
1002 // Example: reshape "(X+3)+4" into "X+7": | 1010 // Example: reshape "(X+3)+4" into "X+7": |
1003 // set_req(1, in(1)->in(1)); | 1011 // set_req(1, in(1)->in(1)); |
1004 // set_req(2, phase->intcon(7)); | 1012 // set_req(2, phase->intcon(7)); |
1005 // return this; | 1013 // return this; |
1006 // Example: reshape "X*4" into "X<<2" | 1014 // Example: reshape "X*4" into "X<<2" |
1007 // return new (C,3) LShiftINode(in(1), phase->intcon(2)); | 1015 // return new (C) LShiftINode(in(1), phase->intcon(2)); |
1008 // | 1016 // |
1009 // You must call 'phase->transform(X)' on any new Nodes X you make, except | 1017 // You must call 'phase->transform(X)' on any new Nodes X you make, except |
1010 // for the returned root node. Example: reshape "X*31" with "(X<<5)-X". | 1018 // for the returned root node. Example: reshape "X*31" with "(X<<5)-X". |
1011 // Node *shift=phase->transform(new(C,3)LShiftINode(in(1),phase->intcon(5))); | 1019 // Node *shift=phase->transform(new(C)LShiftINode(in(1),phase->intcon(5))); |
1012 // return new (C,3) AddINode(shift, in(1)); | 1020 // return new (C) AddINode(shift, in(1)); |
1013 // | 1021 // |
1014 // When making a Node for a constant use 'phase->makecon' or 'phase->intcon'. | 1022 // When making a Node for a constant use 'phase->makecon' or 'phase->intcon'. |
1015 // These forms are faster than 'phase->transform(new (C,1) ConNode())' and Do | 1023 // These forms are faster than 'phase->transform(new (C) ConNode())' and Do |
1016 // The Right Thing with def-use info. | 1024 // The Right Thing with def-use info. |
1017 // | 1025 // |
1018 // You cannot bury the 'this' Node inside of a graph reshape. If the reshaped | 1026 // You cannot bury the 'this' Node inside of a graph reshape. If the reshaped |
1019 // graph uses the 'this' Node it must be the root. If you want a Node with | 1027 // graph uses the 'this' Node it must be the root. If you want a Node with |
1020 // the same Opcode as the 'this' pointer use 'clone'. | 1028 // the same Opcode as the 'this' pointer use 'clone'. |