예제 #1
0
value hh_hash_used_slots() {
  CAMLparam0();
  caml_failwith("'hh_hash_used_slots` is not implemented in `hh_shared.c`.");
  CAMLreturn(Val_unit);
}
예제 #2
0
CAMLprim value weight_to_int(value v)
{
  CAMLparam0();
  CAMLreturn(Val_int(fcWeight[Int_val(v)]));
}
예제 #3
0
파일: hh_shared.c 프로젝트: adelgado/flow
/* Expose so we can display diagnostics */
CAMLprim value hh_heap_size(void) {
  CAMLparam0();
  CAMLreturn(Val_long(used_heap_size()));
}
예제 #4
0
CAMLprim value pattern_copy(value pat)
{
  CAMLparam0();
  CAMLreturn(caml_copy_pattern(FcPattern_val(pat)));
}
예제 #5
0
CAMLprim value slant_to_int(value v)
{
  CAMLparam0();
  CAMLreturn(Val_int(fcSlant[Int_val(v)]));
}
예제 #6
0
CAMLprim value win_pipe_out (value unit) {
  CAMLparam0();
  CAMLreturn (win_pipe (0, FILE_FLAG_OVERLAPPED));
}
예제 #7
0
value caml_copy_pattern(FcPattern *pat)
{
  CAMLparam0();
  CAMLlocal1(res);
  CAMLreturn(caml_box_fcpattern(FcPatternDuplicate(pat)));
}
예제 #8
0
CAMLprim value caml_picosat_reset(value unit) {
    CAMLparam0 ();
    picosat_reset();
    CAMLreturn(Val_unit);
}
예제 #9
0
CAMLprim value caml_picosat_enable_trace(value unit) {
    CAMLparam0 ();
    picosat_enable_trace_generation();
    CAMLreturn(Val_unit);
}
예제 #10
0
CAMLprim value
get_ifnamsiz()
{
  CAMLparam0();
  CAMLreturn(Val_int(IFNAMSIZ));
}
예제 #11
0
파일: uwt_stubs_base.c 프로젝트: djs55/uwt
UWT_LOCAL void
uwt__gr_enlarge__(void)
{
  CAMLparam0();
  CAMLlocal1(nroot);
  cb_t i;
  cb_t * t;
  if ( uwt__global_caml_root == Val_unit ){
    enum { AR_INIT_SIZE = 2};
    nroot = caml_alloc(GR_ROOT_INIT_SIZE,0);
    for ( i = 0 ; i < GR_ROOT_INIT_SIZE ; ++i ){
      Field(nroot,i) = Val_unit;
    }
    uwt__global_caml_root = caml_alloc_small(AR_INIT_SIZE,0);
    Field(uwt__global_caml_root,0) = nroot;
    for ( i = 1 ; i < AR_INIT_SIZE ; ++i ){
      Field(uwt__global_caml_root,i) = Val_unit;
    }
    t = malloc(AR_INIT_SIZE * GR_ROOT_INIT_SIZE * sizeof(*t));
    if ( t == NULL ){
      caml_raise_out_of_memory();
    }
    for ( i = 0; i < GR_ROOT_INIT_SIZE; ++i ){
      t[i] = i;
    }
    uwt__global_caml_root_free_pos = t;
    uwt__global_caml_root_size = GR_ROOT_INIT_SIZE;
    caml_register_generational_global_root(&uwt__global_caml_root);
  }
  else {
    const cb_t ri = (uwt__global_caml_root_size + (GR_ROOT_INIT_SIZE - 1))
      / GR_ROOT_INIT_SIZE;
    const size_t ar_size = Wosize_val(uwt__global_caml_root);
    const cb_t nroot_size =
      uwt__global_caml_root_size + GR_ROOT_INIT_SIZE;
    if ( uwt__global_caml_root_size > nroot_size ){
      caml_failwith("too many lwt threads waiting for i/o");
    }
    if ( ri >= ar_size ){
      uint64_t cn_size = ar_size * (uint64_t)(2 * GR_ROOT_INIT_SIZE);
      if ( cn_size > UINT_MAX ){
        cn_size = UINT_MAX;
      }
      nroot = caml_alloc(ar_size*2,0);
      for ( i = 0 ; i < ar_size ; ++i ){
        Store_field(nroot,i,Field(uwt__global_caml_root,i));
      }
      for ( i = ar_size ; i < ar_size * 2 ; ++i ){
        Field(nroot,i) = Val_unit;
      }
      t = realloc(uwt__global_caml_root_free_pos,cn_size * sizeof(*t));
      if ( t == NULL ){
        caml_raise_out_of_memory();
      }
      caml_modify_generational_global_root(&uwt__global_caml_root,nroot);
      uwt__global_caml_root_free_pos = t;
    }
    nroot = caml_alloc(GR_ROOT_INIT_SIZE,0);
    cb_t j;
    for ( i = 0, j = uwt__global_caml_root_size ;
          i < GR_ROOT_INIT_SIZE ;
          ++i, ++j ){
      Field(nroot,i) = Val_unit;
      uwt__global_caml_root_free_pos[j] = j;
    }
    Store_field(uwt__global_caml_root,ri,nroot);
    uwt__global_caml_root_size = nroot_size;
  }
  CAMLreturn0;
}
예제 #12
0
value hh_dep_slots() {
  CAMLparam0();
  CAMLreturn(Val_long(DEP_SIZE));
}
예제 #13
0
value hh_hash_slots() {
  CAMLparam0();
  CAMLreturn(Val_long(HASHTBL_SIZE));
}
예제 #14
0
value hh_shared_load() {
  CAMLparam0();
  caml_failwith("'hh_shared_load` is not implemented in `hh_shared.c`.");
  CAMLreturn(Val_unit);
}
예제 #15
0
CAMLprim value stub_header_size(void)
{
	CAMLparam0();
	CAMLreturn(Val_int(sizeof(struct xsd_sockmsg)));
}
예제 #16
0
CAMLprim value sunml_cvode_superlumt_init (value vcvode_mem, value vneqs,
				       value vnnz, value vnthreads)
{ CAMLparam0(); CAMLreturn (Val_unit); }
예제 #17
0
CAMLprim value win_pipe_in (value unit) {
  CAMLparam0();
  CAMLreturn (win_pipe (FILE_FLAG_OVERLAPPED, 0));
}
예제 #18
0
CAMLprim value sunml_cvode_superlumt_set_ordering (value vcvode_mem, value vorder)
{ CAMLparam0(); CAMLreturn (Val_unit); }
예제 #19
0
//QObjectCleanupHandler();
value ml_QObjectCleanupHandler_0() {
	CAMLparam0 ();
	CAMLlocal1(qt_obj_instance);
	qt_obj_instance = (value)(new QObjectCleanupHandler());
	CAMLreturn(qt_obj_instance);
}
예제 #20
0
CAMLprim value sunml_cvode_superlumt_get_num_jac_evals(value vcvode_mem)
{ CAMLparam0(); CAMLreturn (Val_unit); }
예제 #21
0
CAMLprim value pattern_make(value props)
{
  CAMLparam0();
  CAMLreturn(caml_box_fcpattern(FcPatternCreate()));
}
예제 #22
0
value alpm_to_caml_strelem ( void * elem )
{
    CAMLparam0();
    CAMLreturn( caml_copy_string( (char *) elem ));
}
예제 #23
0
CAMLprim value default_substitute(value pat)
{
  CAMLparam0();
  FcDefaultSubstitute(FcPattern_val(pat));
  CAMLreturn(Val_unit);
}
예제 #24
0
value alpm_to_caml_dependency ( void * elem )
{
    CAMLparam0();
    CAMLreturn( caml_copy_dependency( (pmdepend_t *) elem ));
}
예제 #25
0
CAMLprim value width_to_int(value v)
{
  CAMLparam0();
  CAMLreturn(Val_int(fcWidth[Int_val(v)]));
}
예제 #26
0
value alpm_to_caml_grpelem ( void * elem )
{
    CAMLparam0();
    CAMLreturn( caml_copy_group( (pmgrp_t *) elem ));
}
예제 #27
0
/* Check the heap structure (if compiled in debug mode) and
   gather statistics; return the stats if [returnstats] is true,
   otherwise return [Val_unit].
*/
static value heap_stats (int returnstats)
{
  CAMLparam0 ();
  intnat live_words = 0, live_blocks = 0,
         free_words = 0, free_blocks = 0, largest_free = 0,
         fragments = 0, heap_chunks = 0;
  char *chunk = caml_heap_start, *chunk_end;
  char *cur_hp, *prev_hp;
  header_t cur_hd;

#ifdef DEBUG
  caml_gc_message (-1, "### O'Caml runtime: heap check ###\n", 0);
#endif

  while (chunk != NULL){
    ++ heap_chunks;
    chunk_end = chunk + Chunk_size (chunk);
    prev_hp = NULL;
    cur_hp = chunk;
    while (cur_hp < chunk_end){
      cur_hd = Hd_hp (cur_hp);
                                           Assert (Next (cur_hp) <= chunk_end);
      switch (Color_hd (cur_hd)){
      case Caml_white:
        if (Wosize_hd (cur_hd) == 0){
          ++ fragments;
          Assert (prev_hp == NULL
                  || Color_hp (prev_hp) != Caml_blue
                  || cur_hp == caml_gc_sweep_hp);
        }else{
          if (caml_gc_phase == Phase_sweep && cur_hp >= caml_gc_sweep_hp){
            ++ free_blocks;
            free_words += Whsize_hd (cur_hd);
            if (Whsize_hd (cur_hd) > largest_free){
              largest_free = Whsize_hd (cur_hd);
            }
          }else{
            ++ live_blocks;
            live_words += Whsize_hd (cur_hd);
#ifdef DEBUG
            check_block (cur_hp);
#endif
          }
        }
        break;
      case Caml_gray: case Caml_black:
        Assert (Wosize_hd (cur_hd) > 0);
        ++ live_blocks;
        live_words += Whsize_hd (cur_hd);
#ifdef DEBUG
        check_block (cur_hp);
#endif
        break;
      case Caml_blue:
        Assert (Wosize_hd (cur_hd) > 0);
        ++ free_blocks;
        free_words += Whsize_hd (cur_hd);
        if (Whsize_hd (cur_hd) > largest_free){
          largest_free = Whsize_hd (cur_hd);
        }
        /* not true any more with big heap chunks
        Assert (prev_hp == NULL
                || (Color_hp (prev_hp) != Caml_blue && Wosize_hp (prev_hp) > 0)
                || cur_hp == caml_gc_sweep_hp);
        Assert (Next (cur_hp) == chunk_end
                || (Color_hp (Next (cur_hp)) != Caml_blue
                    && Wosize_hp (Next (cur_hp)) > 0)
                || (Whsize_hd (cur_hd) + Wosize_hp (Next (cur_hp)) > Max_wosize)
                || Next (cur_hp) == caml_gc_sweep_hp);
        */
        break;
      }
      prev_hp = cur_hp;
      cur_hp = Next (cur_hp);
    }                                          Assert (cur_hp == chunk_end);
    chunk = Chunk_next (chunk);
  }

  Assert (heap_chunks == caml_stat_heap_chunks);
  Assert (live_words + free_words + fragments
          == Wsize_bsize (caml_stat_heap_size));

  if (returnstats){
    CAMLlocal1 (res);

    /* get a copy of these before allocating anything... */
    double minwords = caml_stat_minor_words
                      + (double) Wsize_bsize (caml_young_end - caml_young_ptr);
    double prowords = caml_stat_promoted_words;
    double majwords = caml_stat_major_words + (double) caml_allocated_words;
    intnat mincoll = caml_stat_minor_collections;
    intnat majcoll = caml_stat_major_collections;
    intnat heap_words = Wsize_bsize (caml_stat_heap_size);
    intnat cpct = caml_stat_compactions;
    intnat top_heap_words = Wsize_bsize (caml_stat_top_heap_size);

    res = caml_alloc_tuple (15);
    Store_field (res, 0, caml_copy_double (minwords));
    Store_field (res, 1, caml_copy_double (prowords));
    Store_field (res, 2, caml_copy_double (majwords));
    Store_field (res, 3, Val_long (mincoll));
    Store_field (res, 4, Val_long (majcoll));
    Store_field (res, 5, Val_long (heap_words));
    Store_field (res, 6, Val_long (heap_chunks));
    Store_field (res, 7, Val_long (live_words));
    Store_field (res, 8, Val_long (live_blocks));
    Store_field (res, 9, Val_long (free_words));
    Store_field (res, 10, Val_long (free_blocks));
    Store_field (res, 11, Val_long (largest_free));
    Store_field (res, 12, Val_long (fragments));
    Store_field (res, 13, Val_long (cpct));
    Store_field (res, 14, Val_long (top_heap_words));
    CAMLreturn (res);
  }else{
    CAMLreturn (Val_unit);
  }
}
예제 #28
0
CAMLprim value stub_get_internal_offset(void)
{
	CAMLparam0();
	CAMLreturn(Val_int(XS_RESTRICT));
}
예제 #29
0
파일: hh_shared.c 프로젝트: adelgado/flow
CAMLprim value hh_hash_slots(void) {
  CAMLparam0();
  CAMLreturn(Val_long(hashtbl_size));
}
예제 #30
0
value hh_counter_next() {
  CAMLparam0();
  caml_failwith("'hh_counter_next` is not implemented in `hh_shared.c`.");
  CAMLreturn(Val_unit);
}