Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] View of /tests/new-tests/redundant-assign.diderot
ViewVC logotype

View of /tests/new-tests/redundant-assign.diderot

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5283 - (download) (annotate)
Thu Aug 10 15:54:57 2017 UTC (2 years, 4 months ago) by jhr
File size: 817 byte(s)
adding test for problem with redundant assignments
#version 2

/* redundant-assign.diderot
 *
 * This code is part of the Diderot Project (http://diderot-language.cs.uchicago.edu)
 *
 * COPYRIGHT (c) 2017 The University of Chicago
 * All rights reserved.
 */

// an example that might cause a redundant strand state
// variable assignment

strand S() {
    output vec2 pos = [0, 0];
    vec2 a = [2, 1];	// no shared, so it is safe to remove assigment
    vec2 b = [1, 2];	// shatred, so copy assignments should be preserved

    update {
	vec2 tot = [0, 0];
	foreach (S s in sphere(1.0)) {
	  // make b shared
	    tot += s.b;
	}
	if (|tot| > 2) {
	  /* here the compiler will generate assignments to the strand state
	   * variables.  Ideally, only "b" should be assigned to.
	   */
	    continue;
	}
	a += tot;
	b += tot;
    }

}

create_array { S() | i in 1..1 }

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0