Ejemplo n.º 1
0
/* The _ITM_beginTransaction is defined in assembly (arch.S)  */
uint32_t _ITM_CALL_CONVENTION GTM_begin_transaction(TX_ARGS uint32_t attr, jmp_buf * buf) 
{
  /* FIXME first time return a_saveLiveVariable +> siglongjmp must return a_restoreLiveVariable (and set a_saveLiveVariable)
   *       check a_abortTransaction attr
   * */
  TX_GET_ABI;
  uint32_t ret;
  sigjmp_buf * env;

  /* This variable is in the stack but stm_start copies the content. */
  stm_tx_attr_t _a = (stm_tx_attr_t)0;

#ifdef TM_GCC
  /* GCC does not call initializeProcess TODO: other fix possible? */
  if (unlikely(tx == NULL)) {
    /* Thread not initialized: must create transaction */
    tx = abi_init_thread();
  }
#endif
  assert(tx != NULL);

#ifdef TM_DTMC
  /* FIXME this should be fixed with stdcall conv call */
  /* DTMC prior or equal to Velox R3 did not use regparm(2) with x86-32. */
  /* TODO to be removed when new release of DTMC fix it. */
  /* attr = 3; */
  ret = a_runInstrumentedCode;
#else /* !TM_DTMC */
  /* Manage attribute for the transaction */
  if (unlikely((attr & pr_doesGoIrrevocable) || !(attr & pr_instrumentedCode))) {
    /* TODO Add an attribute to specify irrevocable TX */
    stm_set_irrevocable_tx(tx, 1);
    ret = a_runUninstrumentedCode;
    if ((attr & pr_multiwayCode) == pr_instrumentedCode)
      ret = a_runInstrumentedCode;
  } else {
#ifdef TM_GCC
    if (attr & pr_readOnly)
      _a.read_only = 1;
#endif /* TM_GCC */

    ret = a_runInstrumentedCode | a_saveLiveVariables;
  }
#endif /* !TM_DTMC */

#ifdef TM_DTMC
  /* if (ret & a_runInstrumentedCode) */
  tanger_stm_save_stack();
#endif /* TM_DTMC */

  env = int_stm_start(tx, _a);
  /* Save thread context only when outermost transaction */
  /* TODO check that the memcpy is fast. */
  if (likely(env != NULL))
    memcpy(env, buf, sizeof(jmp_buf)); /* TODO limit size to real size */

  return ret;
}
Ejemplo n.º 2
0
Archivo: stm.c Proyecto: HPDCS/stmF2C2
/*
 * Called by the CURRENT thread to start a transaction.
 */
_CALLCONV sigjmp_buf *
stm_start(stm_tx_attr_t attr)
{
  TX_GET;
  sigjmp_buf * ret;
  if (tx->thread_identifier!=0) stm_wait(attr.id);
  ret=int_stm_start(tx, attr);
  return ret;
}
Ejemplo n.º 3
0
Archivo: stm.c Proyecto: HPDCS/stmMCATS
/*
 * Called by the CURRENT thread to start a transaction.
 */
_CALLCONV sigjmp_buf *
stm_start(stm_tx_attr_t attr)
{
  TX_GET;
  sigjmp_buf * ret;
  stm_wait(attr.id);
  ret=int_stm_start(tx, attr);
  return ret;
}
Ejemplo n.º 4
0
/* The _ITM_beginTransaction is defined in assembly (arch.S)  */
uint32_t _ITM_CALL_CONVENTION GTM_begin_transaction(TX_ARGS uint32_t attr, jmp_buf * buf) 
{
  /* FIXME first time return a_saveLiveVariable +> siglongjmp must return a_restoreLiveVariable (and set a_saveLiveVariable)
   *       check a_abortTransaction attr
   * */
  TX_GET_ABI;
  uint32_t ret;

  /* This variable is in the stack but stm_start copies the content. */
  stm_tx_attr_t _a = (stm_tx_attr_t)0;

  /* GCC does not call initializeProcess TODO: other fix possible? */
  if (unlikely(tx == NULL)) {
    /* Thread not initialized: must create transaction */
    tx = abi_init_thread();
  }
  assert(tx != NULL);

  /* Manage attribute for the transaction */
  if (unlikely((attr & pr_doesGoIrrevocable) || !(attr & pr_instrumentedCode))) {
    /* TODO Add an attribute to specify irrevocable TX */
    stm_set_irrevocable_tx(tx, 1);
    ret = a_runUninstrumentedCode;
    if ((attr & pr_multiwayCode) == pr_instrumentedCode)
      ret = a_runInstrumentedCode;
  } else {
    if (attr & pr_readOnly)
      _a.read_only = 1;

    ret = a_runInstrumentedCode | a_saveLiveVariables;
  }

  if (int_stm_start(tx, &thread_local_buffer, _a) == 1) {
      memcpy(&thread_local_buffer, buf, sizeof(jmp_buf));
  }
  /* Save thread context only when outermost transaction */

  return ret;
}
Ejemplo n.º 5
0
_CALLCONV sigjmp_buf *
stm_start_tx(stm_tx_t *tx, stm_tx_attr_t attr)
{
    return int_stm_start(tx, attr);
}
Ejemplo n.º 6
0
/*
 * Called by the CURRENT thread to start a transaction.
 */
_CALLCONV sigjmp_buf *
stm_start(stm_tx_attr_t attr)
{
    TX_GET;
    return int_stm_start(tx, attr);
}