void Cyc_Core_rethrow(void *e) {  _rethrow(e); }
Exemplo n.º 2
0
static long Cyc_Callgraph_visit_cg_f1(struct _tuple11 * env,struct Cyc_Absyn_Exp * e) {
  struct Cyc_Absyn_Exp * _T0;
  int * _T1;
  int _T2;
  struct Cyc_Absyn_Var_e_Absyn_Raw_exp_struct * _T3;
  void * _T4;
  int * _T5;
  unsigned int _T6;
  void * _T7;
  struct Cyc_Absyn_Fndecl * _T8;
  void * _T9;
  struct Cyc_Absyn_Vardecl * _TA;
  struct _tuple11 * _TB;
  struct _handler_cons * _TC;
  int _TD;
  struct Cyc_Set_Set * (* _TE)(struct Cyc_Set_Set *,struct Cyc_Absyn_Fndecl *);
  struct Cyc_Set_Set * (* _TF)(struct Cyc_Set_Set *,void *);
  struct Cyc_Set_Set * _T10;
  struct Cyc_Absyn_Fndecl * (* _T11)(struct Cyc_Hashtable_Table *,struct _tuple0 *);
  void * (* _T12)(struct Cyc_Hashtable_Table *,void *);
  struct Cyc_Absyn_Fndecl * _T13;
  struct _tuple11 * _T14;
  struct _tuple11 _T15;
  void * _T16;
  struct Cyc_Core_Not_found_exn_struct * _T17;
  char * _T18;
  char * _T19;
  struct _tuple0 * name;
  _T0 = e;
  { void * _T1A = _T0->r;
    struct Cyc_Absyn_Vardecl * _T1B;
    struct Cyc_Absyn_Fndecl * _T1C;
    _T1 = (int *)_T1A;
    _T2 = *_T1;
    if (_T2 != 1) { goto _TL0;
    }
    _T3 = (struct Cyc_Absyn_Var_e_Absyn_Raw_exp_struct *)_T1A;
    _T4 = _T3->f1;
    _T5 = (int *)_T4;
    _T6 = *_T5;
    switch (_T6) {
    case 2: 
      { struct Cyc_Absyn_Var_e_Absyn_Raw_exp_struct * _T1D = (struct Cyc_Absyn_Var_e_Absyn_Raw_exp_struct *)_T1A;
	_T7 = _T1D->f1;
	{ struct Cyc_Absyn_Funname_b_Absyn_Binding_struct * _T1E = (struct Cyc_Absyn_Funname_b_Absyn_Binding_struct *)_T7;
	  _T1C = _T1E->f1;
	}
      }{ struct Cyc_Absyn_Fndecl * fd = _T1C;
	_T8 = fd;
	name = _T8->name;
	goto _LL0;
      }
    case 1: 
      { struct Cyc_Absyn_Var_e_Absyn_Raw_exp_struct * _T1D = (struct Cyc_Absyn_Var_e_Absyn_Raw_exp_struct *)_T1A;
	_T9 = _T1D->f1;
	{ struct Cyc_Absyn_Global_b_Absyn_Binding_struct * _T1E = (struct Cyc_Absyn_Global_b_Absyn_Binding_struct *)_T9;
	  _T1B = _T1E->f1;
	}
      }{ struct Cyc_Absyn_Vardecl * vd = _T1B;
	_TA = vd;
	name = _TA->name;
	goto _LL0;
      }
    default: 
      goto _LL5;
    }
    goto _TL1;
    _TL0: _LL5: return 1;
    _TL1: _LL0: ;
  }{ struct Cyc_Set_Set * _T1A;
    struct Cyc_Hashtable_Table * _T1B;
    _TB = env;
    { struct _tuple11 _T1C = *_TB;
      _T1B = _T1C.f0;
      _T1A = _T1C.f1;
    }{ struct Cyc_Hashtable_Table * fds = _T1B;
      struct Cyc_Set_Set * s = _T1A;
      { struct _handler_cons _T1C;
	_TC = &_T1C;
	_push_handler(_TC);
	{ int _T1D = 0;
	  _TD = setjmp(_T1C.handler);
	  if (! _TD) { goto _TL3;
	  }
	  _T1D = 1;
	  goto _TL4;
	  _TL3: _TL4: if (_T1D) { goto _TL5;
	  }else { goto _TL7;
	  }
	  _TL7: _TF = Cyc_Set_insert;
	  { struct Cyc_Set_Set * (* _T1E)(struct Cyc_Set_Set *,struct Cyc_Absyn_Fndecl *) = (struct Cyc_Set_Set * (*)(struct Cyc_Set_Set *,
														      struct Cyc_Absyn_Fndecl *))_TF;
	    _TE = _T1E;
	  }_T10 = s;
	  _T12 = Cyc_Hashtable_lookup;
	  { struct Cyc_Absyn_Fndecl * (* _T1E)(struct Cyc_Hashtable_Table *,
					       struct _tuple0 *) = (struct Cyc_Absyn_Fndecl * (*)(struct Cyc_Hashtable_Table *,
												  struct _tuple0 *))_T12;
	    _T11 = _T1E;
	  }_T13 = _T11(fds,name);
	  s = _TE(_T10,_T13);
	  _T14 = env;
	  { struct _tuple11 _T1E;
	    _T1E.f0 = fds;
	    _T1E.f1 = s;
	    _T15 = _T1E;
	  }*_T14 = _T15;
	  _pop_handler();
	  goto _TL6;
	  _TL5: _T16 = Cyc_Core_get_exn_thrown();
	  { void * _T1E = (void *)_T16;
	    void * _T1F;
	    _T17 = (struct Cyc_Core_Not_found_exn_struct *)_T1E;
	    _T18 = _T17->tag;
	    _T19 = Cyc_Core_Not_found;
	    if (_T18 != _T19) { goto _TL8;
	    }
	    goto _LLA;
	    _TL8: _T1F = _T1E;
	    { void * exn = _T1F;
	      _rethrow(exn);
	    }_LLA: ;
	  }_TL6: ;
	}
      }return 0;
    }
  }
}
Exemplo n.º 3
0
static int Cyc_Compact_most_frequent_elt(struct _fat_ptr v) {
  struct Cyc_Hashtable_Table * (* _T0)(int,int (*)(int,int),int (*)(int));
  struct Cyc_Hashtable_Table * (* _T1)(int,int (*)(void *,void *),int (*)(void *));
  int (* _T2)(int,int);
  int (* _T3)(int);
  void * (* _T4)(void *);
  int _T5;
  unsigned int _T6;
  struct _fat_ptr _T7;
  unsigned int _T8;
  struct _fat_ptr _T9;
  unsigned char * _TA;
  int * _TB;
  int * _TC;
  int _TD;
  struct _handler_cons * _TE;
  int _TF;
  int * (* _T10)(struct Cyc_Hashtable_Table *,int);
  void * (* _T11)(struct Cyc_Hashtable_Table *,void *);
  void * _T12;
  struct Cyc_Core_Not_found_exn_struct * _T13;
  char * _T14;
  char * _T15;
  int * _T16;
  struct _RegionHandle * _T17;
  void (* _T18)(struct Cyc_Hashtable_Table *,int,int *);
  void (* _T19)(struct Cyc_Hashtable_Table *,void *,void *);
  int * _T1A;
  int _T1B;
  int * _T1C;
  struct _RegionHandle _T1D = _new_region(0U,"rgn");
  struct _RegionHandle * rgn = &_T1D;
  _push_region(rgn);
  _T1 = Cyc_Hashtable_create;
  { struct Cyc_Hashtable_Table * (* _T1E)(int,int (*)(int,int),int (*)(int)) = (struct Cyc_Hashtable_Table * (*)(int,
														 int (*)(int,
															 int),
														 int (*)(int)))_T1;
    _T0 = _T1E;
  }_T2 = Cyc_Core_intcmp;
  _T4 = Cyc_Core_identity;
  { int (* _T1E)(int) = (int (*)(int))_T4;
    _T3 = _T1E;
  }{ struct Cyc_Hashtable_Table * frequencies = _T0(17,_T2,_T3);
    int max_freq = 0;
    int most_freq = 0;
    { int i = 0;
      _TL3: _T5 = i;
      _T6 = (unsigned int)_T5;
      _T7 = v;
      _T8 = _get_fat_size(_T7,sizeof(int));
      if (_T6 < _T8) { goto _TL1;
      }else { goto _TL2;
      }
      _TL1: _T9 = v;
      _TA = _T9.curr;
      _TB = (int *)_TA;
      _TC = _check_null(_TB);
      _TD = i;
      { int e = _TC[_TD];
	int * r;
	{ struct _handler_cons _T1E;
	  _TE = &_T1E;
	  _push_handler(_TE);
	  { int _T1F = 0;
	    _TF = setjmp(_T1E.handler);
	    if (! _TF) { goto _TL4;
	    }
	    _T1F = 1;
	    goto _TL5;
	    _TL4: _TL5: if (_T1F) { goto _TL6;
	    }else { goto _TL8;
	    }
	    _TL8: _T11 = Cyc_Hashtable_lookup;
	    { int * (* _T20)(struct Cyc_Hashtable_Table *,int) = (int * (*)(struct Cyc_Hashtable_Table *,
									    int))_T11;
	      _T10 = _T20;
	    }r = _T10(frequencies,e);
	    _pop_handler();
	    goto _TL7;
	    _TL6: _T12 = Cyc_Core_get_exn_thrown();
	    { void * _T20 = (void *)_T12;
	      void * _T21;
	      _T13 = (struct Cyc_Core_Not_found_exn_struct *)_T20;
	      _T14 = _T13->tag;
	      _T15 = Cyc_Core_Not_found;
	      if (_T14 != _T15) { goto _TL9;
	      }
	      _T17 = rgn;
	      { int * _T22 = _region_malloc(_T17,0U,sizeof(int));
		*_T22 = 0;
		_T16 = (int *)_T22;
	      }r = _T16;
	      _T19 = Cyc_Hashtable_insert;
	      { void (* _T22)(struct Cyc_Hashtable_Table *,int,int *) = (void (*)(struct Cyc_Hashtable_Table *,
										  int,
										  int *))_T19;
		_T18 = _T22;
	      }_T18(frequencies,e,r);
	      goto _LL0;
	      _TL9: _T21 = _T20;
	      { void * exn = _T21;
		_rethrow(exn);
	      }_LL0: ;
	    }_TL7: ;
	  }
	}_T1A = r;
	_T1B = *_T1A;
	{ int f = _T1B + 1;
	  _T1C = r;
	  *_T1C = f;
	  if (f <= max_freq) { goto _TLB;
	  }
	  max_freq = f;
	  most_freq = e;
	  goto _TLC;
	  _TLB: _TLC: ;
	}
      }i = i + 1;
      goto _TL3;
      _TL2: ;
    }{ int _T1E = most_freq;
      _npop_handler(0);
      return _T1E;
    }
  }_pop_region();
}