Changeset 15746


Ignore:
Timestamp:
Feb 24, 2013, 10:59:56 AM (7 years ago)
Author:
gb
Message:

On x86{32,64}:

In write-barrier subprims that do an unconditional store (rplaca/rplacd,
set_hash_key, gvset) do the store as the first instruction.

In pc_luser_xp: do nothing if suspended at the first instruction of
these subprims. Otherwise, assume that the unconditional store has
already occurred and don't emulate it. (Other values may have been
stored in the same location since the thread was suspended.)

Fixes ticket:1058 in the trunk.

Location:
trunk/source/lisp-kernel
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/lisp-kernel/x86-exceptions.c

    r15702 r15746  
    24022402  egc_store_node_conditional_success_end, egc_store_node_conditional_retry,
    24032403  egc_store_node_conditional_success_test,egc_store_node_conditional,
    2404   egc_set_hash_key, egc_gvset, egc_rplacd;
     2404  egc_set_hash_key, egc_gvset, egc_rplacd, egc_rplaca;
    24052405
    24062406/* We use (extremely) rigidly defined instruction sequences for consing,
     
    26442644    LispObj *ea = 0, val, root = 0;
    26452645    bitvector refbits = (bitvector)(lisp_global(REFBITS));
    2646     Boolean need_store = true, need_check_memo = true, need_memoize_root = false;
     2646    Boolean need_check_memo = true, need_memoize_root = false;
    26472647
    26482648    if (program_counter >= &egc_set_hash_key_conditional) {
     
    26782678#endif
    26792679      need_memoize_root = true;
    2680       need_store = false;
    26812680      xpGPR(xp,Iarg_z) = t_value;
    26822681    } else if (program_counter >= &egc_store_node_conditional) {
     
    27142713#endif
    27152714      xpGPR(xp,Iarg_z) = t_value;
    2716       need_store = false;
    27172715    } else if (program_counter >= &egc_set_hash_key) {
     2716      if (program_counter == &egc_set_hash_key) {
     2717        return;
     2718      }
    27182719#ifdef X8664
    27192720      root = xpGPR(xp,Iarg_x);
     
    27252726      need_memoize_root = true;
    27262727    } else if (program_counter >= &egc_gvset) {
     2728      /* This assumes that the store is the first instruction at _SPgvset.
     2729         As of late February 2013 - just before the 1.9 release, that's
     2730         a relatively recent change.
     2731         If the store has already completed, don't do it again.
     2732         See ticket:1058 for an example showing why this matters.
     2733      */
     2734      if (program_counter == &egc_gvset) {
     2735        return;
     2736      }
    27272737#ifdef X8664
    27282738      ea = (LispObj *) (xpGPR(xp,Iarg_x)+xpGPR(xp,Iarg_y)+misc_data_offset);
     
    27322742      val = xpGPR(xp,Iarg_z);
    27332743    } else if (program_counter >= &egc_rplacd) {
     2744      if (program_counter == &egc_rplacd) {
     2745        return;
     2746      }
    27342747      ea = (LispObj *) untag(xpGPR(xp,Iarg_y));
    27352748      val = xpGPR(xp,Iarg_z);
    27362749    } else {                      /* egc_rplaca */
     2750      if (program_counter == &egc_rplaca) {
     2751        return;
     2752      }
    27372753      ea =  ((LispObj *) untag(xpGPR(xp,Iarg_y)))+1;
    27382754      val = xpGPR(xp,Iarg_z);
    2739     }
    2740     if (need_store) {
    2741       *ea = val;
    27422755    }
    27432756    if (need_check_memo) {
  • trunk/source/lisp-kernel/x86-spentry32.s

    r15703 r15746  
    17221722        .globl C(egc_rplaca)
    17231723C(egc_rplaca):
     1724        /* pc_luser_xp() expects the store to be the first instruction here */
     1725        __(_rplaca(%arg_y,%arg_z))
    17241726        __(rcmpl(%arg_z,%arg_y))
    1725         __(_rplaca(%arg_y,%arg_z))
    17261727        __(ja 1f)
    172717280:      __(repret)
     
    17481749        .globl C(egc_rplacd)
    17491750C(egc_rplacd):
     1751        /* pc_luser_xp() expects the store to be the first instruction here */
     1752        __(_rplacd(%arg_y,%arg_z))
    17501753        __(rcmpl(%arg_z,%arg_y))
    1751         __(_rplacd(%arg_y,%arg_z))
    17521754        __(ja 1f)
    175317550:      __(repret)
     
    17761778        .globl C(egc_gvset)
    17771779C(egc_gvset):
     1780        /* pc_luser_xp() expects the store to be the first instruction here */
    17781781        __(movl %arg_z,misc_data_offset(%temp0,%arg_y))
    17791782        __(rcmpl(%arg_z,%temp0))
     
    18061809        .globl C(egc_set_hash_key)
    18071810C(egc_set_hash_key):
     1811        /* pc_luser_xp() expects the store to be the first instruction here */
    18081812        __(movl %arg_z,misc_data_offset(%temp0,%arg_y))
    18091813        __(rcmpl(%arg_z,%temp0))
  • trunk/source/lisp-kernel/x86-spentry64.s

    r15703 r15746  
    17631763        .globl C(egc_rplaca)
    17641764C(egc_rplaca):
     1765        /* pc_luser_xp() expects the store to be the first instruction here */
     1766        __(_rplaca(%arg_y,%arg_z))
    17651767        __(rcmpq(%arg_z,%arg_y))
    1766         __(_rplaca(%arg_y,%arg_z))
    17671768        __(ja 1f)
    176817690:      __(repret)
     
    17891790        .globl C(egc_rplacd)
    17901791C(egc_rplacd):         
     1792        /* pc_luser_xp() expects the store to be the first instruction here */
     1793        __(_rplacd(%arg_y,%arg_z))
    17911794        __(rcmpq(%arg_z,%arg_y))
    1792         __(_rplacd(%arg_y,%arg_z))
    17931795        __(ja 1f)
    179417960:      __(repret)
     
    18191821        .globl C(egc_gvset)
    18201822C(egc_gvset):
     1823        /* pc_luser_xp() expects the store to be the first instruction here */
     1824        __(movq %arg_z,misc_data_offset(%arg_x,%arg_y))
    18211825        __(rcmpq(%arg_z,%arg_x))
    1822         __(movq %arg_z,misc_data_offset(%arg_x,%arg_y))
    18231826        __(ja 1f)
    182418270:      __(repret)
     
    18501853        .globl C(egc_set_hash_key)
    18511854C(egc_set_hash_key): 
     1855        /* pc_luser_xp() expects the store to be the first instruction here */
     1856        __(movq %arg_z,misc_data_offset(%arg_x,%arg_y))
    18521857        __(rcmpq(%arg_z,%arg_x))
    1853         __(movq %arg_z,misc_data_offset(%arg_x,%arg_y))
    18541858        __(ja 1f)
    185518590:      __(repret)
Note: See TracChangeset for help on using the changeset viewer.