You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the L_Array language, the abstract syntax includes (make-vector exp exp), where both arguments can be complex expressions. This would appear to include the case where the first exp happens to be a (read) invocation (or a Var bound to a read invocation).
When rewriting the expose_allocation pass for L_Array, the book suggests that we generate code for L_Array in a manner analogous to the case for L_Tup, which, among other things, generates a Collect node that accepts a plain integer (and not an Int AST node). In the case of L_Tup, the integer is always known at compile time, since in the compiler pass, we can simply count the entries passed into (vector entry-0 entry-1...), so it is fine to create a Collect AST node with that known length; however, for L_Array, if the specified length is a complex expression that cannot be known at compile time (such as a (read) invocation), then Collect in its present form does not seem appropriate. This is confusing to me, especially since it is stated in the text that AllocateArray takes a complex subexpression; possibly I am simply missing the right way to rewrite expose_allocation for L_Array.
The text was updated successfully, but these errors were encountered:
In the L_Array language, the abstract syntax includes
(make-vector exp exp)
, where both arguments can be complex expressions. This would appear to include the case where the firstexp
happens to be a(read)
invocation (or aVar
bound to aread
invocation).When rewriting the
expose_allocation
pass for L_Array, the book suggests that we generate code for L_Array in a manner analogous to the case for L_Tup, which, among other things, generates aCollect
node that accepts a plain integer (and not anInt
AST node). In the case of L_Tup, the integer is always known at compile time, since in the compiler pass, we can simply count the entries passed into(vector entry-0 entry-1...)
, so it is fine to create aCollect
AST node with that known length; however, for L_Array, if the specified length is a complex expression that cannot be known at compile time (such as a(read)
invocation), thenCollect
in its present form does not seem appropriate. This is confusing to me, especially since it is stated in the text thatAllocateArray
takes a complex subexpression; possibly I am simply missing the right way to rewriteexpose_allocation
for L_Array.The text was updated successfully, but these errors were encountered: