Skip to content

Instantly share code, notes, and snippets.

@bmyerz
Last active August 29, 2015 14:19
Show Gist options
  • Save bmyerz/4ac060c35f9dbd5f64fb to your computer and use it in GitHub Desktop.
Save bmyerz/4ac060c35f9dbd5f64fb to your computer and use it in GitHub Desktop.
code that is candidate for object flattening optimization
// pgas pseudocode, borrowing syntax from Chapel and UPC
struct global_ptr_string {
int len;
global const char* str;
global_ptr_string(...) { ... }
}
const global_ptr_string x(...);
on(10) {
for (int i=0; x.str[i]!='\0'; i++) {
printchar (x.str[i])
}
print ("\n")
}
@bmyerz
Copy link
Author

bmyerz commented Apr 16, 2015

ok updated with more const to make it easier.

anyway, shouldn't we be considering a SC for DRF model?

@bholt
Copy link

bholt commented Apr 16, 2015

making it const should do the trick (assuming you can trust const, unlike in C++). ;)

anyway, shouldn't we be considering a SC for DRF model?

sure, but you're proposing moving a load up, so you have to at least prove nothing in your on block modifies it between where you hoisted it.

@bholt
Copy link

bholt commented Apr 16, 2015

this is exactly the kind of thing I remember wishing Chapel would do for me. That or just make const things available everywhere so I didn't have to worry about where they lived.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment