<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;">I see, yes, I goofed in those lines. I guess I was eager to explicate ArrayType and didn’t type-check the results….<div><br></div><div>R(Foo<int[]>) should be just ParamType[LFoo, _]. </div><div><br></div><div><br></div><div><div><div><div>On Feb 10, 2016, at 8:05 PM, Bjorn B Vardal <<a href="mailto:bjornvar@ca.ibm.com">bjornvar@ca.ibm.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div class="socmaildefaultfont" dir="ltr" style="font-family:Arial;font-size:10.5pt"><div dir="ltr">Thanks! That matches the behaviour I would expect.</div>
<div dir="ltr"> </div>
<div dir="ltr">The piece in the document that led me to the different understanding of point 3/4 was point 4 in the examples on page 4:</div>
<div dir="ltr"> R(Foo<int[]>) = ParameterizedType['L', "Foo", ArrayType[1, "I"]]</div>
<div dir="ltr"> </div>
<div dir="ltr">According to point 3 and 4 in your answer, this should be:</div>
<div dir="ltr"> R(Foo<int[]>) = ParameterizedType['L', "Foo", "_"]</div>
<div dir="ltr"> </div>
<div dir="ltr">And just to confirm, not the following:</div>
<div dir="ltr"> R(Foo<int[]>) = ParameterizedType['L', "Foo", ArrayType[1, "_"]]</div>
<div dir="ltr"> </div>
<div dir="ltr">--<br>Bjørn Vårdal</div>
<div dir="ltr"> </div>
<div dir="ltr"> </div>
<blockquote data-history-content-modified="1" dir="ltr" style="border-left:solid #aaaaaa 2px; margin-left:5px; padding-left:5px; direction:ltr; margin-right:0px">----- Original message -----<br>From: Brian Goetz <<a href="mailto:brian.goetz@oracle.com">brian.goetz@oracle.com</a>><br>To: Bjorn B Vardal/Ottawa/IBM@IBMCA<br>Cc: <a href="mailto:valhalla-spec-experts@openjdk.java.net">valhalla-spec-experts@openjdk.java.net</a><br>Subject: Re: Model 3 classfile design document<br>Date: Wed, Feb 10, 2016 11:51 AM<br> <br><!--Notes ACF
<meta http-equiv="Content-Type" content="text/html charset=utf8" >-->So, there’s two layers to this:
<div> - What can you express in the bytecode;</div>
<div> - What will javac emit</div>
<div> </div>
<div>We want the VM to be as dumb as possible with respect to parameterization and erasure. Therefore, we don’t ask the VM to reason about things like “ref types are erased”; the language compiler asks for either reification or erasure, and the VM happily complies. So ParamType[List, String] is a reified List<String>, and ParamType[List, erased] is an erased List. </div>
<div> </div>
<div>Javac will likely never emit reified generics over references, but other languages could. </div>
<div> </div>
<div>To your examples:</div>
<div> </div>
<div>1. Javac will emit ParamType[Foo, erased]</div>
<div>2. Javac will emit ParamType[Foo, int] (reified)</div>
<div>3. Javac will emit ParamType[Foo, erased] (since int[] is a reference type)</div>
<div>4. Javac will emit ParamType[Foo, erased] (same)</div>
<div> </div>
<div>Did I make a mistake in the doc that suggested otherwise for 3/4? Please correct me! </div>
<div>
<div><div>On Feb 10, 2016, at 3:50 PM, Bjorn B Vardal <<a href="mailto:bjornvar@ca.ibm.com" target="_blank">bjornvar@ca.ibm.com</a>> wrote:</div>
<blockquote type="cite"><div dir="ltr" style="font-family:Arial;font-size:10.5pt"><div dir="ltr"><div dir="ltr"><div dir="ltr">I have a question about reifying array types. This is what I understand is the proposed behaviour:</div>
<ol dir="ltr"> <li>Foo<String> - Reference, so erased</li> <li>Foo<int> - Primitive, so reified</li> <li>Foo<int[]> - In the Model 3 Classfile Design document, this is reified.</li> <li>Foo<String[]> - Unclear - erased as reference, or reified as array?</li></ol>
<div dir="ltr">The first two are quite clear, but I'm wondering about 3 and 4. What is the reason for reifying the int[] in the Model 3 document? Considering that both int[] and String are subclasses of Object, can we not erase array types? If we can't erase them, does that apply to reference arrays as well, e.g. String[]?</div></div></div>
<div dir="ltr" style="font-family:Arial;font-size:10.5pt"><div dir="ltr" style="margin-top: 20px;">--<br>Bjørn Vårdal</div></div>
<div dir="ltr"> </div>
<div dir="ltr"> </div>
<blockquote data-history-content-modified="1" dir="ltr" style="border-left:solid #aaaaaa 2px; margin-left:5px; padding-left:5px; direction:ltr; margin-right:0px">----- Original message -----<br>From: Brian Goetz <<a href="mailto:brian.goetz@oracle.com" target="_blank">brian.goetz@oracle.com</a>><br>Sent by: "valhalla-spec-experts" <<a href="mailto:valhalla-spec-experts-bounces@openjdk.java.net" target="_blank">valhalla-spec-experts-bounces@openjdk.java.net</a>><br>To: <a href="mailto:valhalla-spec-experts@openjdk.java.net" target="_blank">valhalla-spec-experts@openjdk.java.net</a><br>Cc:<br>Subject: Model 3 classfile design document<br>Date: Fri, Jan 22, 2016 11:53 AM<br>
<div><font face="Default Monospace,Courier New,Courier,monospace" size="2">Please find a document here:<br><br><a href="http://cr.openjdk.java.net/~briangoetz/valhalla/eg-attachments/model3-01.html" target="_blank">http://cr.openjdk.java.net/~briangoetz/valhalla/eg-attachments/model3-01.html</a><br><br>that describes our current thinking for evolving the classfile format to<br>clearly and efficiently represent parametric polymorphism. The early<br>concepts of this approach were outlined in my talk at JVMLS last year;<br>this represents a refinement of those ideas, and a reasonable "stake in<br>the ground" description of what seems the most sensible way to balance<br>preserving parametric information in the classfile without imposing<br>excessive runtime costs for loading specializations.<br><br>We're working on an updated compiler prototype which people will be able<br>to play with soon (along with a formal model.)<br><br>Please ask questions!<br><br>Some things this document does not address yet:<br> - How we deal with types implicit in the bytecodes (aload vs iload)<br>and how they get specialized;<br> - How we represent restricted methods in the classfile;<br> - How we represent the wildcard type Foo<any></font><br><br> </div></blockquote>
<div dir="ltr"> </div></div></blockquote></div></div></blockquote>
<div dir="ltr"> </div></div><br>
</blockquote></div><br></div></div></body></html>