Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-7193318

C2: remove number of inputs requirement from Node's new operator

XMLWordPrintable

    • b03
    • generic
    • generic

        Right now it is required to pass the number of inputs to the new operator when a new Node is allocated, e.g.:

          new (C, 4) AddPNode(base, ptr, offset);

        This is verbose, very unobvious (why pass 4 when the constructor only takes 3 inputs?) and error prone.

        Currently it is done this way because the new operator allocates memory for the Node and the inputs array in one chunk.

        We should investigate if it is possible to allocate the inputs array separately in the Node's constructors:

          // Create a new Node. Required is the number is of inputs required for
          // semantic correctness.
          Node( uint required );

          // Create a new Node with given input edges.
          // This version requires use of the "edge-count" new.
          // E.g. new (C,3) FooNode( C, NULL, left, right );
          Node( Node *n0 );
          Node( Node *n0, Node *n1 );
          Node( Node *n0, Node *n1, Node *n2 );
          Node( Node *n0, Node *n1, Node *n2, Node *n3 );
          Node( Node *n0, Node *n1, Node *n2, Node *n3, Node *n4 );
          Node( Node *n0, Node *n1, Node *n2, Node *n3, Node *n4, Node *n5 );
          Node( Node *n0, Node *n1, Node *n2, Node *n3,
                    Node *n4, Node *n5, Node *n6 );

        These constructors know what the size of the inputs array should be.

              twisti Christian Thalinger (Inactive)
              twisti Christian Thalinger (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: