예제 #1
0
/* string -> ExecutionEngine.t -> llvalue option */
CAMLprim value llvm_ee_find_function(value Name, LLVMExecutionEngineRef EE) {
  CAMLparam1(Name);
  CAMLlocal1(Option);
  LLVMValueRef Found;
  if (LLVMFindFunction(EE, String_val(Name), &Found))
    CAMLreturn(Val_unit);
  Option = alloc(1, 0);
  Field(Option, 0) = Val_op(Found);
  CAMLreturn(Option);
}
예제 #2
0
파일: gc_ctrl.c 프로젝트: vouillon/ocaml
/* Check that [v]'s header looks good.  [v] must be a block in the heap. */
static void check_head (value v)
{
  Assert (Is_block (v));
  Assert (Is_in_heap (v));

  Assert (Wosize_val (v) != 0);
  Assert (Color_hd (Hd_val (v)) != Caml_blue);
  Assert (Is_in_heap (v));
  if (Tag_val (v) == Infix_tag){
    int offset = Wsize_bsize (Infix_offset_val (v));
    value trueval = Val_op (&Field (v, -offset));
    Assert (Tag_val (trueval) == Closure_tag);
    Assert (Wosize_val (trueval) > offset);
    Assert (Is_in_heap (&Field (trueval, Wosize_val (trueval) - 1)));
  }else{
    Assert (Is_in_heap (&Field (v, Wosize_val (v) - 1)));
  }
  if (Tag_val (v) ==  Double_tag){
    Assert (Wosize_val (v) == Double_wosize);
  }else if (Tag_val (v) == Double_array_tag){
    Assert (Wosize_val (v) % Double_wosize == 0);
  }
}
예제 #3
0
/* t -> 'a */
CAMLprim value llvm_genericvalue_as_pointer(value GenVal) {
  return Val_op(LLVMGenericValueToPointer(Genericvalue_val(GenVal)));
}