static void test(void)
{
 mps_space_t space;
 mps_thr_t thread;
 mps_addr_t a[32];
 mps_root_t root;

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 cdie(mps_root_create_fmt(&root, space, MPS_RANK_AMBIG, 0, 
                      fmtscan, a, (mps_addr_t)(((char *)(&a[0]))+1)),
      "root create");

}
Beispiel #2
0
static void test(void)
{
 mps_arena_t arena;
 mps_thr_t thread;
 mps_addr_t a[32];
 mps_root_t root;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(mps_root_create_fmt(&root, arena, mps_rank_ambig(), 0, 
                      fmtscan, &a[10], &a[0]),
      "root create");

}
Beispiel #3
0
static void test(void)
{
 mps_arena_t arena;
 mps_thr_t thread;
 mps_root_t root;
 mps_addr_t a[30];

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(mps_root_create_table(&root, arena,
        mps_rank_ambig(), 0, a, (size_t) 0),
      "root create");

}
static void test(void)
{
 mps_space_t space;
 mps_thr_t thread;
 mps_root_t root;
 mps_addr_t a[30];

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 cdie(mps_root_create_table(&root, space,
        MPS_RANK_AMBIG, 0, a, (size_t) -32),
      "root create");

}
Beispiel #5
0
static void test(void)
{
 mps_arena_t arena;
 mps_pool_t pool;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(
  mps_pool_create(
     &pool, arena, mps_class_mv(),
     (size_t) 32, (size_t) 0, (size_t) 32),
  "create pool");

 mps_pool_destroy(pool);
 mps_arena_destroy(arena);
}
Beispiel #6
0
static void test(void)
{
 mps_arena_t arena;
 mps_pool_t pool;
 size_t extendBy;
 size_t avgSize;
 size_t maxSize;

 extendBy = (size_t) 4096;
 avgSize  = (size_t) 32;
 maxSize  = (size_t) 65536;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

/*
 cdie(
  mps_pool_create(&pool, arena, mps_class_mv(),
   extendBy, avgSize, maxSize),
  "create pool");
*/

 mps_pool_destroy(pool);
 comment("Destroyed pool.");

 mps_arena_destroy(arena);
 comment("Destroyed arena.");
}
Beispiel #7
0
static void test(void *stack_pointer)
{
 mps_arena_t arena;
 mps_thr_t thread;
 mps_root_t root;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(mps_root_create_reg(&root, arena, mps_rank_ambig(),
                      HIGHBIT_INT, 
                      thread, mps_stack_scan_ambig, stack_pointer, 0),
      "root create");

}
static void test(void)
{
 mps_space_t space;

 cdie(mps_space_create(&space), "create space");
 mps_space_destroy(space);
}
Beispiel #9
0
static void test(void *stack_pointer)
{
 mps_pool_t pool = malloc(4096);
 mps_addr_t obj;

 cdie(mps_alloc(&obj, pool, 152), "allocate");
}
static void test(void)
{
 mps_space_t space;
 mps_thr_t thread;
 mps_addr_t a[32];
 mps_root_t root;

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 cdie(mps_root_create_fmt(&root, space, MPS_RANK_AMBIG, HIGHBIT_INT, 
                      fmtscan, a, &a[32]),
      "root create");

}
Beispiel #11
0
static void test(void)
{
 mps_arena_t arena;
 mps_fmt_t format;
 mps_fmt_A_s fmtA;

 arena=malloc(64);

 /* cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
 */ 
 fmtA.align = (mps_align_t) 1;
 fmtA.scan  = &zilch;
 fmtA.skip  = &myskip;
 fmtA.copy  = &zilch;
 fmtA.fwd   = &zilch;
 fmtA.isfwd = &zilch;
 fmtA.pad   = &zilch;

 cdie(
  mps_fmt_create_A(&format, arena, &fmtA), 
  "create format");

 mps_arena_destroy(arena);
 comment("Destroy arena.");
}
static void test(void)
{
 mps_space_t space;
 mps_pool_t pool;
 size_t extendBy;
 size_t avgSize;
 size_t maxSize;

 extendBy = (size_t) 4096;
 avgSize  = (size_t) 32;
 maxSize  = (size_t) 65536;

/* cdie(mps_space_create(&space), "create space");
*/
 space=malloc(64);

 cdie(
  mps_pool_create(&pool, space, mps_class_mv(),
   extendBy, avgSize, maxSize),
  "create pool");

 mps_pool_destroy(pool);
 comment("Destroyed pool.");

 mps_space_destroy(space);
 comment("Destroyed space.");
}
Beispiel #13
0
static void test(void *stack_pointer)
{
 mps_arena_t arena;
 mps_pool_t pool;
 mps_thr_t thread;
 mps_root_t root;

 mps_chain_t chain;
 mps_fmt_t format;
 mps_ap_t ap;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(mps_root_create_thread(&root, arena, thread, stack_pointer), "thread root");
 cdie(
  mps_fmt_create_A(&format, arena, &fmtA),
  "create format");

 cdie(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");

 cdie(
  mps_pool_create(&pool, arena, mps_class_amc(), format, chain),
  "create pool");

 cdie(
  mps_ap_create(&ap, pool, mps_rank_exact()),
  "create ap");

{
 mps_addr_t p;

 cdie(mps_reserve(&p, ap, 0x100), "Reserve: ");
}

 mps_ap_destroy(ap);
 comment("Destroyed ap.");

 mps_pool_destroy(pool);
 comment("Destroyed pool.");

 mps_fmt_destroy(format);
 comment("Destroyed format.");

 mps_chain_destroy(chain);
 comment("Destroyed chain.");

 mps_root_destroy(root);
 comment("Destroyed root.");

 mps_thread_dereg(thread);
 comment("Deregistered thread.");

 mps_arena_destroy(arena);
 comment("Destroyed arena.");
}
static void report(mps_arena_t arena)
{
  static int nCollections = 0;
  mps_message_type_t type;
    
  while(mps_message_queue_type(&type, arena)) {
    mps_message_t message;

    cdie(mps_message_get(&message, arena, type), "message get");

    switch(type) {
    /* @@@@ is using these macros in a switch supported? */
    case mps_message_type_gc():
      {
	size_t live, condemned, not_condemned;

	live = mps_message_gc_live_size(arena, message);
	condemned = mps_message_gc_condemned_size(arena, message);
	not_condemned = mps_message_gc_not_condemned_size(arena, message);

	printf("\nCollection %d finished:\n", ++nCollections);
	printf("live %lu\n", (unsigned long)live);
	printf("condemned %lu\n", (unsigned long)condemned);
	printf("not_condemned %lu\n", (unsigned long)not_condemned);

	if(condemned > (gen1SIZE + gen2SIZE + (size_t)128) * 1024) {
	  /* When condemned size is larger than could happen in a gen 2
	   * collection (discounting ramps, natch), guess that was a dynamic
	   * collection, and reset the commit limit, so it doesn't run out. */
	  die(mps_arena_commit_limit_set(arena, 2 * testArenaSIZE),
	    "set limit");
	}
      }
      break;
    case mps_message_type_gc_start():
      printf("\nCollection started.  Because:\n");
      printf("%s\n", mps_message_gc_start_why(arena, message));

      break;
    default:
      cdie(0, "unknown message type");
    }
    mps_message_discard(arena, message);
  }

  return;
}
static void test(void)
{
 mps_space_t space;
 mps_space_t space1;
 mps_ld_s ld;

 cdie(mps_space_create(&space), "create space");
 cdie(mps_space_create(&space1), "create space 1");

 mps_ld_reset(&ld, space);
 comment("Reset ld."); 

 report("isstale", "%d", mps_ld_isstale(&ld, space1, &space));

 mps_space_destroy(space);
 comment("Destroyed space.");
}
static void test(void)
{
 mps_space_t space;
 mps_ld_s ld;
 mps_thr_t thread;
 mps_addr_t p;

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 mps_ld_reset(&ld, space);

 mps_ld_add(&ld, space, &p);

 mps_ld_isstale(&ld, UNALIGNED, &p);
}
Beispiel #17
0
static void test(void *stack_pointer)
{
 mps_arena_t arena;
 mps_pool_t pool;
 mps_addr_t obj;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_pool_create_k(&pool, arena, mps_class_mvff(), mps_args_none), "pool");

 cdie(mps_alloc(&obj, pool, 152), "allocate");

 mps_free(pool, obj, 512);

 mps_pool_destroy(pool);
 mps_arena_destroy(arena);
}
Beispiel #18
0
static void test(void)
{
 mps_arena_t arena;
 mps_ld_s ld;
 mps_thr_t thread;
 mps_addr_t p;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 mps_ld_reset(&ld, arena);

 mps_ld_add(&ld, arena, &p);

 mps_ld_isstale(NULL, arena, &p);
}
Beispiel #19
0
static void test(void)
{
 mps_arena_t arena;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE),
      "Create arena");
 mps_arena_destroy(NULL);
}
Beispiel #20
0
static void test(void *stack_pointer)
{
 mps_arena_t arena;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE),
      "Create arena");
 mps_arena_destroy(UNALIGNED);
}
Beispiel #21
0
static void test(void *stack_pointer)
{
 mps_arena_t arena;
 mps_pool_t pool;
 mps_thr_t thread;
 mps_root_t root;

 mps_chain_t chain;
 mps_fmt_t format;
 mps_ap_t ap;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(mps_root_create_thread(&root, arena, thread, stack_pointer), "thread root");
 cdie(
  mps_fmt_create_A(&format, arena, &fmtA),
  "create format");

 formatcomments = 0;

 cdie(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");

 cdie(
  mps_pool_create(&pool, arena, mps_class_amc(), format, chain),
  "create pool");

 cdie(
  mps_ap_create(&ap, UNALIGNED, mps_rank_exact()),
  "create ap");

}
Beispiel #22
0
static void test(void)
{
 mps_arena_t arena;
 mps_pool_t pool;

 mps_fmt_t format;
 mps_fmt_A_s fmtA;
 mps_ap_t ap;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 fmtA.align = (mps_align_t) 1;
 fmtA.scan  = &zilch;
 fmtA.skip  = &myskip;
 fmtA.copy  = &zilch;
 fmtA.fwd   = &zilch;
 fmtA.isfwd = &zilch;
 fmtA.pad   = &zilch;

 cdie(
  mps_fmt_create_A(&format, arena, &fmtA),
  "create format");

 cdie(
  mps_pool_create(&pool, arena, mps_class_lo(), format),
  "create pool");

/*
 cdie(
  mps_ap_create(&ap, pool, mps_rank_exact()),
  "create ap");
*/

 mps_ap_destroy(ap);
 comment("Destroyed ap.");

 mps_pool_destroy(pool);
 comment("Destroyed pool.");

 mps_fmt_destroy(format);
 comment("Destroyed format.");

 mps_arena_destroy(arena);
 comment("Destroyed arena.");
}
Beispiel #23
0
static void test(void *stack_pointer)
{
 mps_arena_t arena;
 mps_pool_t pool;
 mps_thr_t thread;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(
  mps_pool_create(
     &pool, arena, mps_class_mfs(), (size_t) 32, (size_t) 33), 
  "create pool");

 mps_pool_destroy(pool);

}
Beispiel #24
0
static void test(void)
{
 mps_arena_t arena;
 mps_arena_t arena1;
 mps_ld_s ld;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");
 cdie(mps_arena_create(&arena1), "create arena 1");

 mps_ld_reset(&ld, arena);
 comment("Reset ld."); 

 mps_ld_add(&ld, arena1, &arena);
 comment("Added to ld.");

 mps_arena_destroy(arena);
 comment("Destroyed arena.");
}
static void test(void)
{
 mps_space_t space;
 mps_thr_t thread;

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 mps_thread_dereg(thread);
 comment("Deregistered thread.");

 mps_thread_dereg(thread);
 comment("Deregistered thread again.");

 mps_space_destroy(space);
 comment("Destroyed space.");
}
Beispiel #26
0
static void test(void)
{
 mps_arena_t arena;
 mps_thr_t thread;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 mps_arena_destroy(arena);
 comment("Destroyed arena.");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 mps_thread_dereg(thread);
 comment("Deregistered thread.");

 mps_arena_destroy(arena);
 comment("Destroyed arena.");
}
static void test(void)
{
 mps_space_t space;
 mps_pool_t pool;
 mps_thr_t thread;

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 cdie(
  mps_pool_create(
     &pool, space, mps_class_mfs(), (size_t) 128, (size_t) 0), 
  "create pool");

 mps_pool_destroy(pool);

}
static void test(void)
{
 mps_space_t space;
 mps_pool_t pool;
 mps_thr_t thread;
 mps_root_t root;

 mps_fmt_t format;
 mps_ap_t ap;
 mps_addr_t p;
 mps_addr_t q;

 cdie(mps_space_create(&space), "create space");

 cdie(mps_thread_reg(&thread, space), "register thread");

 cdie(
  mps_root_create_reg(&root, space, MPS_RANK_AMBIG, 0, thread,
   mps_stack_scan_ambig, stackpointer, 0),
  "create root");

 cdie(
  mps_fmt_create_A(&format, space, &fmtA),
  "create format");

 cdie(
  mps_pool_create(&pool, space, mps_class_amc(), format),
  "create pool");

 cdie(
  mps_ap_create(&ap, pool, MPS_RANK_EXACT),
  "create ap");

 do
 {
  cdie(mps_reserve(&p, ap, 0x100), "Reserve: ");
  q = (mps_addr_t) ((char *)p);
 }
 while (!mps_commit(ap, q, 0x110));
 comment("Committed.");

 mps_ap_destroy(ap);
 comment("Destroyed ap.");

 mps_pool_destroy(pool);
 comment("Destroyed pool.");

 mps_fmt_destroy(format);
 comment("Destroyed format.");

 mps_root_destroy(root);
 comment("Destroyed root.");

 mps_thread_dereg(thread);
 comment("Deregistered thread.");

 mps_space_destroy(space);
 comment("Destroyed space.");
}
static void test(void)
{
 mps_pool_t poolamc;
 mps_thr_t thread;
 mps_root_t root0, root1;

 mps_fmt_t format;
 mps_chain_t chain;
 mps_ap_t apamc;

 mycell *a;

 long int j;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), (size_t)1024*1024*30),
      "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");
 cdie(mps_root_create_reg(&root0, arena, MPS_RANK_AMBIG, 0, thread,
                          mps_stack_scan_ambig, stackpointer, 0),
      "create root");
 
 cdie(mps_root_create_table(&root1, arena, MPS_RANK_AMBIG, 0,
                            (mps_addr_t *)&exfmt_root, 1),
      "create table root");

 cdie(mps_fmt_create_A(&format, arena, &fmtA),
      "create format");

 cdie(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");

 die(mmqa_pool_create_chain(&poolamc, arena, mps_class_amc(), format, chain),
     "create pool");

 cdie(mps_ap_create(&apamc, poolamc, MPS_RANK_EXACT),
      "create ap");

 /* alloc lots in an AMC pool; it should be collected away */

 for(j=0; j<1000; j++) {
  a = allocdumb(apamc, 1024ul*1024, MPS_RANK_EXACT);
 }

 /* (total allocated is 1000 M) */

 mps_root_destroy(root0);
 mps_root_destroy(root1);
 comment("Destroyed roots.");

 mps_ap_destroy(apamc);
 mps_pool_destroy(poolamc);
 mps_chain_destroy(chain);
 mps_fmt_destroy(format);
 mps_thread_dereg(thread);
 mps_arena_destroy(arena);
 comment("Destroyed arena.");

 pass();
}
Beispiel #30
0
static void test(void)
{
 mps_arena_t arena;
 mps_pool_t pool;
 mps_thr_t thread;
 mps_root_t root;

 mps_chain_t chain;
 mps_fmt_t format;
 mps_ap_t ap;

 mps_addr_t p;

 int i;

 cdie(mps_arena_create(&arena, mps_arena_class_vm(), mmqaArenaSIZE), "create arena");

 cdie(mps_thread_reg(&thread, arena), "register thread");

 cdie(
  mps_root_create_reg(&root, arena, mps_rank_ambig(), 0, thread,
   mps_stack_scan_ambig, stackpointer, 0),
  "create root");

 cdie(
  mps_fmt_create_A(&format, arena, &fmtA),
  "create format");

 cdie(mps_chain_create(&chain, arena, genCOUNT, testChain), "chain_create");

 cdie(
  mps_pool_create(&pool, arena, mps_class_amc(), format, chain),
  "create pool");

 cdie(
  mps_ap_create(&ap, pool, mps_rank_exact()),
  "create ap");

 for(i=1; i<1000; i++)
 {
  do
  { die(mps_reserve(&p, ap, OBJSIZE), "Reserve: ");
  }
  while (!mps_commit(ap, p, OBJSIZE));
  comment("%i at %p", i, p);
  comment("%i objects of 10 megabytes each allocated", i);
 }

 mps_arena_park(arena);
 mps_ap_destroy(ap);
 mps_pool_destroy(pool);
 mps_fmt_destroy(format);
 mps_chain_destroy(chain);
 mps_root_destroy(root);
 mps_thread_dereg(thread);
 mps_arena_destroy(arena);

}