コード例 #1
0
bool vframeArray::structural_compare(JavaThread* thread, GrowableArray<compiledVFrame*>* chunk) {
  if (owner_thread() != thread) return false;
  int index = 0;
#if 0 // FIXME can't do this comparison

  // Compare only within vframe array.
  for (deoptimizedVFrame* vf = deoptimizedVFrame::cast(vframe_at(first_index())); vf; vf = vf->deoptimized_sender_or_null()) {
    if (index >= chunk->length() || !vf->structural_compare(chunk->at(index))) return false;
    index++;
  }
  if (index != chunk->length()) return false;
#endif

  return true;
}
コード例 #2
0
 index_t linear_to_index(long lind) const {
     return lind + first_index();
 }
コード例 #3
0
 /// Flatten the index in the positive linear index for memory storage (almost trivial here).
 long index_to_linear(index_t ind) const {
     return ind - first_index();
 }
コード例 #4
0
ファイル: likelihood.c プロジェクト: Pankajumn/disambig
int analyze(DB* stat_db, DBT* block_dbt, db_recno_t dup_count, DB* ldb, DB* primary){
	DBT lkey, lval;
	DBT first_pkey, second_pkey;
	DBT rec1, rec2;
    DBT sd_dbt, sk_dbt;
	DBC* lcur, *pcur1, *pcur2;
    stat_data sd;
    void *old1, *old2;
	double match_n, nonmatch_n;
	u_int32_t match_d, nonmatch_d, all;
	
	match_n = nonmatch_n = match_d = nonmatch_d = 0;
	
	DBT_CLEAR(lkey);
	DBT_CLEAR(lval);
	DBT_CLEAR(first_pkey);
	DBT_CLEAR(second_pkey);
    DBT_CLEAR(rec1);
    DBT_CLEAR(rec2);
    DBT_CLEAR(sd_dbt);
    DBT_CLEAR(sk_dbt);
	
	ldb->cursor(ldb, NULL, &lcur, 0);
    primary->cursor(primary, NULL, &pcur1, 0);
    primary->cursor(primary, NULL, &pcur2, 0);
	
	while(DB_NOTFOUND != lcur->get(lcur, &lkey, &lval, DB_NEXT)){
		first_index(NULL, &lkey, &lval, &first_pkey);
		second_index(NULL, &lkey, &lval, &second_pkey);

        old1 = first_pkey.data;
        old2 = second_pkey.data;

		pcur1->get(pcur1, &first_pkey, &rec1, DB_SET);
		pcur2->get(pcur2, &second_pkey, &rec2, DB_SET);

        if(tagcmp((DbRecord*)rec1.data, (DbRecord*)rec2.data)==0){
			match_n += *(double*)lval.data;
			++match_d;
		}
		else {
			nonmatch_n += *(double*)lval.data;
			++nonmatch_d;
		}

        free(old1);
        free(old2);
	}

    lcur->close(lcur);
    pcur1->close(pcur1);
    pcur2->close(pcur2);

    //open likelihood database
    match_n += dup_count;
    match_d += dup_count;
    sd.density = (match_n+nonmatch_n)/(match_d+nonmatch_d);
    sd.precision = match_n/match_d;
    sd.recall = nonmatch_n/nonmatch_d;
    sd.match_n = match_n;
    sd.nonmatch_n = nonmatch_n;
    sd.match_d = match_d;
    sd.nonmatch_d = nonmatch_d;
    sd.Pr_M = PR_M;
    sd.Pr_T = PR_T;

    sd_dbt.data = &sd;
    sd_dbt.size = sizeof(stat_data);

    stat_db->put(stat_db, NULL, block_dbt, &sd_dbt, DB_NOOVERWRITE);

    //create block tag, PR_M, PR_T stuct
    //create stat struct
    //write key-data pair to bdb
    //later on, index the database by block, Pr_M, and Pr_T
	
	//printf("density: %g, precision: %g of %lu, recall: %g of %lu\n", (match_n+nonmatch_n)/(match_d+nonmatch_d), match_n/match_d, match_d, 1-nonmatch_n/nonmatch_d, nonmatch_d);
	return(0);
}