
Hello, As per my understanding following hold true about macroes for data nodes. CONSTR(e, s, ws): This is used to construct header for the data nodes which contain more than one constructors e.g List, Tree etc CONSTRW(s, e) and CONSTRP(s, e) : Are used to construct header for data nodes which contain single constructor e.g Pair. I just wrote a program : ---------------------------------- data MyPair a = ThisPair a a a selectThird (ThisPair 1 x y) = ThisPair 1 1 1 selectThird (ThisPair _ _ y) = ThisPair y y y ------------------------------------ When I saw the corresponding bytecode, I saw (To my surprize) CONSTR(0, 3, 0) being used to construct the data node in the function selectThird (i.e "ThisPair 1 1 1" etc). What is happening here ? If this is the case, then when exactly are the meaning of CONSTR() and CONSTRW(), CONSTRP() Regards, ------------------------------------ Arunkumar S Jadhav, Masters Student, KReSIT, IIT-Bombay, India Ph: +91-22-25764967 http://www.it.iitb.ac.in/~arunk ------------------------------------ I exist because I work.

Hello Arunkumar,
CONSTR(e, s, ws): This is used to construct header for the data nodes which contain more than one constructors e.g List, Tree etc
CONSTRW(s, e) and CONSTRP(s, e) : Are used to construct header for data nodes which contain single constructor e.g Pair.
No, that is not correct. CONSTR(c,s,ws) Construct a tag (i.e. a header for a data node) where there is a mixture of pointers and basic values amongst the data items: c = number of the constructor s = size = total number of data items in the node ws = number of data items which are pointers to other nodes The number of non-pointers is therefore (s - ws). The complete node has layout: | tag | pointers | non-pointers | CONSTRW(s,e) Construct a tag for a node containing a single basic data item (non-pointer), but it could be larger than a single word, e.g. Integer, Double. s = size = number of words occupied by the node e = extra information, a 2-bit flag used e.g. to indicate that a GMP Integer is negative. CONSTRP(s,e) Construct a tag for a value where there is a single constructor, and all the data items contained in it are pointers, e.g. Array. Used only by hand-written code - never generated by the compiler. s = size = number of pointers e = extra information, currently unused. I hope this helps, Malcolm
participants (2)
-
Arunkumar S Jadhav
-
Malcolm Wallace