@@ -470,6 +470,12 @@ pub fn lua_execute(lua_state: &mut LuaState, target_depth: usize) -> LuaResult<(
470470 if meta. is_null ( ) || meta. as_mut_ref ( ) . data . no_tm ( TmKind :: NewIndex . into ( ) ) {
471471 let ( new_key, delta, rc_tt) = if instr. get_k ( ) {
472472 let rc = * k_val ! ( c) ;
473+ if table. impl_table . set_existing_shortstr ( key, rc) {
474+ if rc. is_collectable ( ) {
475+ lua_state. gc_barrier_back ( gc_ptr) ;
476+ }
477+ continue ;
478+ }
473479 let pset_result = table. impl_table . pset_shortstr ( key, rc) ;
474480 let ( new_key, delta) =
475481 table. impl_table . finish_shortstr_set ( key, rc, pset_result) ;
@@ -479,6 +485,15 @@ pub fn lua_execute(lua_state: &mut LuaState, target_depth: usize) -> LuaResult<(
479485 unsafe { lua_state. stack ( ) . as_ptr ( ) . add ( stack_id ! ( c) ) } ;
480486 let rc_tt = unsafe { ( * rc_ptr) . tt } ;
481487 let rc_value = unsafe { ( * rc_ptr) . value } ;
488+ if table
489+ . impl_table
490+ . set_existing_shortstr_parts ( key, rc_value, rc_tt)
491+ {
492+ if rc_tt & 0x40 != 0 {
493+ lua_state. gc_barrier_back ( gc_ptr) ;
494+ }
495+ continue ;
496+ }
482497 let pset_result =
483498 table. impl_table . pset_shortstr_parts ( key, rc_value, rc_tt) ;
484499 let ( new_key, delta) = table. impl_table . finish_shortstr_set_parts (
@@ -639,6 +654,14 @@ pub fn lua_execute(lua_state: &mut LuaState, target_depth: usize) -> LuaResult<(
639654 let meta = table. meta_ptr ( ) ;
640655 if meta. is_null ( ) || meta. as_mut_ref ( ) . data . no_tm ( TmKind :: NewIndex . into ( ) ) {
641656 if rb. is_short_string ( ) {
657+ if table. impl_table . set_existing_shortstr ( & rb, rc) {
658+ if rc. is_collectable ( ) || rb. is_collectable ( ) {
659+ lua_state. gc_barrier_back ( unsafe {
660+ ra. as_gc_ptr_table_unchecked ( )
661+ } ) ;
662+ }
663+ continue ;
664+ }
642665 let pset_result = table. impl_table . pset_shortstr ( & rb, rc) ;
643666 let ( new_key, delta) =
644667 table. impl_table . finish_shortstr_set ( & rb, rc, pset_result) ;
@@ -792,6 +815,14 @@ pub fn lua_execute(lua_state: &mut LuaState, target_depth: usize) -> LuaResult<(
792815 if meta. is_null ( ) || meta. as_mut_ref ( ) . data . no_tm ( TmKind :: NewIndex . into ( ) ) {
793816 let ( new_key, delta, rc_tt) = if instr. get_k ( ) {
794817 let rc = * k_val ! ( c) ;
818+ if table. impl_table . set_existing_shortstr ( key, rc) {
819+ if rc. is_collectable ( ) {
820+ lua_state. gc_barrier_back ( unsafe {
821+ ( * ra_ptr) . as_gc_ptr_table_unchecked ( )
822+ } ) ;
823+ }
824+ continue ;
825+ }
795826 let pset_result = table. impl_table . pset_shortstr ( key, rc) ;
796827 let ( new_key, delta) =
797828 table. impl_table . finish_shortstr_set ( key, rc, pset_result) ;
@@ -801,6 +832,17 @@ pub fn lua_execute(lua_state: &mut LuaState, target_depth: usize) -> LuaResult<(
801832 unsafe { lua_state. stack ( ) . as_ptr ( ) . add ( stack_id ! ( c) ) } ;
802833 let rc_tt = unsafe { ( * rc_ptr) . tt } ;
803834 let rc_value = unsafe { ( * rc_ptr) . value } ;
835+ if table
836+ . impl_table
837+ . set_existing_shortstr_parts ( key, rc_value, rc_tt)
838+ {
839+ if rc_tt & 0x40 != 0 {
840+ lua_state. gc_barrier_back ( unsafe {
841+ ( * ra_ptr) . as_gc_ptr_table_unchecked ( )
842+ } ) ;
843+ }
844+ continue ;
845+ }
804846 let pset_result =
805847 table. impl_table . pset_shortstr_parts ( key, rc_value, rc_tt) ;
806848 let ( new_key, delta) = table. impl_table . finish_shortstr_set_parts (
0 commit comments