This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int main(int argc, char **argv) { | |
ARGC = argc; | |
ARGV = argv; | |
int result = harlan_main(); | |
printf("JITTIME: %f\n", double(g_memtime) / 1e9); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(generate [3 3] (lambda (x y) (* (get A x) (get B y)))) | |
<=> | |
(let ((As (backpermute [3 3] (lambda (x y) x) A)) | |
(Bs (backpermute [3 3] (lambda (x y) y) B))) | |
(zipWith (*) As Bs)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
|(remove-closures | |
(closures | |
((lambda-type_802 | |
dispatch_803 | |
(closure lambda_233 (int) -> (adt point3f-t_164)) | |
(lambda_801 | |
(__153) | |
(let ([x_154 float | |
(call | |
(var (fn ((ptr FILE)) -> float) file-read-float) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn trans_spawn(&ast::spawn_dom dom, &option::t[str] name, | |
&@ast::expr func, &vec[@ast::expr] args, | |
&ast::ann ann) -> result { | |
// Make the task name | |
let str tname = alt(name) { | |
case(none) { | |
auto argss = vec::map(common::expr_to_str, args); | |
#fmt("%s(%s)", | |
common::expr_to_str(func), | |
str::connect(argss, ", ")); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
let port[int] po = port(); | |
let chan[int] ch = chan(po); | |
auto r <- po; | |
log_err r; | |
ch <| 42; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std; | |
import std::vec; | |
fn main() { | |
auto v = [1, 2]; | |
auto i = vec::len[int](v) - 1u; | |
while (i != 0u) { | |
log_err i; | |
log_err v.(i); | |
i -= 1u; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs | |
index 3009478..64a6bcb 100644 | |
--- a/src/comp/middle/trans.rs | |
+++ b/src/comp/middle/trans.rs | |
@@ -5562,7 +5562,7 @@ fn trans_expr(&@block_ctxt cx, &@ast::expr e) -> result { | |
} | |
case (ast::expr_spawn(?dom, ?name, ?func, ?args, ?ann)) { | |
- ret trans_spawn(dom, name, func, args, ann); | |
+ ret trans_spawn(cx, dom, name, func, args, ann); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs | |
index db389fc..3e8447a 100644 | |
--- a/src/comp/middle/trans.rs | |
+++ b/src/comp/middle/trans.rs | |
@@ -5929,7 +5929,10 @@ fn trans_spawn(&@block_ctxt cx, | |
// | |
// 3. Fill the tuple with the arguments we evaluated. | |
// | |
- // 4. Pass a pointer to the spawnee function and the argument tuple to | |
+ // 3.5. Generate a wrapper function that takes the tuple and unpacks it to |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn mk_spawn_wrapper(&@block_ctxt cx, | |
&str tname, | |
&@ast::expr func, | |
&ty::t args_ty) -> result { | |
auto llmod = cx.fcx.lcx.ccx.llmod; | |
let TypeRef args_ty_tref = type_of(cx.fcx.lcx.ccx, cx.sp, args_ty); | |
let TypeRef wrapper_fn_type = T_fn([args_ty_tref], T_void()); | |
log_err #fmt("wrapper args type", | |
ty_str(cx.fcx.lcx.ccx.tn, args_ty_tref)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn mk_spawn_wrapper(&@block_ctxt cx, | |
&str tname, | |
&@ast::expr func, | |
&ty::t args_ty) -> result { | |
auto llmod = cx.fcx.lcx.ccx.llmod; | |
let TypeRef args_ty_tref = type_of(cx.fcx.lcx.ccx, cx.sp, args_ty); | |
//let TypeRef wrapper_fn_type = T_fn([args_ty_tref], T_void()); | |
let TypeRef wrapper_fn_type = | |
type_of_fn(cx.fcx.lcx.ccx, cx.sp, ast::proto_fn, |
OlderNewer