示例#1
0
extern "C" closure builtin_function_join(OperationArgs& Args)
{
  Args.evaluate_slot_to_reg(0);
  int R = Args.evaluate_slot_to_reg(1);

  return {index_var(0),{R}};
}
示例#2
0
extern "C" closure builtin_function_get_modifiable_index(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int R1 = Args.evaluate_slot_to_reg(0);

  const reg_heap& M = Args.memory();

  assert(is_modifiable(M.access(R1).C.exp));

  return {R1};
}
示例#3
0
extern "C" closure builtin_function_is_modifiable(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int R1 = Args.evaluate_slot_to_reg(0);

  const reg_heap& M = Args.memory();
  if (M.access(R1).C.exp.head().type() == modifiable_type)
    return constructor("Prelude.True",0);
  else
    return constructor("Prelude.False",0);
}
示例#4
0
extern "C" closure builtin_function_is_changeable(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int R1 = Args.evaluate_slot_to_reg(0);

  const reg_heap& M = Args.memory();
  if (M.reg_is_changeable(R1))
    return constructor("Prelude.True",0);
  else
    return constructor("Prelude.False",0);
}
示例#5
0
extern "C" closure builtin_function_set_modifiable_value(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int c = Args.evaluate(0).as_int();

  int R1 = Args.evaluate_slot_to_reg(1);
  int R2 = Args.evaluate_slot_to_reg(2);

  Args.memory().set_reg_value_in_context(R1, {index_var(0),{R2}}, c);

  return constructor("()",0);
}
示例#6
0
extern "C" closure builtin_function_add_parameter(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  const std::string name = Args.evaluate(0).as_<String>();

  int R = Args.evaluate_slot_to_reg(1);

  auto& M = Args.memory();

  M.parameters.push_back({name,R});

  return constructor("()",0);
}
示例#7
0
extern "C" closure builtin_function_get_modifiable_value(OperationArgs& Args)
{
  assert(not Args.evaluate_changeables());

  int c = Args.evaluate(0).as_int();

  int R1 = Args.evaluate_slot_to_reg(1);

  int R2 = Args.memory().get_modifiable_value_in_context(R1, c);

  assert( R2 );

  return {index_var(0),{R2}};
}