2561
Reorganize layers in preparation for a better, more type-safe implementation of first-class and higher-order recipes.
This commit is contained in:
parent
3063b2393a
commit
94fed20200
30
043new.cc
30
043new.cc
|
@ -182,25 +182,6 @@ recipe main [
|
|||
+mem: array size is 0
|
||||
+mem: storing 1 in location 3
|
||||
|
||||
//: Make sure that each routine gets a different alloc to start.
|
||||
:(scenario new_concurrent)
|
||||
recipe f1 [
|
||||
start-running f2:recipe
|
||||
1:address:number/raw <- new number:type
|
||||
# wait for f2 to complete
|
||||
{
|
||||
loop-unless 4:number/raw
|
||||
}
|
||||
]
|
||||
recipe f2 [
|
||||
2:address:number/raw <- new number:type
|
||||
# hack: assumes scheduler implementation
|
||||
3:boolean/raw <- equal 1:address:number/raw, 2:address:number/raw
|
||||
# signal f2 complete
|
||||
4:number/raw <- copy 1
|
||||
]
|
||||
+mem: storing 0 in location 3
|
||||
|
||||
//: If a routine runs out of its initial allocation, it should allocate more.
|
||||
:(scenario new_overflow)
|
||||
% Initial_memory_per_routine = 2;
|
||||
|
@ -367,17 +348,6 @@ long long int new_mu_string(const string& contents) {
|
|||
return result;
|
||||
}
|
||||
|
||||
//: pass in commandline args as ingredients to main
|
||||
//: todo: test this
|
||||
|
||||
:(after "Update main_routine")
|
||||
Current_routine = main_routine;
|
||||
for (long long int i = 1; i < argc; ++i) {
|
||||
vector<double> arg;
|
||||
arg.push_back(new_mu_string(argv[i]));
|
||||
current_call().ingredient_atoms.push_back(arg);
|
||||
}
|
||||
|
||||
//: stash recognizes strings
|
||||
|
||||
:(scenario stash_string)
|
||||
|
|
|
@ -137,7 +137,6 @@ void run_mu_scenario(const scenario& s) {
|
|||
Trace_stream = new trace_stream;
|
||||
setup();
|
||||
}
|
||||
assert(Routines.empty());
|
||||
vector<recipe_ordinal> tmp = load("recipe scenario-"+s.name+" [ "+s.to_run+" ]");
|
||||
bind_special_scenario_names(tmp.at(0));
|
||||
transform_all();
|
||||
|
|
|
@ -457,3 +457,8 @@ recipe foo a:boolean -> b:number [
|
|||
]
|
||||
+error: main: missing type for x in 'y:number <- foo x'
|
||||
+error: main: failed to find a matching call for 'y:number <- foo x'
|
||||
|
||||
:(before "End Includes")
|
||||
using std::min;
|
||||
using std::max;
|
||||
using std::abs;
|
||||
|
|
|
@ -114,7 +114,14 @@ void run_main(int argc, char* argv[]) {
|
|||
recipe_ordinal r = get(Recipe_ordinal, "main");
|
||||
if (r) {
|
||||
routine* main_routine = new routine(r);
|
||||
// Update main_routine
|
||||
// pass in commandline args as ingredients to main
|
||||
// todo: test this
|
||||
Current_routine = main_routine;
|
||||
for (long long int i = 1; i < argc; ++i) {
|
||||
vector<double> arg;
|
||||
arg.push_back(new_mu_string(argv[i]));
|
||||
current_call().ingredient_atoms.push_back(arg);
|
||||
}
|
||||
run(main_routine);
|
||||
}
|
||||
}
|
||||
|
@ -504,3 +511,23 @@ case LIMIT_TIME: {
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
//:: make sure that each routine gets a different alloc to start
|
||||
|
||||
:(scenario new_concurrent)
|
||||
recipe f1 [
|
||||
start-running f2:recipe
|
||||
1:address:number/raw <- new number:type
|
||||
# wait for f2 to complete
|
||||
{
|
||||
loop-unless 4:number/raw
|
||||
}
|
||||
]
|
||||
recipe f2 [
|
||||
2:address:number/raw <- new number:type
|
||||
# hack: assumes scheduler implementation
|
||||
3:boolean/raw <- equal 1:address:number/raw, 2:address:number/raw
|
||||
# signal f2 complete
|
||||
4:number/raw <- copy 1
|
||||
]
|
||||
+mem: storing 0 in location 3
|
Loading…
Reference in New Issue
Block a user