<commit_before>#include <ross.h>
#include <assert.h>

static inline void
link_causality (tw_event *nev, tw_event *cev)
{
  nev->cause_next = cev->caused_by_me;
  cev->caused_by_me = nev;
}

void
tw_event_send(tw_event * event)
{
  tw_lp		*src_lp = event->src_lp;
  tw_pe		*send_pe = src_lp->pe;
  tw_pe		*dest_pe = NULL;

  tw_peid		 dest_peid = -1;
  tw_stime	 recv_ts = event->recv_ts;

  if (event == send_pe->abort_event) {
    if (recv_ts < g_tw_ts_end)
      send_pe->cev_abort = 1;
    return;
  }

  /* Trap lookahead violations in debug mode */
  /* Note that compiling with the -DNDEBUG flag will turn this off! */
  if (g_tw_synchronization_protocol == CONSERVATIVE) {
    assert(recv_ts - tw_now(src_lp) >= g_tw_lookahead &&
           "Lookahead violation: try decreasing the lookahead value");
  }

  if (event->out_msgs) {
    tw_error(TW_LOC, "It is an error to send an event with pre-loaded output message.");
  }

  link_causality(event, send_pe->cur_event);

  // call LP remote mapping function to get dest_pe
  dest_peid = (*src_lp->type.map) ((tw_lpid) event->dest_lp);

  if(tw_node_eq(tw_net_onnode(dest_peid), &g_tw_mynode))
    {
      event->dest_lp = tw_getlocal_lp((tw_lpid) event->dest_lp);
      dest_pe = event->dest_lp->pe;

      if (send_pe == dest_pe &&
	  event->dest_lp->kp->last_time <= recv_ts)
	{
	  /* Fast case, we are sending to our own PE and there is
	   * no rollback caused by this send.  We cannot have any
	   * transient messages on local sends so we can return.
	   */
	  tw_pq_enqueue(send_pe->pq, event);
	  return;
	} else
	{
	  /* Slower, but still local send, so put into top of
	   * dest_pe->event_q. 
	   */<commit_msg>Replaced assert with tw_error() call for lookahead violations.<commit_after>#include <ross.h>
#include <assert.h>

static inline void
link_causality (tw_event *nev, tw_event *cev)
{
  nev->cause_next = cev->caused_by_me;
  cev->caused_by_me = nev;
}

void
tw_event_send(tw_event * event)
{
  tw_lp		*src_lp = event->src_lp;
  tw_pe		*send_pe = src_lp->pe;
  tw_pe		*dest_pe = NULL;

  tw_peid		 dest_peid = -1;
  tw_stime	 recv_ts = event->recv_ts;

  if (event == send_pe->abort_event) {
    if (recv_ts < g_tw_ts_end)
      send_pe->cev_abort = 1;
    return;
  }

  /* Trap lookahead violations in debug mode */
  /* Note that compiling with the -DNDEBUG flag will turn this off! */
  if (g_tw_synchronization_protocol == CONSERVATIVE) {
      if (recv_ts - tw_now(src_lp) < g_tw_lookahead) {
          tw_error(TW_LOC, "Lookahead violation: decrease g_tw_lookahead");
      }
  }

  if (event->out_msgs) {
    tw_error(TW_LOC, "It is an error to send an event with pre-loaded output message.");
  }

  link_causality(event, send_pe->cur_event);

  // call LP remote mapping function to get dest_pe
  dest_peid = (*src_lp->type.map) ((tw_lpid) event->dest_lp);

  if(tw_node_eq(tw_net_onnode(dest_peid), &g_tw_mynode))
    {
      event->dest_lp = tw_getlocal_lp((tw_lpid) event->dest_lp);
      dest_pe = event->dest_lp->pe;

      if (send_pe == dest_pe &&
	  event->dest_lp->kp->last_time <= recv_ts)
	{
	  /* Fast case, we are sending to our own PE and there is
	   * no rollback caused by this send.  We cannot have any
	   * transient messages on local sends so we can return.
	   */
	  tw_pq_enqueue(send_pe->pq, event);
	  return;
	} else
	{
	  /* Slower, but still local send, so put into top of
	   * dest_pe->event_q. 
	   */
{'fraction_non_alphanumeric': 0.11907548273844354, 'fraction_numerical': 0.0011702750146284377, 'mean_word_length': 3.2314356435643563, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 50, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3047762', 'n_tokens_mistral': 1391, 'n_tokens_neox': 1317, 'n_words': 328}