<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<id>tag:www.nabble.com,2006:forum-14123</id>
	<title>Nabble - MLton</title>
	<updated>2008-10-11T05:47:49Z</updated>
	<link rel="self" type="application/atom+xml" href="http://www.nabble.com/MLton-f14123.xml" />
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-f14123.html" />
	<subtitle type="html">MLton is an open-source, whole-program, optimizing Standard ML compiler.</subtitle>
	
<entry>
	<id>tag:www.nabble.com,2006:post-19932329</id>
	<title>Re: How to access large amounts of data through FFI</title>
	<published>2008-10-11T05:47:49Z</published>
	<updated>2008-10-11T05:47:49Z</updated>
	<author>
		<name>Vesa Karvonen-2</name>
	</author>
	<content type="html">On Sat, Oct 11, 2008 at 7:49 AM, Ville Tuulos &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19932329&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tuulos@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;[...]
&lt;br&gt;&amp;gt; Actually when I got the Florian's reply about MLton.Pointer, I started
&lt;br&gt;&amp;gt; to consider writing something like RawVector which would support map,
&lt;br&gt;&amp;gt; foldl etc. over mmaped memory. Going through your code will be even
&lt;br&gt;&amp;gt; better exercise for me.
&lt;br&gt;&lt;br&gt;I extended my example somewhat. &amp;nbsp;The most significant change in the
&lt;br&gt;attached version is that it uses MLton's finalizers
&lt;br&gt;(&lt;a href=&quot;http://mlton.org/MLtonFinalizable&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/MLtonFinalizable&lt;/a&gt;) to munmap the mapped region
&lt;br&gt;automatically when the RawVector is garbage collected. &amp;nbsp;This can be
&lt;br&gt;convenient, but assuming that the mapped file is large, it is usually
&lt;br&gt;best to free (munmap) it explicitly (which is also supported), because
&lt;br&gt;it might take a long time before the finalizers are run. &amp;nbsp;The use of
&lt;br&gt;finalizers also adds some &amp;quot;access overhead&amp;quot; to the RawVector
&lt;br&gt;implementation and also has some other effects. &amp;nbsp;For something like
&lt;br&gt;the sub operation the access overhead may be significant. &amp;nbsp;Aggregate
&lt;br&gt;operations (foldl, find, app, ...) only incur the access overhead
&lt;br&gt;once.
&lt;br&gt;&lt;br&gt;Implementing map, i.e. a function of type ('a -&amp;gt; 'b) -&amp;gt; 'a t -&amp;gt; 'b &amp;nbsp;t,
&lt;br&gt;for something like RawVector is not entirely straightforward. &amp;nbsp;The
&lt;br&gt;main problem is that if one is using it to map very large files to
&lt;br&gt;memory, like suggested in your initial message, then creating a new
&lt;br&gt;RawVector by mapping a function over it is likely to be inefficient.
&lt;br&gt;Rather than use map, it is probably better to use &amp;quot;lower level&amp;quot;
&lt;br&gt;functions like foldl directly or use lazy sequence of some form. &amp;nbsp;One
&lt;br&gt;possibility would be to use &amp;quot;iterator combinators&amp;quot; or something
&lt;br&gt;similar that allows you to lazily map over the raw vector. &amp;nbsp;Iterator
&lt;br&gt;combinators are explained on the &lt;a href=&quot;http://mlton.org/ForLoops&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/ForLoops&lt;/a&gt;&amp;nbsp;page (note
&lt;br&gt;that RawVector.for is essentially an iterator function and can be used
&lt;br&gt;with iterator combinators) and there is a module implementing iterator
&lt;br&gt;combinators in the extended basis library
&lt;br&gt;(&lt;a href=&quot;http://mlton.org/cgi-bin/viewsvn.cgi/mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/iter.sig?view=auto&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/cgi-bin/viewsvn.cgi/mltonlib/trunk/com/ssh/extended-basis/unstable/public/control/iter.sig?view=auto&lt;/a&gt;).
&lt;br&gt;&lt;br&gt;-Vesa Karvonen
&lt;br&gt;&lt;br /&gt;&lt;tt&gt;[mmap.c]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;#include &amp;lt;fcntl.h&amp;gt;
&lt;br&gt;#include &amp;lt;sys/mman.h&amp;gt;
&lt;br&gt;#include &amp;lt;sys/stat.h&amp;gt;
&lt;br&gt;#include &amp;lt;sys/types.h&amp;gt;
&lt;br&gt;#include &amp;lt;unistd.h&amp;gt;
&lt;br&gt;&lt;br&gt;static inline size_t align(size_t granularity, size_t value) {
&lt;br&gt;&amp;nbsp; return value - value % granularity;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;void *map_file(const char *file, size_t granularity, size_t *size) {
&lt;br&gt;&amp;nbsp; int fd = open(file, O_RDONLY, S_IRUSR);
&lt;br&gt;&amp;nbsp; if (-1 == fd) goto open;
&lt;br&gt;&lt;br&gt;&amp;nbsp; struct stat stat;
&lt;br&gt;&amp;nbsp; if (-1 == fstat(fd, &amp;stat)) goto stat;
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (stat.st_size &amp;gt; (size_t)-1) goto size;
&lt;br&gt;&lt;br&gt;&amp;nbsp; size_t aligned_size = align(granularity, stat.st_size);
&lt;br&gt;&lt;br&gt;&amp;nbsp; void *ptr = mmap(0, aligned_size, PROT_READ, MAP_SHARED, fd, 0);
&lt;br&gt;&amp;nbsp; if ((void*)(-1) == ptr) goto mmap;
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (-1 == close(fd)) goto fclose;
&lt;br&gt;&lt;br&gt;&amp;nbsp; *size = aligned_size;
&lt;br&gt;&amp;nbsp; return ptr;
&lt;br&gt;&lt;br&gt;&amp;nbsp;fclose:
&lt;br&gt;&amp;nbsp; munmap(ptr, aligned_size);
&lt;br&gt;&amp;nbsp;mmap:
&lt;br&gt;&amp;nbsp;size:
&lt;br&gt;&amp;nbsp;stat:
&lt;br&gt;&amp;nbsp; close(fd);
&lt;br&gt;&amp;nbsp;open:
&lt;br&gt;&amp;nbsp; return 0;
&lt;br&gt;}
&lt;br&gt;&lt;br&gt;void unmap_file(void *addr, size_t bytes) {
&lt;br&gt;&amp;nbsp; if (addr)
&lt;br&gt;&amp;nbsp; &amp;nbsp; munmap(addr, bytes);
&lt;br&gt;}
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19932329&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;mmap.mlb&lt;/strong&gt; (312 bytes) &lt;a href=&quot;http://www.nabble.com/attachment/19932329/0/mmap.mlb&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;mmap.sml&lt;/strong&gt; (6K) &lt;a href=&quot;http://www.nabble.com/attachment/19932329/1/mmap.sml&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;Build.sh&lt;/strong&gt; (348 bytes) &lt;a href=&quot;http://www.nabble.com/attachment/19932329/2/Build.sh&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/How-to-access-large-amounts-of-data-through-FFI-tp19923661p19932329.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19929589</id>
	<title>Re: How to access large amounts of data through FFI</title>
	<published>2008-10-10T21:49:05Z</published>
	<updated>2008-10-10T21:49:05Z</updated>
	<author>
		<name>Ville Tuulos</name>
	</author>
	<content type="html">On Fri, Oct 10, 2008 at 4:06 PM, Vesa Karvonen &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19929589&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;vesa.a.j.k@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Fri, Oct 10, 2008 at 9:24 PM, Ville Tuulos &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19929589&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tuulos@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; How to construct and pass a valid int vector from C to SML through
&lt;br&gt;&amp;gt;&amp;gt; Mlton's FFI, preferably without copying the data first?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Unfortunately, you can't access a mmapped region of memory as an
&lt;br&gt;&amp;gt; ordinary SML vector, because ordinary SML vectors live in MLton's
&lt;br&gt;&amp;gt; garbage collected heap (and have a special header for MLton's runtime
&lt;br&gt;&amp;gt; and may be moved by MLton's GC).
&lt;br&gt;&lt;br&gt;ok. Good to know.
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; The FFI interface seems pretty straighforward but I couldn't find any
&lt;br&gt;&amp;gt;&amp;gt; documentation how arrays and vectors should be initialized based on a
&lt;br&gt;&amp;gt;&amp;gt; C pointer and size of the data. Or, if the int vector is not a good
&lt;br&gt;&amp;gt;&amp;gt; idea, what would be a better way to get access to the memory space?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Like suggested by Florian Weimer, likely the most efficient approach
&lt;br&gt;&amp;gt; is to access the data using MLton.Pointer.
&lt;br&gt;&lt;br&gt;ok. Thanks for the suggestion.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; The attached files contain an example of a way to do it. &amp;nbsp;The example
&lt;br&gt;&amp;gt; contains the beginnings of a RawVector module that allows one to mmap
&lt;br&gt;&amp;gt; a file and access it similarly to an ordinary vector. &amp;nbsp;As an example,
&lt;br&gt;&amp;gt; it opens a file (&amp;quot;data&amp;quot;), prints the length of the resulting RawVector
&lt;br&gt;&amp;gt; and then prints all the elements of the RawVector.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; For (my) convenience, the example makes (rather minimal) use of an
&lt;br&gt;&amp;gt; extended basis library from the &amp;quot;mltonlib&amp;quot; repository. &amp;nbsp;You can check
&lt;br&gt;&amp;gt; out the mltonlib repository with the following command:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp;svn co svn://mlton.org/mltonlib/trunk mltonlib
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; You'll then need to modify the Build.sh script to point to the
&lt;br&gt;&amp;gt; location of mltonlib in order to build the example with the script.
&lt;/div&gt;&lt;br&gt;Perfect! This is exactly what I need.
&lt;br&gt;&lt;br&gt;Actually when I got the Florian's reply about MLton.Pointer, I started
&lt;br&gt;to consider writing something like RawVector which would support map,
&lt;br&gt;foldl etc. over mmaped memory. Going through your code will be even
&lt;br&gt;better exercise for me.
&lt;br&gt;&lt;br&gt;&lt;br&gt;Thanks!
&lt;br&gt;&lt;br&gt;Ville
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19929589&amp;i=2&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/How-to-access-large-amounts-of-data-through-FFI-tp19923661p19929589.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19927414</id>
	<title>Re: How to access large amounts of data through FFI</title>
	<published>2008-10-10T16:06:40Z</published>
	<updated>2008-10-10T16:06:40Z</updated>
	<author>
		<name>Vesa Karvonen-2</name>
	</author>
	<content type="html">On Fri, Oct 10, 2008 at 9:24 PM, Ville Tuulos &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19927414&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;tuulos@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; I would like to access the data in Mlton without copying it first, due
&lt;br&gt;&amp;gt; to obvious performance reasons. The data itself is a flat array of
&lt;br&gt;&amp;gt; native 32-bit ints. Since it's an immutable array of native ints, I
&lt;br&gt;&amp;gt; was hoping that I could access it as an int vector (or something
&lt;br&gt;&amp;gt; similar) in Mlton.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; How to construct and pass a valid int vector from C to SML through
&lt;br&gt;&amp;gt; Mlton's FFI, preferably without copying the data first?
&lt;br&gt;&lt;br&gt;Unfortunately, you can't access a mmapped region of memory as an
&lt;br&gt;ordinary SML vector, because ordinary SML vectors live in MLton's
&lt;br&gt;garbage collected heap (and have a special header for MLton's runtime
&lt;br&gt;and may be moved by MLton's GC).
&lt;br&gt;&lt;br&gt;&amp;gt; The FFI interface seems pretty straighforward but I couldn't find any
&lt;br&gt;&amp;gt; documentation how arrays and vectors should be initialized based on a
&lt;br&gt;&amp;gt; C pointer and size of the data. Or, if the int vector is not a good
&lt;br&gt;&amp;gt; idea, what would be a better way to get access to the memory space?
&lt;br&gt;&lt;br&gt;Like suggested by Florian Weimer, likely the most efficient approach
&lt;br&gt;is to access the data using MLton.Pointer.
&lt;br&gt;&lt;br&gt;The attached files contain an example of a way to do it. &amp;nbsp;The example
&lt;br&gt;contains the beginnings of a RawVector module that allows one to mmap
&lt;br&gt;a file and access it similarly to an ordinary vector. &amp;nbsp;As an example,
&lt;br&gt;it opens a file (&amp;quot;data&amp;quot;), prints the length of the resulting RawVector
&lt;br&gt;and then prints all the elements of the RawVector.
&lt;br&gt;&lt;br&gt;For (my) convenience, the example makes (rather minimal) use of an
&lt;br&gt;extended basis library from the &amp;quot;mltonlib&amp;quot; repository. &amp;nbsp;You can check
&lt;br&gt;out the mltonlib repository with the following command:
&lt;br&gt;&lt;br&gt;&amp;nbsp; svn co svn://mlton.org/mltonlib/trunk mltonlib
&lt;br&gt;&lt;br&gt;You'll then need to modify the Build.sh script to point to the
&lt;br&gt;location of mltonlib in order to build the example with the script.
&lt;br&gt;&lt;br&gt;-Vesa Karvonen
&lt;br&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;&lt;tt&gt;[mmap.c]&lt;/tt&gt;&lt;br /&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;tt&gt;#include &amp;lt;fcntl.h&amp;gt;
&lt;br&gt;#include &amp;lt;sys/mman.h&amp;gt;
&lt;br&gt;#include &amp;lt;sys/stat.h&amp;gt;
&lt;br&gt;#include &amp;lt;sys/types.h&amp;gt;
&lt;br&gt;#include &amp;lt;unistd.h&amp;gt;
&lt;br&gt;&lt;br&gt;void *map_file(const char *file, size_t *size) {
&lt;br&gt;&amp;nbsp; int fd = open(file, O_RDONLY, S_IRUSR);
&lt;br&gt;&amp;nbsp; if (-1 == fd) goto open;
&lt;br&gt;&lt;br&gt;&amp;nbsp; struct stat stat;
&lt;br&gt;&amp;nbsp; if (-1 == fstat(fd, &amp;stat)) goto stat;
&lt;br&gt;&lt;br&gt;&amp;nbsp; void *ptr = mmap(0, stat.st_size, PROT_READ, MAP_SHARED, fd, 0);
&lt;br&gt;&amp;nbsp; if ((void*)(-1) == ptr) goto mmap;
&lt;br&gt;&lt;br&gt;&amp;nbsp; if (-1 == close(fd)) goto fclose;
&lt;br&gt;&lt;br&gt;&amp;nbsp; *size = stat.st_size;
&lt;br&gt;&amp;nbsp; return ptr;
&lt;br&gt;&lt;br&gt;&amp;nbsp;fclose:
&lt;br&gt;&amp;nbsp; munmap(ptr, stat.st_size);
&lt;br&gt;&amp;nbsp;mmap:
&lt;br&gt;&amp;nbsp;stat:
&lt;br&gt;&amp;nbsp; close(fd);
&lt;br&gt;&amp;nbsp;open:
&lt;br&gt;&amp;nbsp; return 0;
&lt;br&gt;}
&lt;br&gt;&lt;/tt&gt;&lt;hr align=&quot;left&quot; width=&quot;300&quot; /&gt;&lt;br /&gt; &lt;br /&gt; &lt;br /&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19927414&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;div class=&quot;small&quot;&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;Build.sh&lt;/strong&gt; (348 bytes) &lt;a href=&quot;http://www.nabble.com/attachment/19927414/0/Build.sh&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;data&lt;/strong&gt; (12 bytes) &lt;a href=&quot;http://www.nabble.com/attachment/19927414/1/data&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;mmap.mlb&lt;/strong&gt; (312 bytes) &lt;a href=&quot;http://www.nabble.com/attachment/19927414/2/mmap.mlb&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;br/&gt;&lt;img src=&quot;http://www.nabble.com/images/icon_attachment.gif&quot; &gt; &lt;strong&gt;mmap.sml&lt;/strong&gt; (3K) &lt;a href=&quot;http://www.nabble.com/attachment/19927414/3/mmap.sml&quot; target=&quot;_top&quot;&gt;Download Attachment&lt;/a&gt;&lt;/div&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/How-to-access-large-amounts-of-data-through-FFI-tp19923661p19927414.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19923741</id>
	<title>Re: How to access large amounts of data through FFI</title>
	<published>2008-10-10T11:36:24Z</published>
	<updated>2008-10-10T11:36:24Z</updated>
	<author>
		<name>Florian Weimer</name>
	</author>
	<content type="html">* Ville Tuulos:
&lt;br&gt;&lt;br&gt;&amp;gt; Or, if the int vector is not a good idea, what would be a better way
&lt;br&gt;&amp;gt; to get access to the memory space?
&lt;br&gt;&lt;br&gt;You probably should use MLton.Pointer: &amp;lt;&lt;a href=&quot;http://mlton.org/MLtonPointer&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/MLtonPointer&lt;/a&gt;&amp;gt;
&lt;br&gt;&lt;br&gt;Perhaps with a wrapper to add bounds checking.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19923741&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/How-to-access-large-amounts-of-data-through-FFI-tp19923661p19923741.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19923661</id>
	<title>How to access large amounts of data through FFI</title>
	<published>2008-10-10T11:24:09Z</published>
	<updated>2008-10-10T11:24:09Z</updated>
	<author>
		<name>Ville Tuulos</name>
	</author>
	<content type="html">Hi
&lt;br&gt;&lt;br&gt;I'm a total SML / Mlton newbie, so please excuse my ignorance.
&lt;br&gt;&lt;br&gt;I'm trying to find out if I could use Mlton to perform some data
&lt;br&gt;processing tasks that I used to do in C, or slowly in Python. I have
&lt;br&gt;large amounts (hundreds of megs to a gigabyte) of data memory mapped
&lt;br&gt;(using mmap) to my process' address space in C. The mapping is
&lt;br&gt;read-only.
&lt;br&gt;&lt;br&gt;I would like to access the data in Mlton without copying it first, due
&lt;br&gt;to obvious performance reasons. The data itself is a flat array of
&lt;br&gt;native 32-bit ints. Since it's an immutable array of native ints, I
&lt;br&gt;was hoping that I could access it as an int vector (or something
&lt;br&gt;similar) in Mlton.
&lt;br&gt;&lt;br&gt;How to construct and pass a valid int vector from C to SML through
&lt;br&gt;Mlton's FFI, preferably without copying the data first? The FFI
&lt;br&gt;interface seems pretty straighforward but I couldn't find any
&lt;br&gt;documentation how arrays and vectors should be initialized based on a
&lt;br&gt;C pointer and size of the data. Or, if the int vector is not a good
&lt;br&gt;idea, what would be a better way to get access to the memory space?
&lt;br&gt;&lt;br&gt;&lt;br&gt;Thank you,
&lt;br&gt;&lt;br&gt;Ville Tuulos
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19923661&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/How-to-access-large-amounts-of-data-through-FFI-tp19923661p19923661.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19911050</id>
	<title>Re: Code being dropped that shouldn't</title>
	<published>2008-10-09T20:00:13Z</published>
	<updated>2008-10-09T20:00:13Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Wed, 8 Oct 2008, Wesley W. Terpstra wrote:
&lt;br&gt;&amp;gt; I've been trying to track down the last bug in the library regression
&lt;br&gt;&amp;gt; test, but I think now it's not a bug in the test at all. Try an i386
&lt;br&gt;&amp;gt; compiler (windows and linux both show the same behaviour). Run:
&lt;br&gt;&amp;gt; ./library-test -debug true -keep g -codegen c -profile time
&lt;br&gt;...
&lt;br&gt;&amp;gt; I know there's some sort of basis-specific code
&lt;br&gt;&amp;gt; elimination. Is it possible that librarySuffix is getting hit by this?
&lt;br&gt;&lt;br&gt;No.
&lt;br&gt;&lt;br&gt;Turns out that it was a (long-standing) bug with 'MLton_callFromC' in 
&lt;br&gt;c-main.h. &amp;nbsp;In the library test, there is a point when the call-stack for 
&lt;br&gt;libm5 looks like:
&lt;br&gt;&amp;nbsp; &amp;nbsp;m5_open()
&lt;br&gt;&amp;nbsp; &amp;nbsp;libm5.sml (* top-level SML-code, via m5_open trampoline *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;libm5confirmC()
&lt;br&gt;&amp;nbsp; &amp;nbsp;libm5smlFn{Private,Public}() (* _export-ed from libm5.sml *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;MLton_callFromC()
&lt;br&gt;&amp;nbsp; &amp;nbsp;libm5.sml (* libm5smlFn{Private,Public}, via MLton_callFromC trampoline *)
&lt;br&gt;&lt;br&gt;The _export-ed 'libm5smlFn{Private,Public}' functions terminate the 
&lt;br&gt;'MLton_callFromC' trampoline by setting the global 'returnToC' to 'TRUE'. 
&lt;br&gt;This returns to the top-level SML-code from libm5.sml, executed via the 
&lt;br&gt;'m5_open' trampoline. &amp;nbsp;However, the 'returnToC' global is set to 'TRUE', 
&lt;br&gt;so the trampoline terminates at the first inter-chunk transfer, without 
&lt;br&gt;completing the top-level SML-code from libm5.sml; in particular, it 
&lt;br&gt;doesn't execute to the 'suffixArchiveOrLibrary' and doesn't suspend the ML 
&lt;br&gt;stack at the point just before the 'clean atExit'. &amp;nbsp;Rather, it suspends 
&lt;br&gt;the ML stack much earlier in the execution, and when the top-level C-code 
&lt;br&gt;(as executed by check.sml) executes 'm5_close', it starts a new trampoline 
&lt;br&gt;(setting 'returnToC' to 'FALSE') and resumes the ML code somewhere shortly 
&lt;br&gt;after the call to 'libm5confirmC()', at which point it executes to the 
&lt;br&gt;first 'Primitive.MLton.Thread.returnToC' in 'suffixArchiveOrLibrary', 
&lt;br&gt;returns to 'm5_close'. &amp;nbsp;That explains why the 'clean atExit' never 
&lt;br&gt;executed.
&lt;br&gt;&lt;br&gt;The reasons that this erroneous behavior doesn't occur with all of the 
&lt;br&gt;C-codegen library tests is that it depends upon how the program is 
&lt;br&gt;chunkify-ed. &amp;nbsp;This is simply the coarse grouping of RSSA IL functions into 
&lt;br&gt;larger 'chunks' to create larger/fewer .c files. &amp;nbsp;However, it is a 
&lt;br&gt;sized-based grouping, so small changes to the RSSA IL (such as the extra 
&lt;br&gt;code inserted for time profiling) can change the grouping and cause an 
&lt;br&gt;inter-chunk transfer to manifest the bug. &amp;nbsp;One can cause the bug to 
&lt;br&gt;manifest in the other C-codegen tests by compiling with '-chunkify func', 
&lt;br&gt;which uses the finest chunking (increasing the number of inter-chunk 
&lt;br&gt;transfers).
&lt;br&gt;&lt;br&gt;The fix is trivial; set 'returnToC' to 'FALSE' after completing a 
&lt;br&gt;'MLton_callFromC' trampoline:
&lt;br&gt;&lt;br&gt;Modified: mlton/trunk/include/c-main.h
&lt;br&gt;===================================================================
&lt;br&gt;--- mlton/trunk/include/c-main.h &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2008-10-09 21:35:20 UTC (rev 6918)
&lt;br&gt;+++ mlton/trunk/include/c-main.h &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;2008-10-10 02:22:13 UTC (rev 6919)
&lt;br&gt;@@ -39,6 +39,7 @@
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; do { &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; cont=(*(struct cont(*)(void))cont.nextChunk)(); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; \
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; } while (not returnToC); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\
&lt;br&gt;+ &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;returnToC = FALSE; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s-&amp;gt;atomicState += 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; GC_switchToThread (s, GC_getSavedThread (s), 0); &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; s-&amp;gt;atomicState -= 1; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;\
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19911050&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Code-being-dropped-that-shouldn%27t-tp19878701p19911050.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19878701</id>
	<title>Code being dropped that shouldn't</title>
	<published>2008-10-08T06:26:43Z</published>
	<updated>2008-10-08T06:26:43Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">I've been trying to track down the last bug in the library regression
&lt;br&gt;test, but I think now it's not a bug in the test at all. Try an i386
&lt;br&gt;compiler (windows and linux both show the same behaviour). Run:
&lt;br&gt;./library-test -debug true -keep g -codegen c -profile time
&lt;br&gt;&lt;br&gt;Expected (wrong) output:
&lt;br&gt;check starting up
&lt;br&gt;libm5 starting up
&lt;br&gt;libm4 starting up
&lt;br&gt;libm3 starting up
&lt;br&gt;libm2 starting up
&lt;br&gt;libm1 starting up
&lt;br&gt;m1 pointer test complete.
&lt;br&gt;m2 pointer test complete.
&lt;br&gt;m3 pointer test complete.
&lt;br&gt;m4 pointer test complete.
&lt;br&gt;m5 pointer test complete.
&lt;br&gt;check pointer test complete.
&lt;br&gt;check exits
&lt;br&gt;profiling is on
&lt;br&gt;profiling is on
&lt;br&gt;profiling is on
&lt;br&gt;profiling is on
&lt;br&gt;profiling is on
&lt;br&gt;&lt;br&gt;The problem is that the atExit code for libm1-5 doesn't get run.
&lt;br&gt;However, just adding a print statement to mlton/exit.sml:60:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(* Return to 'lib_open'. *)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;val () = Primitive.MLton.Thread.returnToC ()
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(* Enter from 'lib_close'. *)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;val () = print &amp;quot;lib_close invoked\n&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;val _ = exiting := true
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;val () = let open Cleaner in clean atExit end
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(* Return to 'lib_close'. *)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;val () = Primitive.MLton.Thread.returnToC ()
&lt;br&gt;... changes the output to
&lt;br&gt;check starting up
&lt;br&gt;libm5 starting up
&lt;br&gt;libm4 starting up
&lt;br&gt;libm3 starting up
&lt;br&gt;libm2 starting up
&lt;br&gt;libm1 starting up
&lt;br&gt;m1 pointer test complete.
&lt;br&gt;m2 pointer test complete.
&lt;br&gt;m3 pointer test complete.
&lt;br&gt;m4 pointer test complete.
&lt;br&gt;m5 pointer test complete.
&lt;br&gt;check pointer test complete.
&lt;br&gt;lib_close invoked
&lt;br&gt;lib_close invoked
&lt;br&gt;lib_close invoked
&lt;br&gt;lib_close invoked
&lt;br&gt;lib_close invoked
&lt;br&gt;libm1 exits
&lt;br&gt;libm2 exits
&lt;br&gt;libm3 exits
&lt;br&gt;libm4 exits
&lt;br&gt;libm5 exits
&lt;br&gt;check exits
&lt;br&gt;&lt;br&gt;So it seems that the library suffix doesn't get run until the print
&lt;br&gt;statement is added. Tracing the execution of m5_close with gdb
&lt;br&gt;confirms this. I know there's some sort of basis-specific code
&lt;br&gt;elimination. Is it possible that librarySuffix is getting hit by this?
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19878701&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Code-being-dropped-that-shouldn%27t-tp19878701p19878701.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19849377</id>
	<title>DAMP 2009: Final Call For Papers</title>
	<published>2008-10-06T18:11:42Z</published>
	<updated>2008-10-06T18:11:42Z</updated>
	<author>
		<name>Petersen, Leaf</name>
	</author>
	<content type="html">[Note the revised full paper submission date.]
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; CALL FOR PAPERS
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DAMP 2009: Workshop on
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Declarative Aspects of Multicore Programming
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Savannah, GA, USA
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;(co-located with POPL 2009)
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; January 20, 2009
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ABSTRACT SUBMISSION DEADLINE: OCTOBER 10
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.cse.unsw.edu.au/~pls/damp09/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cse.unsw.edu.au/~pls/damp09/&lt;/a&gt;&lt;br&gt;&lt;br&gt;Important Dates:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Deadline for abstract submission: October 10, 2008
&lt;br&gt;&amp;nbsp; &amp;nbsp;Deadline for full paper submission: October 14, 2008
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Notification of acceptance: November 10, 2008
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Final papers due: November 17, 2008
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DAMP 2009: January 20, 2009
&lt;br&gt;&lt;br&gt;&lt;br&gt;DAMP 2009 is the fourth in a series of one-day workshops seeking to
&lt;br&gt;explore ideas in programming language design that will greatly
&lt;br&gt;simplify programming for multicore architectures, and more generally
&lt;br&gt;for tightly coupled parallel architectures. DAMP 2009 is co-located
&lt;br&gt;with the ACM SIGPLAN - SIGACT Symposium on Principles of Programming
&lt;br&gt;Languages (POPL 2009).
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Scope
&lt;br&gt;&lt;br&gt;The emphasis will be on functional and (constraint-)logic programming,
&lt;br&gt;but any programming language ideas that aim to raise the level of
&lt;br&gt;abstraction are welcome. DAMP seeks to gather together researchers in
&lt;br&gt;declarative approaches to parallel programming and to foster cross
&lt;br&gt;fertilization across different approaches.
&lt;br&gt;&lt;br&gt;Specific topics include, but are not limited to:
&lt;br&gt;&lt;br&gt;* suitability &amp;nbsp; of &amp;nbsp;functional &amp;nbsp; and &amp;nbsp; (constraint-)logic &amp;nbsp;programming
&lt;br&gt;&amp;nbsp; languages to multicore applications;
&lt;br&gt;* run-time issues such as garbage collection or thread scheduling;
&lt;br&gt;* architectural features that may &amp;nbsp;enhance the parallel performance of
&lt;br&gt;&amp;nbsp; declarative languages;
&lt;br&gt;* type &amp;nbsp;systems &amp;nbsp;and &amp;nbsp;analysis &amp;nbsp;for &amp;nbsp;accurately &amp;nbsp;knowing &amp;nbsp;or &amp;nbsp;limiting
&lt;br&gt;&amp;nbsp; dependencies, aliasing, effects, and nonpure features;
&lt;br&gt;* ways of specifying or hinting at parallelism;
&lt;br&gt;* ways of specifying or hinting &amp;nbsp;at data placement which abstract away
&lt;br&gt;&amp;nbsp; from any details of the machine;
&lt;br&gt;* compiler &amp;nbsp; &amp;nbsp;techniques, &amp;nbsp; &amp;nbsp;automatic &amp;nbsp; parallelization, &amp;nbsp; &amp;nbsp;automatic
&lt;br&gt;&amp;nbsp; granularity control;
&lt;br&gt;* experiences &amp;nbsp;of &amp;nbsp;and &amp;nbsp;challenges &amp;nbsp;arising &amp;nbsp;from &amp;nbsp;making &amp;nbsp;declarative
&lt;br&gt;&amp;nbsp; programming practical;
&lt;br&gt;* technology for debugging parallel programs;
&lt;br&gt;* design and &amp;nbsp;implementation of domain-specific &amp;nbsp;declarative languages
&lt;br&gt;&amp;nbsp; for multi-core;
&lt;br&gt;&lt;br&gt;Accepted papers will be published in the ACM Digital Library and in a
&lt;br&gt;physical proceedings. &amp;nbsp;Papers must adhere to the SIGPLAN Republication
&lt;br&gt;Policy:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.sigplan.org/republicationpolicy.htm&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.sigplan.org/republicationpolicy.htm&lt;/a&gt;&lt;br&gt;&lt;br&gt;Concurrent submissions to other conferences, workshops, journals, or
&lt;br&gt;similar forums of publication are not allowed. However, DAMP is
&lt;br&gt;intended to be a venue for discussion and exploration of
&lt;br&gt;works-in-progress, and so publication of a paper at DAMP 2009 is not
&lt;br&gt;intended to preclude later publication as appropriate.
&lt;br&gt;&lt;br&gt;Submission Details:
&lt;br&gt;&lt;br&gt;Authors should submit an abstract of at most 300 words and a full
&lt;br&gt;paper of no more than 10 pages (including bibliography and appendices)
&lt;br&gt;in the ACM SIGPLAN conference format. Further details are on the
&lt;br&gt;workshop web page:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://www.cse.unsw.edu.au/~pls/damp09/submission.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cse.unsw.edu.au/~pls/damp09/submission.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;Program Chair:
&lt;br&gt;&amp;nbsp; Manuel Chakravarty &amp;nbsp; University of New South Wales
&lt;br&gt;&lt;br&gt;Program Committee:
&lt;br&gt;&amp;nbsp; Guy Blelloch &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Carnegie Mellon University
&lt;br&gt;&amp;nbsp; Manuel Carro &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Universidad Politécnica de Madrid
&lt;br&gt;&amp;nbsp; Koen Claessen &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Chalmers University of Technology
&lt;br&gt;&amp;nbsp; Matthew Fluet &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Toyota Technological Institute at Chicago
&lt;br&gt;&amp;nbsp; Vivek Sarkar &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Rice University
&lt;br&gt;&amp;nbsp; Sven-Bodo Scholz &amp;nbsp; &amp;nbsp; University of Hertfordshire
&lt;br&gt;&amp;nbsp; Satnam Singh &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Microsoft Research, Cambridge
&lt;br&gt;&amp;nbsp; Martin Sulzmann &amp;nbsp; &amp;nbsp; &amp;nbsp;IT University of Copenhagen
&lt;br&gt;&amp;nbsp; Don Syme &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Microsoft Research, Cambridge
&lt;br&gt;&amp;nbsp; Phil Trinder &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Heriot-Watt University
&lt;br&gt;&lt;br&gt;General Chair:
&lt;br&gt;&amp;nbsp; Leaf Petersen &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Intel Corporation
&lt;br&gt;&lt;br&gt;Past DAMPs:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.cliplab.org/Conferences/DAMP08&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cliplab.org/Conferences/DAMP08&lt;/a&gt;&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://glew.org/damp2006&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://glew.org/damp2006&lt;/a&gt;&lt;br&gt;&amp;nbsp; &lt;a href=&quot;http://www.cs.cmu.edu/~damp&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.cs.cmu.edu/~damp&lt;/a&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19849377&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/DAMP-2009%3A-Final-Call-For-Papers-tp19849377p19849377.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19818909</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-04T16:05:15Z</published>
	<updated>2008-10-04T16:05:15Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Sun, Oct 5, 2008 at 12:02 AM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19818909&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&lt;br&gt;&amp;gt; That seems like a reasonable rationale. &amp;nbsp;If I understand things correctly,
&lt;br&gt;&amp;gt; though, one advantage of the
&lt;br&gt;&amp;gt; &amp;nbsp;#include &amp;quot;xyz.h&amp;quot;
&lt;br&gt;&amp;gt; &amp;nbsp;#include &amp;quot;xyz-private.h&amp;quot;
&lt;br&gt;&amp;gt; approach is that is textually separates the public (in the sense of the
&lt;br&gt;&amp;gt; documented portions of the library API available for use in other projects)
&lt;br&gt;&amp;gt; functions from the private (in the sense of the undocumented portions of the
&lt;br&gt;&amp;gt; library API) functions. &amp;nbsp;That is, clients of &amp;quot;xyz.h&amp;quot; can't even see the
&lt;br&gt;&amp;gt; prototypes of the private functions.
&lt;br&gt;&lt;br&gt;Correct. On the flip-side, having only one file is convenient.
&lt;br&gt;&lt;br&gt;While I agree that header files can serve a documentation purpose, I
&lt;br&gt;don't think that's true for us. An automatically generated header is
&lt;br&gt;full of extra-trash and lacks comments. The header doesn't declare the
&lt;br&gt;symbols to C and output library doesn't expose them to the linker. If
&lt;br&gt;you want to document your API, do a better job than an automatic
&lt;br&gt;header file.
&lt;br&gt;&lt;br&gt;&amp;gt;&amp;gt; What I do think we need is a new annotation, 'defaultImport
&lt;br&gt;&amp;gt;&amp;gt; public/external'. This way your 'prim.sml' that does all the
&lt;br&gt;&amp;gt;&amp;gt; _import/_address/_symbol'ing can be easily switched between
&lt;br&gt;&amp;gt;&amp;gt; static/dynamic import.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This shifts the point of change from the 'prim.sml' file to the 'xyz.mlb'
&lt;br&gt;&amp;gt; file.
&lt;br&gt;&lt;br&gt;That's exactly what I wanted: one place to change. Some of my projects
&lt;br&gt;have prim.sml files that run over 1000 lines. These aren't
&lt;br&gt;auto-generated, so there's no possiible autogenerated ML import header
&lt;br&gt;to have in this case. An annotation could solve this neatly, without
&lt;br&gt;trying to 'sed' the file, which I think is a pretty crude and fragile
&lt;br&gt;approach.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19818909&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19818909.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19818141</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-04T15:02:24Z</published>
	<updated>2008-10-04T15:02:24Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Sat, 4 Oct 2008, Wesley W. Terpstra wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; My personal opinion is that removing the default and requiring the
&lt;br&gt;&amp;gt; user to always specify the linkage would be surprising when compared
&lt;br&gt;&amp;gt; to how one typically uses C libraries. There are only two cases where
&lt;br&gt;&amp;gt; the default is 'wrong'. 1) PIC archives, which are a corner case very
&lt;br&gt;&amp;gt; few projects need. In this case the header has no default and forces
&lt;br&gt;&amp;gt; you to pay attention. 2) You are compiling a library including ML code
&lt;br&gt;&amp;gt; and C code. In this case we require:
&lt;br&gt;&amp;gt; &amp;nbsp;#define PART_OF_XYZ
&lt;br&gt;&amp;gt; &amp;nbsp;#include &amp;quot;xyz.h&amp;quot;
&lt;br&gt;&amp;gt; inside your C files instead of:
&lt;br&gt;&amp;gt; &amp;nbsp;#include &amp;quot;xyz.h&amp;quot;
&lt;br&gt;&amp;gt; &amp;nbsp;#include &amp;quot;xyz-private.h&amp;quot;
&lt;br&gt;&amp;gt; This doesn't seem particularly onerous or strange to me. You're
&lt;br&gt;&amp;gt; cooperating with MLton to build a library in this case, so it's fair
&lt;br&gt;&amp;gt; for us to have a (not-so-uncommon) convention you need to be aware of.
&lt;/div&gt;&lt;br&gt;That seems like a reasonable rationale. &amp;nbsp;If I understand things correctly, 
&lt;br&gt;though, one advantage of the
&lt;br&gt;&amp;nbsp; &amp;nbsp;#include &amp;quot;xyz.h&amp;quot;
&lt;br&gt;&amp;nbsp; &amp;nbsp;#include &amp;quot;xyz-private.h&amp;quot;
&lt;br&gt;approach is that is textually separates the public (in the sense of the 
&lt;br&gt;documented portions of the library API available for use in other 
&lt;br&gt;projects) functions from the private (in the sense of the undocumented 
&lt;br&gt;portions of the library API) functions. &amp;nbsp;That is, clients of &amp;quot;xyz.h&amp;quot; can't 
&lt;br&gt;even see the prototypes of the private functions. &amp;nbsp;On the other hand, if 
&lt;br&gt;the platform supports the right visibility attributes, then although a 
&lt;br&gt;client might be able to see the prototype of a private function in a 
&lt;br&gt;(combined) &amp;quot;xyz.h&amp;quot; header, they would fail at link time, because the 
&lt;br&gt;function wouldn't be visible in the binary library. &amp;nbsp;I guess you 
&lt;br&gt;acheive this effect in the (combined) &amp;quot;xyz.h&amp;quot; by using
&lt;br&gt;&amp;nbsp; &amp;nbsp;#define MLLIB_PRIVATE(x)
&lt;br&gt;when not PART_OF_XYZ to hide the private functions.
&lt;br&gt;&lt;br&gt;&amp;gt; What I do think we need is a new annotation, 'defaultImport
&lt;br&gt;&amp;gt; public/external'. This way your 'prim.sml' that does all the
&lt;br&gt;&amp;gt; _import/_address/_symbol'ing can be easily switched between
&lt;br&gt;&amp;gt; static/dynamic import.
&lt;br&gt;&lt;br&gt;This shifts the point of change from the 'prim.sml' file to the 'xyz.mlb' 
&lt;br&gt;file. &amp;nbsp;While one could use &amp;quot;-default-ann 'defaultImport public'&amp;quot;, this 
&lt;br&gt;could have undesirable effects if you import from two different libraries 
&lt;br&gt;that demand different linking, since one global default doesn't apply.
&lt;br&gt;&lt;br&gt;Anyways, it doesn't appear that there are clear-cut solutions. &amp;nbsp;But, I 
&lt;br&gt;tend to agree that an auto-generated SML import header is a sufficiently 
&lt;br&gt;rare corner case that it doesn't really demand extra compiler support.
&lt;br&gt;&lt;br&gt;-Matthew
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19818141&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19818141.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19814097</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-04T09:37:31Z</published>
	<updated>2008-10-04T09:37:31Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Sat, Oct 4, 2008 at 4:50 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19814097&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; So you would propose that I always require the user to
&lt;br&gt;&amp;gt;&amp;gt; #define PART_OF_X / STATIC_LINK_X / DYNAMIC_LINK_X before #include'ing
&lt;br&gt;&amp;gt;&amp;gt; the header?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Not necessarily. &amp;nbsp;What is 'best/common' practice? &amp;nbsp;Doing a
&lt;br&gt;&amp;gt; 'grep -r &amp;quot;(visibility(&amp;quot; /usr/include/*' (on an x86-linux) turns up some
&lt;br&gt;&amp;gt; headers that use it, but none appear to demand a
&lt;br&gt;&amp;gt; #define PART_OF/STATIC_LINK/DYNAMIC_LINK in order to control the visibility.
&lt;br&gt;&lt;br&gt;On linux you can ignore the difference of STATIC_LINK and
&lt;br&gt;DYNAMIC_LINK. Thus most projects do. Libraries that must also work as
&lt;br&gt;a dll on windows are the only ones which have to care.
&lt;br&gt;&lt;br&gt;All library projects provide some form of 'PART_OF', but it differs on
&lt;br&gt;a library-to-library basis. The most common approach is to provide a
&lt;br&gt;public header and one or more private headers. Examples of this are
&lt;br&gt;gdtoa, gmp, and sqlite3. Some libraries also use a macro. For example,
&lt;br&gt;gmp uses __GMP_WITHIN_GMP.
&lt;br&gt;&lt;br&gt;gmp also distinguishes static/dynamic linkage with __GMP_LIBGMP_DLL.
&lt;br&gt;My approach follows gmp very closely. gmp sets GMP_LIBGMP_DLL at
&lt;br&gt;library creation time depending on if it is a static or dynamic
&lt;br&gt;library. It also has this to say:
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; AC_MSG_ERROR([cannot build both static and DLL, since gmp.h is
&lt;br&gt;different for each. Use &amp;quot;--disable-static --enable-shared&amp;quot; to build
&lt;br&gt;just a DLL.])
&lt;br&gt;&lt;br&gt;I also set STATIC/DYNAMIC_LINK to some default in our export header
&lt;br&gt;based on static/dynamic output. I've just allowed the user to override
&lt;br&gt;it.
&lt;br&gt;&lt;br&gt;Very few libraries can compile to a PIC archive. glibc is one example,
&lt;br&gt;but it clearly has no need to be portable to a non-ELF platform. This
&lt;br&gt;is the only case where I currently leave no default. There is
&lt;br&gt;definitely no 'best practice' for this type of library.
&lt;br&gt;&lt;br&gt;The current MLton approach is: the export header is exactly the same
&lt;br&gt;for all output formats, except that the default
&lt;br&gt;PART_OF/STATIC_LINK/DYNAMIC_LINK differs. The user can be explicit and
&lt;br&gt;override this default.
&lt;br&gt;&lt;br&gt;On an ELF system you can use the export headers for both
&lt;br&gt;static/dynamic, because EXERNAL/PUBLIC are identical on that target.
&lt;br&gt;Thus you can do like most linux programs and supply one header that
&lt;br&gt;works for both static and dynamic libraries.
&lt;br&gt;&lt;br&gt;My personal opinion is that removing the default and requiring the
&lt;br&gt;user to always specify the linkage would be surprising when compared
&lt;br&gt;to how one typically uses C libraries. There are only two cases where
&lt;br&gt;the default is 'wrong'. 1) PIC archives, which are a corner case very
&lt;br&gt;few projects need. In this case the header has no default and forces
&lt;br&gt;you to pay attention. 2) You are compiling a library including ML code
&lt;br&gt;and C code. In this case we require:
&lt;br&gt;&amp;nbsp; #define PART_OF_XYZ
&lt;br&gt;&amp;nbsp; #include &amp;quot;xyz.h&amp;quot;
&lt;br&gt;inside your C files instead of:
&lt;br&gt;&amp;nbsp; #include &amp;quot;xyz.h&amp;quot;
&lt;br&gt;&amp;nbsp; #include &amp;quot;xyz-private.h&amp;quot;
&lt;br&gt;This doesn't seem particularly onerous or strange to me. You're
&lt;br&gt;cooperating with MLton to build a library in this case, so it's fair
&lt;br&gt;for us to have a (not-so-uncommon) convention you need to be aware of.
&lt;br&gt;&lt;br&gt;&amp;gt; I don't see how functors and/or the ml basis sytem help here. &amp;nbsp;Neither allow
&lt;br&gt;&amp;gt; for control-flow or conditional compilation.
&lt;br&gt;&lt;br&gt;I meant to use the mlb-path-map approach. You can write your
&lt;br&gt;library-dependent code as a functor and then bind it to one of the two
&lt;br&gt;structures in a file chosen depending on a path variable.
&lt;br&gt;&lt;br&gt;At any rate, I no longer think the ML export header is necessary. The
&lt;br&gt;only situtation it seems reasonable for an ML program to use an ML
&lt;br&gt;library via FFI is if there was a pure C library between them, in
&lt;br&gt;which case you probably shouldn't be using the internal ML library
&lt;br&gt;anyway, but rather the C library's wrappers.
&lt;br&gt;&lt;br&gt;What I do think we need is a new annotation, 'defaultImport
&lt;br&gt;public/external'. This way your 'prim.sml' that does all the
&lt;br&gt;_import/_address/_symbol'ing can be easily switched between
&lt;br&gt;static/dynamic import.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19814097&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19814097.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19812713</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-04T07:50:19Z</published>
	<updated>2008-10-04T07:50:19Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Sat, 4 Oct 2008, Wesley W. Terpstra wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Fri, Oct 3, 2008 at 10:21 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19812713&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; Things seem
&lt;br&gt;&amp;gt;&amp;gt; sufficiently complex that it is unclear whether a complicated set of
&lt;br&gt;&amp;gt;&amp;gt; implicit defaults is enough to shield a programmer completely (or even
&lt;br&gt;&amp;gt;&amp;gt; mostly) from the details of which they need to be aware. &amp;nbsp;If that is the
&lt;br&gt;&amp;gt;&amp;gt; case, then it is often simpler to allow/force someone to be explicit up
&lt;br&gt;&amp;gt;&amp;gt; front, since that may be easier than trying to back out of the implicit
&lt;br&gt;&amp;gt;&amp;gt; defaults when the need arises.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; So you would propose that I always require the user to
&lt;br&gt;&amp;gt; #define PART_OF_X / STATIC_LINK_X / DYNAMIC_LINK_X before #include'ing
&lt;br&gt;&amp;gt; the header?
&lt;/div&gt;&lt;br&gt;Not necessarily. &amp;nbsp;What is 'best/common' practice? &amp;nbsp;Doing a
&lt;br&gt;'grep -r &amp;quot;(visibility(&amp;quot; /usr/include/*' (on an x86-linux) turns up some 
&lt;br&gt;headers that use it, but none appear to demand a
&lt;br&gt;#define PART_OF/STATIC_LINK/DYNAMIC_LINK in order to control the 
&lt;br&gt;visibility.
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt;&amp;gt; ---foo_import.src---
&lt;br&gt;&amp;gt;&amp;gt; structure Foo = struct
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;val libopen = _import &amp;quot;foo_open&amp;quot; FOO_SCOPE: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;val libclose = _import &amp;quot;foo_close&amp;quot; FOO_SCOPE: unit -&amp;gt; unit;
&lt;br&gt;&amp;gt;&amp;gt; end
&lt;br&gt;&amp;gt;&amp;gt; ------
&lt;br&gt;&amp;gt;&amp;gt; ---Makefile---
&lt;br&gt;&amp;gt;&amp;gt; FOO_SCOPE=public
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; foo_import.sml: foo_import_src
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sed 's|FOO_SCOPE|$(FOO_SCOPE)|' &amp;lt; foo_import.scc &amp;gt; foo_import.sml
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Well, I thought it would be nicer to have
&lt;br&gt;&amp;gt; structure FooStatic = struct
&lt;br&gt;&amp;gt; val libopen = _import &amp;quot;foo_open&amp;quot; public: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;gt; val libclose = _import &amp;quot;foo_close&amp;quot; public: unit -&amp;gt; unit;
&lt;br&gt;&amp;gt; end
&lt;br&gt;&amp;gt; structure FooDynamic = struct
&lt;br&gt;&amp;gt; val libopen = _import &amp;quot;foo_open&amp;quot; public: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;gt; val libclose = _import &amp;quot;foo_close&amp;quot; public: unit -&amp;gt; unit;
&lt;br&gt;&amp;gt; end
&lt;br&gt;&amp;gt; structure Foo = FooStatic (* or whatever a sane default is *)
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; ... my way you can use functors and/or the basis system to do what you
&lt;br&gt;&amp;gt; want without having to drop out to make.
&lt;/div&gt;&lt;br&gt;I don't see how functors and/or the ml basis sytem help here. &amp;nbsp;Neither 
&lt;br&gt;allow for control-flow or conditional compilation. &amp;nbsp;In your example above, 
&lt;br&gt;there is no way to change Foo from FooStatic to FooDynamic without 
&lt;br&gt;changing the source file. &amp;nbsp;As Vesa noted, you can use MLB variables to get 
&lt;br&gt;a poor-man's form of conditional compilation, but then you have to (in the 
&lt;br&gt;Makefile) load an appropriate mlb-path-map.
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19812713&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19812713.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19807593</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-03T16:55:22Z</published>
	<updated>2008-10-03T16:55:22Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Fri, Oct 3, 2008 at 10:21 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19807593&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Things seem
&lt;br&gt;&amp;gt; sufficiently complex that it is unclear whether a complicated set of
&lt;br&gt;&amp;gt; implicit defaults is enough to shield a programmer completely (or even
&lt;br&gt;&amp;gt; mostly) from the details of which they need to be aware. &amp;nbsp;If that is the
&lt;br&gt;&amp;gt; case, then it is often simpler to allow/force someone to be explicit up
&lt;br&gt;&amp;gt; front, since that may be easier than trying to back out of the implicit
&lt;br&gt;&amp;gt; defaults when the need arises.
&lt;br&gt;&lt;br&gt;So you would propose that I always require the user to
&lt;br&gt;#define PART_OF_X / STATIC_LINK_X / DYNAMIC_LINK_X before #include'ing
&lt;br&gt;the header?
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; ---foo_import.src---
&lt;br&gt;&amp;gt; structure Foo = struct
&lt;br&gt;&amp;gt; &amp;nbsp;val libopen = _import &amp;quot;foo_open&amp;quot; FOO_SCOPE: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;gt; &amp;nbsp;val libclose = _import &amp;quot;foo_close&amp;quot; FOO_SCOPE: unit -&amp;gt; unit;
&lt;br&gt;&amp;gt; end
&lt;br&gt;&amp;gt; ------
&lt;br&gt;&amp;gt; ---Makefile---
&lt;br&gt;&amp;gt; FOO_SCOPE=public
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; foo_import.sml: foo_import_src
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;sed 's|FOO_SCOPE|$(FOO_SCOPE)|' &amp;lt; foo_import.scc &amp;gt; foo_import.sml
&lt;/div&gt;&lt;br&gt;Well, I thought it would be nicer to have
&lt;br&gt;structure FooStatic = struct
&lt;br&gt;&amp;nbsp;val libopen = _import &amp;quot;foo_open&amp;quot; public: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;nbsp;val libclose = _import &amp;quot;foo_close&amp;quot; public: unit -&amp;gt; unit;
&lt;br&gt;end
&lt;br&gt;structure FooDynamic = struct
&lt;br&gt;&amp;nbsp;val libopen = _import &amp;quot;foo_open&amp;quot; public: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;nbsp;val libclose = _import &amp;quot;foo_close&amp;quot; public: unit -&amp;gt; unit;
&lt;br&gt;end
&lt;br&gt;structure Foo = FooStatic (* or whatever a sane default is *)
&lt;br&gt;&lt;br&gt;... my way you can use functors and/or the basis system to do what you
&lt;br&gt;want without having to drop out to make.
&lt;br&gt;&lt;br&gt;&amp;gt; Finally, importing a MLton library (either static or dynamic) into another
&lt;br&gt;&amp;gt; MLton library or executable seems to be a fairly obscure usage.
&lt;br&gt;&lt;br&gt;I was aiming for completeness. Perhaps it's not necessary then to
&lt;br&gt;output an ML import header; if you really need one, you can write it
&lt;br&gt;yourself.
&lt;br&gt;&lt;br&gt;While I agree it's pretty bizarre to have two MLton libraries at once,
&lt;br&gt;I think this could happen if you have pure C programs/libraries that
&lt;br&gt;in turn use ML libraries.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19807593&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19807593.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19805888</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-03T14:28:26Z</published>
	<updated>2008-10-03T14:28:26Z</updated>
	<author>
		<name>Vesa Karvonen-2</name>
	</author>
	<content type="html">On Fri, Oct 3, 2008 at 11:21 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19805888&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Finally, importing a MLton library (either static or dynamic) into another
&lt;br&gt;&amp;gt; MLton library or executable seems to be a fairly obscure usage. [...]
&lt;br&gt;&lt;br&gt;I could certainly imagine some more or less plausible practical
&lt;br&gt;reasons to do so, such as cutting compilation time. Although, given
&lt;br&gt;the limited set of types available for interfacing with such
&lt;br&gt;libraries, many such uses could just as well be written by compiling
&lt;br&gt;the MLton &amp;quot;library&amp;quot; as a regular program that is spawned by the host
&lt;br&gt;program as a separate process and communicated with via some form of
&lt;br&gt;IPC. BTW, according to Armstrong's book this is a preferred way of
&lt;br&gt;using foreign language libraries in Erlang.
&lt;br&gt;&lt;br&gt;&amp;gt; It is almost certainly a win to have all high-level language code sharing
&lt;br&gt;&amp;gt; the same instance of the runtime/GC/etc.
&lt;br&gt;&lt;br&gt;Yes, if you are directly linking to the code, then I would tend to
&lt;br&gt;agree (modulo exceptional practical concerns). &amp;nbsp;Isolating parts of a
&lt;br&gt;program to different processes, OTOH, may have practical advantages
&lt;br&gt;such as fault isolation (bug in a subsystem cannot crash the entire
&lt;br&gt;program) that can be more valuable than efficiency.
&lt;br&gt;&lt;br&gt;-Vesa Karvonen
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19805888&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19805888.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19804917</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-03T13:21:54Z</published>
	<updated>2008-10-03T13:21:54Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Thu, 2 Oct 2008, Wesley W. Terpstra wrote:
&lt;br&gt;&amp;gt; Thoughts?
&lt;br&gt;&lt;br&gt;The whole set of shared-library/visibility issues seems fairly opaque (a 
&lt;br&gt;reflection on the ABI itself, not its realization in MLton). &amp;nbsp;From some 
&lt;br&gt;of the scenarios that Wesley has described, it often seems to be the 
&lt;br&gt;case that one has to be very clear on how a program/library links to other 
&lt;br&gt;libraries, how a library is generated depending on its future use, etc. 
&lt;br&gt;Things seem sufficiently complex that it is unclear whether a complicated 
&lt;br&gt;set of implicit defaults is enough to shield a programmer completely (or 
&lt;br&gt;even mostly) from the details of which they need to be aware. &amp;nbsp;If that is 
&lt;br&gt;the case, then it is often simpler to allow/force someone to be explicit 
&lt;br&gt;up front, since that may be easier than trying to back out of the implicit 
&lt;br&gt;defaults when the need arises.
&lt;br&gt;&lt;br&gt;Also, picking up a theme similar to one that Vesa raised, is it so 
&lt;br&gt;difficult to set the visibility of an imported library at configure/build 
&lt;br&gt;time of a target. &amp;nbsp;For example, something like:
&lt;br&gt;&lt;br&gt;---foo_import.src---
&lt;br&gt;structure Foo = struct
&lt;br&gt;&amp;nbsp; &amp;nbsp;val libopen = _import &amp;quot;foo_open&amp;quot; FOO_SCOPE: int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;nbsp; &amp;nbsp;val libclose = _import &amp;quot;foo_close&amp;quot; FOO_SCOPE: unit -&amp;gt; unit;
&lt;br&gt;end
&lt;br&gt;------
&lt;br&gt;---Makefile---
&lt;br&gt;FOO_SCOPE=public
&lt;br&gt;&lt;br&gt;foo_import.sml: foo_import_src
&lt;br&gt;&amp;nbsp;	sed 's|FOO_SCOPE|$(FOO_SCOPE)|' &amp;lt; foo_import.scc &amp;gt; foo_import.sml
&lt;br&gt;------
&lt;br&gt;&lt;br&gt;where the 'FOO_SCOPE=public' in the Makefile could either have been 
&lt;br&gt;determined at configure time (depending on the availability of libfoo.a or 
&lt;br&gt;libfoo.so) or left blank to be set at the 'make' invocation.
&lt;br&gt;&lt;br&gt;Finally, importing a MLton library (either static or dynamic) into another 
&lt;br&gt;MLton library or executable seems to be a fairly obscure usage. 
&lt;br&gt;Independent of the fact that MLton is a whole-program compiler (which 
&lt;br&gt;benefits from exposing all of the SML code code the compiler at once), I 
&lt;br&gt;don't know of any high-level language implementation (e.g., OCaml, GHC) 
&lt;br&gt;that prefers to import language-native libraries as though they were 
&lt;br&gt;language-independent system libraries. &amp;nbsp;[One might argue that CLR/.NET is 
&lt;br&gt;an exception, but, really, the 'language-native library' in that instance 
&lt;br&gt;happens to be .NET assemblies.] It is almost certainly a win to have all 
&lt;br&gt;high-level language code sharing the same instance of the runtime/GC/etc.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19804917&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19804917.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19797333</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-03T06:04:22Z</published>
	<updated>2008-10-03T06:04:22Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Fri, Oct 3, 2008 at 10:01 AM, Vesa Karvonen &amp;gt; In C and C++, and
&lt;br&gt;particularly on Windows, one often uses macros in
&lt;br&gt;&amp;gt; library headers and source files to insert appropriate compiler
&lt;br&gt;&amp;gt; specific declarations to mark symbols ...
&lt;br&gt;&lt;br&gt;Yes, this is what MLton/svn does in the generated C import header.
&lt;br&gt;However, in some cases a programmer still needs to specify how he
&lt;br&gt;links a library. The MLton import headers do this with a macro:
&lt;br&gt;&lt;br&gt;#define STATIC_LINK_FOOBAR
&lt;br&gt;#include &amp;lt;foobar.h&amp;gt;
&lt;br&gt;&lt;br&gt;&amp;gt; One thing that comes to mind from this is that it would be nice to be
&lt;br&gt;&amp;gt; able to switch between static and dynamic linking easily without using
&lt;br&gt;&amp;gt; a complicated mechanism at the source level. In fact, I think that
&lt;br&gt;&amp;gt; ideally code that uses a library should really be exactly the same
&lt;br&gt;&amp;gt; regardless of whether the library is linked statically or
&lt;br&gt;&amp;gt; (unoptionally) dynamically. I'm not saying that it isn't possible with
&lt;br&gt;&amp;gt; the above format (you need to bind one of the modules, STATIC_LINK_M1
&lt;br&gt;&amp;gt; or DYNAMIC_LINK_M1, to a &amp;nbsp;module that you use in the client code), but
&lt;br&gt;&amp;gt; rather that you might want to consider this from that perspective.
&lt;br&gt;&lt;br&gt;I agree this would be nice, but unfortunately it isn't. The assembly/C
&lt;br&gt;generated by MLton to use a library must know whether those symbols
&lt;br&gt;are imported from a dynamically or statically linked library. MLton
&lt;br&gt;does not know this. When we pass '-lfoo' to the linker, it picks some
&lt;br&gt;library out of paths we know nothing about.
&lt;br&gt;&lt;br&gt;&amp;gt; One alternative that comes to mind would be to specify as a
&lt;br&gt;&amp;gt; command-line option whether one wishes to link statically or
&lt;br&gt;&amp;gt; dynamically and MLton would then generate only one set of imports and
&lt;br&gt;&amp;gt; the module name would be the same (e.g. just M1) in either case.
&lt;br&gt;&lt;br&gt;I am not sure where these options are to be passed, but it sounds like
&lt;br&gt;you mean at library creation. What I think you've overlooked is that
&lt;br&gt;the same library can be linked three different ways.
&lt;br&gt;&lt;br&gt;Consider a PIC archive library foo.
&lt;br&gt;&lt;br&gt;During compilation of C that will be included in the final PIC library
&lt;br&gt;you have access to private symbols and shouldn't import symbols that
&lt;br&gt;will be in the final foo product.
&lt;br&gt;&lt;br&gt;A shared library built against foo will statically link foo in. This
&lt;br&gt;means it no longer has access to private symbols, but shouldn't be
&lt;br&gt;importing the symbols either as they will be in the same final DSO.
&lt;br&gt;MLton import headers call this PART_OF_LIBNAME.
&lt;br&gt;&lt;br&gt;A user of the resulting shared library wants to call functions that
&lt;br&gt;were in foo. He has no access to private symbols and needs to import
&lt;br&gt;the public ones. MLton import headers call this STATIC_LINK_LIBNAME
&lt;br&gt;&lt;br&gt;Each of these three uses are distinct and if you try to coflate any of
&lt;br&gt;them I can present you with a platform where your solution breaks.
&lt;br&gt;MLton import headers call this DYNAMIC_LINK_LIBNAME.
&lt;br&gt;&lt;br&gt;While it's certainly true that for many libraries there is a sane
&lt;br&gt;default, sometimes there isn't. In MLton/svn terminology, we have four
&lt;br&gt;output formats. The generated header access modes are described below:
&lt;br&gt;&lt;br&gt;executable -- only ever makes sense to use PART_OF_LIBNAME linkage
&lt;br&gt;archive -- currently defaults to STATIC_LINK_LIBNAME, but if C is
&lt;br&gt;included into the resulting library, PART_OF_LIBNAME should be defined
&lt;br&gt;to override this default.
&lt;br&gt;library -- currently defaults to DYNAMIC_LINK_LIBNAME, but override to
&lt;br&gt;PART_OF_LIBNAME makes sense.
&lt;br&gt;libarchive -- the case I detailed above, the import header has no
&lt;br&gt;default and you have to specify the linkage.
&lt;br&gt;&lt;br&gt;I imagine we would output ML import files in the same way, eg: default
&lt;br&gt;M1 = STATIC_LINK_M1 for archive, M1 = DYNAMIC_LINK_M1 for library. No
&lt;br&gt;default for libarchive. Happily, there is no PART_OF_M1 case. At any
&lt;br&gt;rate, this is what I am proposing: an automatic M1 that &amp;quot;does the
&lt;br&gt;right thing&amp;quot; when it can, but includes both options in case you need
&lt;br&gt;them.
&lt;br&gt;&lt;br&gt;Another problem on my mind, is that it's fairly common (on linux) for
&lt;br&gt;libraries to be shipped as both dynamic (PIC .so) and static (non-PIC
&lt;br&gt;archive), with only one header file. Sometimes important libraries
&lt;br&gt;also include a PIC archive. This works because happily on ELF systems
&lt;br&gt;public/external end up being the same. I'm not sure how to support
&lt;br&gt;this model and at the same time also support platforms like windows
&lt;br&gt;where public/external are critically different.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19797333&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19797333.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19793563</id>
	<title>Re: MLton import headers</title>
	<published>2008-10-03T01:01:46Z</published>
	<updated>2008-10-03T01:01:46Z</updated>
	<author>
		<name>Vesa Karvonen-2</name>
	</author>
	<content type="html">On Thu, Oct 2, 2008 at 1:20 PM, Wesley W. Terpstra &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19793563&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;wesley@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;[...]
&lt;br&gt;&amp;gt; One of the problems with using a library is that you need to know how
&lt;br&gt;&amp;gt; you are linking against it. Often programmers can get away without
&lt;br&gt;&amp;gt; knowing, but this breaks down on some combinations of operating
&lt;br&gt;&amp;gt; system, architecture, and definitions.
&lt;br&gt;&lt;br&gt;In C and C++, and particularly on Windows, one often uses macros in
&lt;br&gt;library headers and source files to insert appropriate compiler
&lt;br&gt;specific declarations to mark symbols that are either exported from
&lt;br&gt;the currently compiled DLL or imported from an external DLL. These
&lt;br&gt;macros are often defined in a configuration header of some sort and
&lt;br&gt;one can then easily switch between various linkage options
&lt;br&gt;(static/dynamic library, import/export symbols).
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; When using a MLton generated library from another MLton program, there
&lt;br&gt;&amp;gt; is the same problem. _import &amp;quot;foo&amp;quot; public: ...; is appropriate for a
&lt;br&gt;&amp;gt; static link, while _import &amp;quot;foo&amp;quot; external: ...; is appropriate for a
&lt;br&gt;&amp;gt; dynamic link. I was thinking of an output file something like:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; signature M1 =
&lt;br&gt;&amp;gt; &amp;nbsp;sig
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val m1_open : int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val m1_close : unit -&amp;gt; unit;
&lt;br&gt;&amp;gt; &amp;nbsp;end
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; structure STATIC_LINK_M1 :&amp;gt; M1 =
&lt;br&gt;&amp;gt; &amp;nbsp;struct
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val m1_open = _import &amp;quot;m1_open&amp;quot; public;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val m1_close = _import &amp;quot;m1_close&amp;quot; public;
&lt;br&gt;&amp;gt; &amp;nbsp;end
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; structure DYNAMIC_LINK_M1 :&amp;gt; M1 =
&lt;br&gt;&amp;gt; &amp;nbsp;struct
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val m1_open = _import &amp;quot;m1_open&amp;quot; external;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val m1_close = _import &amp;quot;m1_close&amp;quot; external;
&lt;br&gt;&amp;gt; &amp;nbsp;end
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I have intentionally left out PART_OF_M1 because you're better off not
&lt;br&gt;&amp;gt; using the FFI in this case.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Thoughts?
&lt;/div&gt;&lt;br&gt;One thing that comes to mind from this is that it would be nice to be
&lt;br&gt;able to switch between static and dynamic linking easily without using
&lt;br&gt;a complicated mechanism at the source level. In fact, I think that
&lt;br&gt;ideally code that uses a library should really be exactly the same
&lt;br&gt;regardless of whether the library is linked statically or
&lt;br&gt;(unoptionally) dynamically. I'm not saying that it isn't possible with
&lt;br&gt;the above format (you need to bind one of the modules, STATIC_LINK_M1
&lt;br&gt;or DYNAMIC_LINK_M1, to a &amp;nbsp;module that you use in the client code), but
&lt;br&gt;rather that you might want to consider this from that perspective.
&lt;br&gt;&lt;br&gt;One alternative that comes to mind would be to specify as a
&lt;br&gt;command-line option whether one wishes to link statically or
&lt;br&gt;dynamically and MLton would then generate only one set of imports and
&lt;br&gt;the module name would be the same (e.g. just M1) in either case. This
&lt;br&gt;import file generation step could be called as a part of the build
&lt;br&gt;script (for the library) and the resulting module would then be used
&lt;br&gt;to call the library. &amp;nbsp;Alternatively, the module could be selected in a
&lt;br&gt;MLB file based on a path variable and the library would have
&lt;br&gt;pregenerated import files for both cases (static/dynamic). &amp;nbsp;In either
&lt;br&gt;case, the SML client code would be exactly the same regardless of
&lt;br&gt;whether the library is linked statically or dynamically.
&lt;br&gt;&lt;br&gt;-Vesa Karvonen
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19793563&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19793563.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19776710</id>
	<title>MLton import headers</title>
	<published>2008-10-02T03:20:17Z</published>
	<updated>2008-10-02T03:20:17Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">Currently MLton outputs C import headers (ironically with
&lt;br&gt;-export-header). I think it might also be useful to output an ML
&lt;br&gt;import file.
&lt;br&gt;&lt;br&gt;One of the problems with using a library is that you need to know how
&lt;br&gt;you are linking against it. Often programmers can get away without
&lt;br&gt;knowing, but this breaks down on some combinations of operating
&lt;br&gt;system, architecture, and definitions. One of the tasks the C import
&lt;br&gt;header is to make the details transparent to the user.
&lt;br&gt;&lt;br&gt;When using a MLton generated library from another MLton program, there
&lt;br&gt;is the same problem. _import &amp;quot;foo&amp;quot; public: ...; is appropriate for a
&lt;br&gt;static link, while _import &amp;quot;foo&amp;quot; external: ...; is appropriate for a
&lt;br&gt;dynamic link. I was thinking of an output file something like:
&lt;br&gt;&lt;br&gt;signature M1 =
&lt;br&gt;&amp;nbsp; sig
&lt;br&gt;&amp;nbsp; &amp;nbsp; val m1_open : int * string vector -&amp;gt; unit;
&lt;br&gt;&amp;nbsp; &amp;nbsp; val m1_close : unit -&amp;gt; unit;
&lt;br&gt;&amp;nbsp; end
&lt;br&gt;&lt;br&gt;structure STATIC_LINK_M1 :&amp;gt; M1 =
&lt;br&gt;&amp;nbsp; struct
&lt;br&gt;&amp;nbsp; &amp;nbsp; val m1_open = _import &amp;quot;m1_open&amp;quot; public;
&lt;br&gt;&amp;nbsp; &amp;nbsp; val m1_close = _import &amp;quot;m1_close&amp;quot; public;
&lt;br&gt;&amp;nbsp; end
&lt;br&gt;&lt;br&gt;structure DYNAMIC_LINK_M1 :&amp;gt; M1 =
&lt;br&gt;&amp;nbsp; struct
&lt;br&gt;&amp;nbsp; &amp;nbsp; val m1_open = _import &amp;quot;m1_open&amp;quot; external;
&lt;br&gt;&amp;nbsp; &amp;nbsp; val m1_close = _import &amp;quot;m1_close&amp;quot; external;
&lt;br&gt;&amp;nbsp; end
&lt;br&gt;&lt;br&gt;I have intentionally left out PART_OF_M1 because you're better off not
&lt;br&gt;using the FFI in this case.
&lt;br&gt;&lt;br&gt;Thoughts?
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19776710&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/MLton-import-headers-tp19776710p19776710.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19768098</id>
	<title>TLDI 2009: call for papers</title>
	<published>2008-10-01T13:05:57Z</published>
	<updated>2008-10-01T13:05:57Z</updated>
	<author>
		<name>Amal Ahmed</name>
	</author>
	<content type="html">[ Just a quick reminder that the TLDI deadline is Oct 8th... ]
&lt;br&gt;&lt;br&gt;*********************************************************************
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CALL FOR PAPERS
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; TLDI 2009 
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ACM SIGPLAN Workshop on
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Types in Language Design and Implementation 
&lt;br&gt;&amp;nbsp;
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;24 January 2009 &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; 
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Savannah, Georgia, USA
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; To be held in conjunction with POPL 2009
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://ttic.uchicago.edu/~amal/tldi2009/&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://ttic.uchicago.edu/~amal/tldi2009/&lt;/a&gt;&lt;br&gt;*********************************************************************
&lt;br&gt;&lt;br&gt;IMPORTANT DATES
&lt;br&gt;&lt;br&gt;Submission: &amp;nbsp; &amp;nbsp; 8 Oct 2008, 5PM EDT (Wed)
&lt;br&gt;Notification: &amp;nbsp; 8 Nov 2008 (Sat)
&lt;br&gt;Camera ready: &amp;nbsp; 19 Nov 2008 (Wed)
&lt;br&gt;TLDI'09: &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;24 January 2009 (Sat)
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;SCOPE
&lt;br&gt;&lt;br&gt;The role of types and proofs in all aspects of language design,
&lt;br&gt;compiler construction, and software development has expanded greatly
&lt;br&gt;in recent years. Type systems, type analyses, and formal deduction
&lt;br&gt;have led to new concepts in compilation techniques for modern
&lt;br&gt;programming languages, verification of safety and security properties
&lt;br&gt;of programs, program transformation and optimization, and many other
&lt;br&gt;areas. In light of this expanding role of types, the ACM SIGPLAN
&lt;br&gt;Workshop on Types in Language Design and Implementation (TLDI'09)
&lt;br&gt;follows six previous International Workshops on types in compilation
&lt;br&gt;and language design (TIC'97, TIC'98, TIC'00, TLDI'03, TLDI'05, and
&lt;br&gt;TLDI'07), with the hope of bringing together researchers to share new
&lt;br&gt;ideas and results in this area.
&lt;br&gt;&lt;br&gt;Submissions for this event are invited on all interactions of types
&lt;br&gt;with language design, implementation, and programming methodology.
&lt;br&gt;This includes both practical applications and theoretical aspects.
&lt;br&gt;TLDI'09 specifically encourages papers from a broad field of
&lt;br&gt;programming language and compiler researchers, including those working
&lt;br&gt;in object-oriented, dynamically-typed, late-binding, systems
&lt;br&gt;programming, and mobile-code paradigms, as well as traditional
&lt;br&gt;fully-static type systems. Topics of interest include:
&lt;br&gt;&lt;br&gt;- Typed intermediate languages and type-directed compilation 
&lt;br&gt;- Type-based language support for safety and security 
&lt;br&gt;- Types for interoperability 
&lt;br&gt;- Type systems for system programming languages 
&lt;br&gt;- Type-based program analysis, transformation, and optimization 
&lt;br&gt;- Dependent types and type-based proof assistants 
&lt;br&gt;- Types for security protocols, concurrency, and distributed computing 
&lt;br&gt;- Type inference and type reconstruction 
&lt;br&gt;- Type-based specifications of data structures and program invariants 
&lt;br&gt;- Type-based memory management
&lt;br&gt;- Proof-carrying code and certifying compilation
&lt;br&gt;&lt;br&gt;This is not meant to be an exhaustive list; papers on novel
&lt;br&gt;utilizations of type information are welcome. Authors concerned about
&lt;br&gt;the suitability of a topic are encouraged to inquire via electronic
&lt;br&gt;mail to the program chair prior to submission.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;SUBMISSION GUIDELINES
&lt;br&gt;&lt;br&gt;Authors should submit a full paper of no more than 12 pages (including
&lt;br&gt;bibliography and appendices) by Wednesday, October 8, 2008 5PM Eastern
&lt;br&gt;Daylight Savings Time. The submission deadline and length limitations
&lt;br&gt;are firm. Submissions that do not meet these guidelines will not be
&lt;br&gt;considered.
&lt;br&gt;&lt;br&gt;All submissions should be in standard ACM SIGPLAN conference format:
&lt;br&gt;two columns, nine-point font on a ten-point baseline. Detailed
&lt;br&gt;formatting guidelines are available on the SIGPLAN Author Information
&lt;br&gt;page, along with a LaTeX class file and template:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.sigplan.org/authorInformation.htm&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.sigplan.org/authorInformation.htm&lt;/a&gt;&lt;br&gt;&lt;br&gt;Papers must be submitted in Adobe Portable Document Format (PDF) and
&lt;br&gt;must be formatted for US Letter size (8.5&amp;quot;x11&amp;quot;) paper. Authors for
&lt;br&gt;whom this is a hardship should contact the program chair before the
&lt;br&gt;deadline.
&lt;br&gt;&lt;br&gt;Submitted papers must adhere to the SIGPLAN Republication Policy: 
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &lt;a href=&quot;http://www.sigplan.org/republicationpolicy.htm&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://www.sigplan.org/republicationpolicy.htm&lt;/a&gt;&lt;br&gt;&lt;br&gt;Submissions should contain original research not published or 
&lt;br&gt;submitted for publication elsewhere.
&lt;br&gt;&lt;br&gt;The URL for submission will be announced closer to the deadline.
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;GENERAL CHAIR
&lt;br&gt;&lt;br&gt;Andrew Kennedy &amp;nbsp; &amp;nbsp; &amp;nbsp; Microsoft Research, Cambridge
&lt;br&gt;&lt;br&gt;&lt;br&gt;PROGRAM CHAIR
&lt;br&gt;&lt;br&gt;Amal Ahmed &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Toyota Technological Institute, Chicago
&lt;br&gt;&lt;br&gt;&lt;br&gt;PROGRAM COMMITTEE
&lt;br&gt;&lt;br&gt;Amal Ahmed &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Toyota Technological Institute, Chicago &amp;nbsp;(Chair)
&lt;br&gt;Juan Chen &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Microsoft Research
&lt;br&gt;Peter Dybjer &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Chalmers University of Technology
&lt;br&gt;Jeff Foster &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;University of Maryland, College Park
&lt;br&gt;Neal Glew &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Intel
&lt;br&gt;Robert Harper &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Carnegie Mellon University
&lt;br&gt;Andrew Myers &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Cornell University
&lt;br&gt;Atsushi Ohori &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Tohoku University
&lt;br&gt;Matthew Parkinson &amp;nbsp; &amp;nbsp;University of Cambridge
&lt;br&gt;Didier Remy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;INRIA Paris-Rocquencourt
&lt;br&gt;Andreas Rossberg &amp;nbsp; &amp;nbsp; Max Planck Institute for Software Systems
&lt;br&gt;&lt;br&gt;&lt;br&gt;STEERING COMMITTEE
&lt;br&gt;&lt;br&gt;Craig Chambers &amp;nbsp; &amp;nbsp; &amp;nbsp; University of Washington
&lt;br&gt;Robert Harper &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Carnegie Mellon University &amp;nbsp;(Chair)
&lt;br&gt;Xavier Leroy &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; INRIA Paris-Rocquencourt
&lt;br&gt;Greg Morrisett &amp;nbsp; &amp;nbsp; &amp;nbsp; Harvard University
&lt;br&gt;George Necula &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Rinera Networks and UC Berkeley
&lt;br&gt;Atsushi Ohori &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Tohoku University
&lt;br&gt;Francois Pottier &amp;nbsp; &amp;nbsp; INRIA Paris-Rocquencourt
&lt;br&gt;Zhong Shao &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Yale University
&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19768098&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/TLDI-2009%3A-call-for-papers-tp19768098p19768098.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19751613</id>
	<title>Re: Re: [MLton-commit] r6883</title>
	<published>2008-09-30T15:31:07Z</published>
	<updated>2008-09-30T15:31:07Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Tue, Sep 30, 2008 at 11:31 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19751613&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Tue, 23 Sep 2008, Wesley Terpstra wrote:
&lt;br&gt;&amp;gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; When building a library, assume -default-ann &amp;quot;allowFFI true&amp;quot;.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp;(* It doesn't make sense to have a library without FFI *)
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp;val () =
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case !format of
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Executable =&amp;gt; ()
&lt;br&gt;&amp;gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| _ =&amp;gt; ignore (Control.Elaborate.processDefault &amp;quot;allowFFI
&lt;br&gt;&amp;gt;&amp;gt; true&amp;quot;)
&lt;br&gt;&amp;gt;&amp;gt; +
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; While I agree that it doesn't make sense to build a library that doesn't
&lt;br&gt;&amp;gt; export any functions (and, thus, uses FFI), I don't think that the default
&lt;br&gt;&amp;gt; annotation should be 'allowFFI true'. &amp;nbsp;Yes, it is a little more concise for
&lt;br&gt;&amp;gt; a one-file *.sml library, but it is an abstraction violation for a
&lt;br&gt;&amp;gt; well-designed, modular, multi-file *.mlb project. &amp;nbsp;In that setting, you
&lt;br&gt;&amp;gt; would expect a project like:
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp;foo.mlb (* 'pure' SML *)
&lt;br&gt;&amp;gt; &amp;nbsp;bar.mlb (* 'pure' SML *)
&lt;br&gt;&amp;gt; &amp;nbsp;baz.sml (* 'pure' SML *)
&lt;br&gt;&amp;gt; &amp;nbsp;qux.sml (* 'pure' SML *)
&lt;br&gt;&amp;gt; &amp;nbsp;ann &amp;quot;allowFFI true&amp;quot; in
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;export.sml (* export functions *)
&lt;br&gt;&amp;gt; &amp;nbsp;end
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Not defaulting to &amp;quot;allowFFI true&amp;quot; ensures that no FFI is used in the 'pure'
&lt;br&gt;&amp;gt; SML portions of the library.
&lt;/div&gt;&lt;br&gt;Fair enough. It might make sense to enable it for just sml files then,
&lt;br&gt;just as MLton.* is available for sml files but not mlb files by
&lt;br&gt;default. On the other hand, I don't really care that much. =)
&lt;br&gt;&lt;br&gt;Feel free to revert it and update regresson/library/library-test.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19751613&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A--MLton-commit--r6883-tp19750792p19751613.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19751534</id>
	<title>Re: Re: [MLton-commit] r6887</title>
	<published>2008-09-30T15:24:58Z</published>
	<updated>2008-09-30T15:24:58Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Tue, Sep 30, 2008 at 11:17 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19751534&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; On Tue, 23 Sep 2008, Wesley Terpstra wrote:
&lt;br&gt;&amp;gt;&amp;gt; feround.c and IEEEReal.c carried duplicated fesetround code.
&lt;br&gt;&amp;gt;&amp;gt; The IEEEReal i386 version also works on x86_64.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is not technically true, as it only sets the control word on the x87
&lt;br&gt;&amp;gt; unit and not on the SSE unit.
&lt;br&gt;&lt;br&gt;An earlier commit by me added the SSE instructions to update the SSE
&lt;br&gt;unit at the same time (check IEEEReal.c -- I added 64 bit assembly) as
&lt;br&gt;the x87 unit. At the time I didn't realize there were two copies so
&lt;br&gt;only updated the one. The commit you saw merged them and removed the
&lt;br&gt;old version.
&lt;br&gt;&lt;br&gt;&amp;gt; For amd64, we use the SSE instructions exclusively for floating-point computation, so changing the x87 control word has no effect.
&lt;br&gt;&amp;gt; I doubt that there is any amd64 platform that does not provide
&lt;br&gt;&amp;gt; fe{get,set}round in libm, so I don't think it is necesary to provide
&lt;br&gt;&amp;gt; assembly for amd64.
&lt;br&gt;&lt;br&gt;Not true. I added that code because it was needed on MinGW/win64. The
&lt;br&gt;&amp;quot;libc&amp;quot; there also uses x87 ops, so we need to set both since MLton
&lt;br&gt;native codegen uses the other. I assume it's supposed to affect
&lt;br&gt;cos/sin/etc? At least it passes the regressions as it is now.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19751534&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A--MLton-commit--r6887-tp19750583p19751534.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19750792</id>
	<title>Re: [MLton-commit] r6883</title>
	<published>2008-09-30T14:31:13Z</published>
	<updated>2008-09-30T14:31:13Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Tue, 23 Sep 2008, Wesley Terpstra wrote:
&lt;br&gt;&amp;gt; When building a library, assume -default-ann &amp;quot;allowFFI true&amp;quot;.
&lt;br&gt;&lt;br&gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp;(* It doesn't make sense to have a library without FFI *)
&lt;br&gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp;val () =
&lt;br&gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; case !format of
&lt;br&gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Executable =&amp;gt; ()
&lt;br&gt;&amp;gt; + &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;| _ =&amp;gt; ignore (Control.Elaborate.processDefault &amp;quot;allowFFI true&amp;quot;)
&lt;br&gt;&amp;gt; +
&lt;br&gt;&lt;br&gt;While I agree that it doesn't make sense to build a library that doesn't 
&lt;br&gt;export any functions (and, thus, uses FFI), I don't think that the default 
&lt;br&gt;annotation should be 'allowFFI true'. &amp;nbsp;Yes, it is a little more concise 
&lt;br&gt;for a one-file *.sml library, but it is an abstraction violation for a 
&lt;br&gt;well-designed, modular, multi-file *.mlb project. &amp;nbsp;In that setting, you 
&lt;br&gt;would expect a project like:
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;foo.mlb (* 'pure' SML *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;bar.mlb (* 'pure' SML *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;baz.sml (* 'pure' SML *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;qux.sml (* 'pure' SML *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;ann &amp;quot;allowFFI true&amp;quot; in
&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;export.sml (* export functions *)
&lt;br&gt;&amp;nbsp; &amp;nbsp;end
&lt;br&gt;&lt;br&gt;Not defaulting to &amp;quot;allowFFI true&amp;quot; ensures that no FFI is used in the 
&lt;br&gt;'pure' SML portions of the library.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19750792&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A--MLton-commit--r6883-tp19750792p19750792.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19750743</id>
	<title>Re: Re: [MLton-commit] r6887</title>
	<published>2008-09-30T14:28:13Z</published>
	<updated>2008-09-30T14:28:13Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Tue, 30 Sep 2008, Matthew Fluet wrote:
&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Tue, 23 Sep 2008, Wesley Terpstra wrote:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;feround.c and IEEEReal.c carried duplicated fesetround code.
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;The IEEEReal i386 version also works on x86_64.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This is not technically true, as it only sets the control word on the x87 
&lt;br&gt;&amp;gt; unit and not on the SSE unit. &amp;nbsp;For amd64, we use the SSE instructions 
&lt;br&gt;&amp;gt; exclusively for floating-point computation, so changing the x87 control word 
&lt;br&gt;&amp;gt; has no effect. &amp;nbsp;See
&lt;br&gt;&amp;gt; &amp;nbsp; &lt;a href=&quot;http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/libc/sysdeps/x86_64/fpu/fesetround.c?rev=1.2&amp;cvsroot=glibc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/libc/sysdeps/x86_64/fpu/fesetround.c?rev=1.2&amp;cvsroot=glibc&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I doubt that there is any amd64 platform that does not provide 
&lt;br&gt;&amp;gt; fe{get,set}round in libm, so I don't think it is necesary to provide assembly 
&lt;br&gt;&amp;gt; for amd64.
&lt;/div&gt;&lt;br&gt;Hmm, I got confused looking at just the patch in the commit log. &amp;nbsp;I guess 
&lt;br&gt;the SSE control word changes were added some time ago. &amp;nbsp;And, looking at 
&lt;br&gt;that commit entry (r6693), it seems that MinGW on Win64 does not provide 
&lt;br&gt;(working) fe{get,set}round in libm.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19750743&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A--MLton-commit--r6887-tp19750583p19750743.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19750583</id>
	<title>Re: [MLton-commit] r6887</title>
	<published>2008-09-30T14:17:58Z</published>
	<updated>2008-09-30T14:17:58Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Tue, 23 Sep 2008, Wesley Terpstra wrote:
&lt;br&gt;&amp;gt; feround.c and IEEEReal.c carried duplicated fesetround code.
&lt;br&gt;&amp;gt; The IEEEReal i386 version also works on x86_64.
&lt;br&gt;&lt;br&gt;This is not technically true, as it only sets the control word on the x87 
&lt;br&gt;unit and not on the SSE unit. &amp;nbsp;For amd64, we use the SSE instructions 
&lt;br&gt;exclusively for floating-point computation, so changing the x87 control 
&lt;br&gt;word has no effect. &amp;nbsp;See
&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/libc/sysdeps/x86_64/fpu/fesetround.c?rev=1.2&amp;cvsroot=glibc&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://sources.redhat.com/cgi-bin/cvsweb.cgi/~checkout~/libc/sysdeps/x86_64/fpu/fesetround.c?rev=1.2&amp;cvsroot=glibc&lt;/a&gt;&lt;br&gt;&lt;br&gt;I doubt that there is any amd64 platform that does not provide 
&lt;br&gt;fe{get,set}round in libm, so I don't think it is necesary to provide 
&lt;br&gt;assembly for amd64.
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19750583&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/Re%3A--MLton-commit--r6887-tp19750583p19750583.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19748658</id>
	<title>Re: getText{Start,End} considered harmful</title>
	<published>2008-09-30T12:19:51Z</published>
	<updated>2008-09-30T12:19:51Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Tue, 23 Sep 2008, Ville Laurikari wrote:
&lt;br&gt;&amp;gt; On Mon, Sep 22, 2008 at 06:33:43PM +0200, Wesley W. Terpstra wrote:
&lt;br&gt;&amp;gt;&amp;gt; MLton currently uses two functions, GC_getText{Start,End}, to create a giant
&lt;br&gt;&amp;gt;&amp;gt; lookup table for profiling. These two functions are among the hardest things
&lt;br&gt;&amp;gt;&amp;gt; to supply when porting MLton. It becomes even harder once shared libraries
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I can vouch for the difficulty of porting these. &amp;nbsp; One can always of
&lt;br&gt;&amp;gt; course just #define HAS_TIME_PROFILING FALSE and live without
&lt;br&gt;&amp;gt; profiling...
&lt;br&gt;&lt;br&gt;On an architecture that doesn't support native codegen (i.e., that must 
&lt;br&gt;use the C-codegen), then one could probably have defined the 
&lt;br&gt;GC_getText{Start,End} functions to return NULL (or to even 'die'), since 
&lt;br&gt;the C-codegen uses the 'time-field' approach to time profiling (rather 
&lt;br&gt;than the 'time-label' approach).
&lt;br&gt;&lt;br&gt;But, a moot point after Wesley's commit.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19748658&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/getText%7BStart%2CEnd%7D-considered-harmful-tp19611687p19748658.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19748590</id>
	<title>Re: getText{Start,End} considered harmful</title>
	<published>2008-09-30T12:15:39Z</published>
	<updated>2008-09-30T12:15:39Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Sun, 28 Sep 2008, Wesley W. Terpstra wrote:
&lt;br&gt;&amp;gt; On Sun, Sep 28, 2008 at 7:01 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19748590&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt;&amp;gt; There are/were other issues with the approach to time profiling:
&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;&lt;a href=&quot;http://mlton.org/pipermail/mlton/2005-November/028283.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/pipermail/mlton/2005-November/028283.html&lt;/a&gt;&lt;br&gt;&amp;gt;&amp;gt; &amp;nbsp;&lt;a href=&quot;http://mlton.org/pipermail/mlton-commit/2005-November/000238.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/pipermail/mlton-commit/2005-November/000238.html&lt;/a&gt;&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Those emails propose to use code-modification for the C codegen and
&lt;br&gt;&amp;gt; the labels for the native codegen. I didn't intend to change this.
&lt;br&gt;&amp;gt; AFAIK, the C-codegen profiling path is completely unaffected.
&lt;br&gt;&lt;br&gt;Agreed that the C-codegen profiling path is unaffected by your changes. 
&lt;br&gt;But, I brought up that old thread because it lays out the arguments for 
&lt;br&gt;(and against) keeping the time overhead of profiling low. &amp;nbsp;Something not 
&lt;br&gt;brought up in that thread is that, while using code labels in the native 
&lt;br&gt;codegens works, it does complicate the native codegens somewhat, because 
&lt;br&gt;everytime a new assembly basic block is introduced, it needs to conjure up 
&lt;br&gt;the right profiling information to associate with the new profiling label. 
&lt;br&gt;Also, it is unlikely that we could easily use labels in a reusable codegen 
&lt;br&gt;framework (e.g., MLRISC, C--, LLVM).
&lt;br&gt;&lt;br&gt;Just as you noted that the sourceLabels could be compressed by eliminating 
&lt;br&gt;duplicates, the 'field' approach to time profiling in the C-codegen (and 
&lt;br&gt;available on the native codegens) could probably be improved by avoiding 
&lt;br&gt;idempotent assignments to the curSourceSeqsIndex.
&lt;br&gt;&lt;br&gt;Anyways, your approach is certainly expedient for the problem at hand. 
&lt;br&gt;And the self-compile didn't suffer from the binary search. &amp;nbsp;So, consider 
&lt;br&gt;the above just general comments.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19748590&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/getText%7BStart%2CEnd%7D-considered-harmful-tp19611687p19748590.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19715703</id>
	<title>Re: getText{Start,End} considered harmful</title>
	<published>2008-09-28T14:27:58Z</published>
	<updated>2008-09-28T14:27:58Z</updated>
	<author>
		<name>Wesley W. Terpstra</name>
	</author>
	<content type="html">On Sun, Sep 28, 2008 at 7:01 PM, Matthew Fluet &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19715703&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;fluet@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; My guess is that profiling with shared libraries is a bit much to ask. For
&lt;br&gt;&amp;gt; one, you've worked to ensure that multiple ML shared libraries can be used
&lt;br&gt;&amp;gt; within the same executable, but what would it mean for both of them to be
&lt;br&gt;&amp;gt; profiling libraries -- they would both want to use SIGPROF for their own
&lt;br&gt;&amp;gt; purposes.
&lt;br&gt;&lt;br&gt;Yes, this is clear. However, it seems reasonable to expect to profile
&lt;br&gt;one library. The GC_getText{Start,End} were causing segfaults in this
&lt;br&gt;case.
&lt;br&gt;&lt;br&gt;&amp;gt; There are/were other issues with the approach to time profiling:
&lt;br&gt;&amp;gt; &amp;nbsp;&lt;a href=&quot;http://mlton.org/pipermail/mlton/2005-November/028283.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/pipermail/mlton/2005-November/028283.html&lt;/a&gt;&lt;br&gt;&amp;gt; &amp;nbsp;&lt;a href=&quot;http://mlton.org/pipermail/mlton-commit/2005-November/000238.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/pipermail/mlton-commit/2005-November/000238.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;Those emails propose to use code-modification for the C codegen and
&lt;br&gt;the labels for the native codegen. I didn't intend to change this.
&lt;br&gt;AFAIK, the C-codegen profiling path is completely unaffected.
&lt;br&gt;&lt;br&gt;&amp;gt; Running some actual benchmarks (e.g., with the hamlet benchmark, as is
&lt;br&gt;&amp;gt; reported in the above messages) provides real evidence; &amp;quot;I imagine...&amp;quot; and
&lt;br&gt;&amp;gt; &amp;quot;I would contend...&amp;quot; are good hypotheses, but are not experiments.
&lt;br&gt;&lt;br&gt;I should probably run some more experiments, yes.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19715703&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/getText%7BStart%2CEnd%7D-considered-harmful-tp19611687p19715703.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19713404</id>
	<title>Re: getText{Start,End} considered harmful</title>
	<published>2008-09-28T10:06:50Z</published>
	<updated>2008-09-28T10:06:50Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Sun, 28 Sep 2008, Matthew Fluet wrote:
&lt;br&gt;&amp;gt; I see that such a patch has already been committed, but it would be nice to 
&lt;br&gt;&amp;gt; report the actual runtime (and profiling results) impact of such a change.
&lt;br&gt;&lt;br&gt;Sorry, my fault for reading/responding to messages in sequential order. 
&lt;br&gt;Your later results with the self-compile seem to support the argument that 
&lt;br&gt;a binary search suffices.
&lt;br&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19713404&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/getText%7BStart%2CEnd%7D-considered-harmful-tp19611687p19713404.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19713351</id>
	<title>Re: getText{Start,End} considered harmful</title>
	<published>2008-09-28T10:01:05Z</published>
	<updated>2008-09-28T10:01:05Z</updated>
	<author>
		<name>Matthew Fluet-3</name>
	</author>
	<content type="html">On Mon, 22 Sep 2008, Wesley W. Terpstra wrote:
&lt;br&gt;&amp;gt; MLton currently uses two functions, GC_getText{Start,End}, to create a giant
&lt;br&gt;&amp;gt; lookup table for profiling. These two functions are among the hardest things
&lt;br&gt;&amp;gt; to supply when porting MLton. It becomes even harder once shared libraries
&lt;br&gt;&amp;gt; are considered, because then one needs to consider which text segment is
&lt;br&gt;&amp;gt; intended. After reading the i386 sys v abi specification, I still have no
&lt;br&gt;&amp;gt; idea how to do this correctly for shared libraries on elf.
&lt;br&gt;&lt;br&gt;My guess is that profiling with shared libraries is a bit much to ask. 
&lt;br&gt;For one, you've worked to ensure that multiple ML shared libraries can be 
&lt;br&gt;used within the same executable, but what would it mean for both of them 
&lt;br&gt;to be profiling libraries -- they would both want to use SIGPROF for their 
&lt;br&gt;own purposes.
&lt;br&gt;&lt;br&gt;Nonetheless, I appreciate the GC_getText{Start,End} difficulties.
&lt;br&gt;There are/were other issues with the approach to time profiling:
&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://mlton.org/pipermail/mlton/2005-November/028283.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/pipermail/mlton/2005-November/028283.html&lt;/a&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp;&lt;a href=&quot;http://mlton.org/pipermail/mlton-commit/2005-November/000238.html&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/pipermail/mlton-commit/2005-November/000238.html&lt;/a&gt;&lt;br&gt;&lt;br&gt;&amp;gt; It seems to me that not only are these a portability problem, they are
&lt;br&gt;&amp;gt; completely unnecessary. Making a giant lookup table for every address in the
&lt;br&gt;&amp;gt; text segment hardly seems like a worthy goal. I imagine the justification is
&lt;br&gt;&amp;gt; that it has minimal impact on the performance of the program during handling
&lt;br&gt;&amp;gt; of SIGPROF. However, I would contend that a giant lookup table could very
&lt;br&gt;&amp;gt; well be more intrusive than just using a binary search of a compressed
&lt;br&gt;&amp;gt; (repeated sourceSeqIndexes eliminated) sourceMaps.sourceLabels. Even if the
&lt;br&gt;&amp;gt; binary search does have a greater impact, at 1kHZ it will hardly matter.
&lt;br&gt;&lt;br&gt;Running some actual benchmarks (e.g., with the hamlet benchmark, as is 
&lt;br&gt;reported in the above messages) provides real evidence; &amp;quot;I imagine...&amp;quot; and 
&lt;br&gt;&amp;quot;I would contend...&amp;quot; are good hypotheses, but are not experiments.
&lt;br&gt;&lt;br&gt;&amp;gt; So to sum up: could I just kill these off and use a binary search?
&lt;br&gt;&lt;br&gt;I see that such a patch has already been committed, but it would be nice 
&lt;br&gt;to report the actual runtime (and profiling results) impact of such a 
&lt;br&gt;change.
&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19713351&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---Dev-f14124.html&quot; embed=&quot;fixTarget[14124]&quot; target=&quot;_top&quot; &gt;MLton - Dev&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/getText%7BStart%2CEnd%7D-considered-harmful-tp19611687p19713351.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19664926</id>
	<title>Re: bogus warning messages about scope annotations</title>
	<published>2008-09-25T01:09:32Z</published>
	<updated>2008-09-25T01:09:32Z</updated>
	<author>
		<name>John Reppy-2</name>
	</author>
	<content type="html">Upon deeper digging, I realize that I was getting confused between two &amp;nbsp;
&lt;br&gt;different
&lt;br&gt;copies of the source tree (I was editing one that had the annotations, &amp;nbsp;
&lt;br&gt;while compiling
&lt;br&gt;the other). &amp;nbsp;Sorry for the false alarm.
&lt;br&gt;&lt;br&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; - John
&lt;br&gt;&lt;br&gt;On Sep 25, 2008, at 2:16 AM, Wesley W. Terpstra wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Wed, Sep 24, 2008 at 10:38 PM, John Reppy &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19664926&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jhreppy@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Using a fresh version of mlton on Mac OS X, I'm getting messages of &amp;nbsp;
&lt;br&gt;&amp;gt; the form
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Warning: /Users/jhr/Work/ICFPContest08/sml3d/src/glut/glut.sml 413.28.
&lt;br&gt;&amp;gt; &amp;nbsp;Symbol 'glutCreateMenuCB' redeclared as external (previously &amp;nbsp;
&lt;br&gt;&amp;gt; public). This may cause linker errors.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; when the code at lines 412-413 is
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val exportCreateMenu &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= _export &amp;quot;glutCreateMenuCB&amp;quot; private &amp;nbsp;
&lt;br&gt;&amp;gt; cdecl : (int -&amp;gt; unit) -&amp;gt; unit;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val glutCreateMenuCB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= _address &amp;quot;glutCreateMenuCB&amp;quot; &amp;nbsp;
&lt;br&gt;&amp;gt; private : Ptr.t;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; That's strange. I copy and pasted those lines to a file (replacing &amp;nbsp;
&lt;br&gt;&amp;gt; Ptr with MLton.Pointer) and saw no warnings. Can you please provide &amp;nbsp;
&lt;br&gt;&amp;gt; a complete source file which causes these warnings?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I've tried various other annotations instead of private, but the &amp;nbsp;
&lt;br&gt;&amp;gt; message is
&lt;br&gt;&amp;gt; consistent. &amp;nbsp;In fact, it turns out that one can put any identifier &amp;nbsp;
&lt;br&gt;&amp;gt; as an annoation and
&lt;br&gt;&amp;gt; still get the same message. &amp;nbsp;E.g.,
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val exportCreateMenu &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= _export &amp;quot;glutCreateMenuCB&amp;quot; bogus &amp;nbsp;
&lt;br&gt;&amp;gt; cdecl : (int -&amp;gt; unit) -&amp;gt; unit;
&lt;br&gt;&amp;gt; &amp;nbsp; &amp;nbsp;val glutCreateMenuCB &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;= _address &amp;quot;glutCreateMenuCB&amp;quot; bogus : &amp;nbsp;
&lt;br&gt;&amp;gt; Ptr.t;
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; The default visibility is public for export and external for &amp;nbsp;
&lt;br&gt;&amp;gt; address. So that's not unexpected as bogus is invalid and didn't &amp;nbsp;
&lt;br&gt;&amp;gt; override the defaults. I assume you also got errors that 'bogus' was &amp;nbsp;
&lt;br&gt;&amp;gt; unrecognized in this case?
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; I did not get this warning on the r6841 version on my windows box at &amp;nbsp;
&lt;br&gt;&amp;gt; work.
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; This check did not exist in r6841.
&lt;br&gt;&amp;gt;
&lt;/div&gt;&lt;br&gt;&lt;br&gt;_______________________________________________
&lt;br&gt;MLton-user mailing list
&lt;br&gt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19664926&amp;i=1&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;MLton-user@...&lt;/a&gt;
&lt;br&gt;&lt;a href=&quot;http://mlton.org/mailman/listinfo/mlton-user&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;http://mlton.org/mailman/listinfo/mlton-user&lt;/a&gt;&lt;br&gt;&lt;p&gt;From forum: &lt;a href=&quot;http://www.nabble.com/MLton---User-f14125.html&quot; embed=&quot;fixTarget[14125]&quot; target=&quot;_top&quot; &gt;MLton - User&lt;/a&gt;&lt;/p&gt;</content>
	<link rel="alternate" type="text/html" href="http://www.nabble.com/bogus-warning-messages-about-scope-annotations-tp19657487p19664926.html" />
</entry>

<entry>
	<id>tag:www.nabble.com,2006:post-19663574</id>
	<title>Re: bogus warning messages about scope annotations</title>
	<published>2008-09-24T23:06:34Z</published>
	<updated>2008-09-24T23:06:34Z</updated>
	<author>
		<name>John Reppy-2</name>
	</author>
	<content type="html">&lt;br&gt;On Sep 25, 2008, at 2:16 AM, Wesley W. Terpstra wrote:
&lt;br&gt;&lt;div class='shrinkable-quote'&gt;&lt;br&gt;&amp;gt; On Wed, Sep 24, 2008 at 10:38 PM, John Reppy &amp;lt;&lt;a href=&quot;http://www.nabble.com/user/SendEmail.jtp?type=post&amp;post=19663574&amp;i=0&quot; target=&quot;_top&quot; rel=&quot;nofollow&quot;&gt;jhreppy@...&lt;/a&gt;&amp;gt; wrote:
&lt;br&gt;&amp;gt; Using a fresh version of mlton on Mac OS X, I'm getting messages of &amp;nbsp;
&lt;br&gt;&amp;gt; the form
&lt;br&gt;&amp;gt;
&lt;br&gt;&amp;gt; Warning: /Users/jhr/Work/ICFPContest08/sml3d/src/glut/glut.sml 413.28.
&lt;br&gt;&amp;gt; &amp;nbsp;Symbol 'glutCreateMenuCB' redeclared as external (previously &amp;nbsp;
&lt;br&gt;&