Showing the changes to src (2 of 2 files). Show all
Unified · Split
| @@ -74,7 +74,7 @@ t_CKBOOL emit_engine_emit_exp_postfix( Chuck_Emitter * emit, a_Exp_Postfix postf · 73 unmodified lines | |||
| 74 | t_CKBOOL emit_engine_emit_exp_dur( Chuck_Emitter * emit, a_Exp_Dur dur ); | 74 | t_CKBOOL emit_engine_emit_exp_dur( Chuck_Emitter * emit, a_Exp_Dur dur ); |
| 75 | t_CKBOOL emit_engine_emit_exp_array( Chuck_Emitter * emit, a_Exp_Array array ); | 75 | t_CKBOOL emit_engine_emit_exp_array( Chuck_Emitter * emit, a_Exp_Array array ); |
| 76 | t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, Chuck_Func * func, | 76 | t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, Chuck_Func * func, |
| 77 | a_Exp args, Chuck_Type * type, int linepos, t_CKBOOL spork = FALSE ); | 77 | Chuck_Type * type, int linepos, t_CKBOOL spork = FALSE ); |
| 78 | t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, a_Exp_Func_Call func_call, | 78 | t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, a_Exp_Func_Call func_call, |
| 79 | t_CKBOOL spork = FALSE ); | 79 | t_CKBOOL spork = FALSE ); |
| 80 | t_CKBOOL emit_engine_emit_func_args( Chuck_Emitter * emit, a_Exp_Func_Call func_call ); | 80 | t_CKBOOL emit_engine_emit_func_args( Chuck_Emitter * emit, a_Exp_Func_Call func_call ); |
| @@ -2565,7 +2565,7 @@ t_CKBOOL emit_engine_emit_op_chuck( Chuck_Emitter * emit, a_Exp lhs, a_Exp rhs, · 2484 unmodified lines | |||
| 2565 | assert( binary->ck_func != NULL ); | 2565 | assert( binary->ck_func != NULL ); |
| 2566 | 2566 | ||
| 2567 | // emit | 2567 | // emit |
| 2568 | return emit_engine_emit_exp_func_call( emit, binary->ck_func, binary->lhs, binary->self->type, binary->linepos ); | 2568 | return emit_engine_emit_exp_func_call( emit, binary->ck_func, binary->self->type, binary->linepos ); |
| 2569 | } | 2569 | } |
| 2570 | 2570 | ||
| 2571 | // assignment or something else | 2571 | // assignment or something else |
| @@ -3429,7 +3429,6 @@ t_CKBOOL emit_engine_emit_exp_array( Chuck_Emitter * emit, a_Exp_Array array ) · 857 unmodified lines | |||
| 3429 | //----------------------------------------------------------------------------- | 3429 | //----------------------------------------------------------------------------- |
| 3430 | t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, | 3430 | t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, |
| 3431 | Chuck_Func * func, | 3431 | Chuck_Func * func, |
| 3432 | a_Exp args, | ||
| 3433 | Chuck_Type * type, | 3432 | Chuck_Type * type, |
| 3434 | int linepos, | 3433 | int linepos, |
| 3435 | t_CKBOOL spork ) | 3434 | t_CKBOOL spork ) |
| @@ -3531,7 +3530,7 @@ t_CKBOOL emit_engine_emit_exp_func_call( Chuck_Emitter * emit, · 95 unmodified lines | |||
| 3531 | } | 3530 | } |
| 3532 | 3531 | ||
| 3533 | // the rest | 3532 | // the rest |
| 3534 | return emit_engine_emit_exp_func_call( emit, func_call->ck_func, func_call->args, | 3533 | return emit_engine_emit_exp_func_call( emit, func_call->ck_func, |
| 3535 | func_call->ret_type, func_call->linepos, spork ); | 3534 | func_call->ret_type, func_call->linepos, spork ); |
| 3536 | } | 3535 | } |
| 3537 | 3536 | ||
| @@ -4819,7 +4818,6 @@ t_CKBOOL emit_engine_emit_spork( Chuck_Emitter * emit, a_Exp_Func_Call exp ) · 1281 unmodified lines | |||
| 4819 | // call the func on sporkee shred | 4818 | // call the func on sporkee shred |
| 4820 | if( !emit_engine_emit_exp_func_call( emit, | 4819 | if( !emit_engine_emit_exp_func_call( emit, |
| 4821 | exp->ck_func, | 4820 | exp->ck_func, |
| 4822 | exp->args, | ||
| 4823 | exp->ret_type, | 4821 | exp->ret_type, |
| 4824 | exp->linepos, | 4822 | exp->linepos, |
| 4825 | TRUE ) ) return FALSE; | 4823 | TRUE ) ) return FALSE; |
| @@ -5142,16 +5140,12 @@ void Chuck_Emitter::traverse_scope_on_jump( ) · 316 unmodified lines | |||
| 5142 | // skip scope boundary (denoted by NULL) | 5140 | // skip scope boundary (denoted by NULL) |
| 5143 | if( !local ) continue; | 5141 | if( !local ) continue; |
| 5144 | 5142 | ||
| 5145 | // CK_STDCERR << "local: " << local->offset << " " << local->is_obj << CK_STDENDL; | 5143 | // check to see if it's an object (but not global) |
| 5146 | // check to see if it's an object | 5144 | // (REFACTOR-2017: don't release global objects) |
| 5147 | if( local->is_obj ) | 5145 | if( local->is_obj && !local->is_global ) |
| 5148 | { | 5146 | { |
| 5149 | // (REFACTOR-2017: don't release global objects) | 5147 | // emit instruction to release the object |
| 5150 | if( !local->is_global ) | 5148 | this->append( new Chuck_Instr_Release_Object2( local->offset ) ); |
| 5151 | { | ||
| 5152 | // emit instruction to release the object | ||
| 5153 | this->append( new Chuck_Instr_Release_Object2( local->offset ) ); | ||
| 5154 | } | ||
| 5155 | } | 5149 | } |
| 5156 | } | 5150 | } |
| 5157 | 5151 | ||
| @@ -4788,17 +4788,10 @@ void Chuck_Instr_Func_Call_Member::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 4787 unmodified lines | |||
| 4788 | // 1.4.2.1 (ge) | added -- ensure ref count | 4788 | // 1.4.2.1 (ge) | added -- ensure ref count |
| 4789 | if( m_func_ref && isobj(vm->env(), m_func_ref->def->ret_type) ) | 4789 | if( m_func_ref && isobj(vm->env(), m_func_ref->def->ret_type) ) |
| 4790 | { | 4790 | { |
| 4791 | // get return value as object reference | ||
| 4791 | Chuck_VM_Object * obj = (Chuck_VM_Object *) retval.v_uint; | 4792 | Chuck_VM_Object * obj = (Chuck_VM_Object *) retval.v_uint; |
| 4792 | if( obj ) | 4793 | if( obj ) |
| 4793 | { | 4794 | { |
| 4794 | // check if refcount is 0 | ||
| 4795 | if( obj->m_ref_count == 0 ) | ||
| 4796 | { | ||
| 4797 | EM_log( CK_LOG_FINE, "%s(...) returned object with refcount==0", S_name(m_func_ref->def->name) ); | ||
| 4798 | EM_pushlog(); | ||
| 4799 | EM_log( CK_LOG_FINE, "auto-incrementing object refcount to 1..." ); | ||
| 4800 | EM_poplog(); | ||
| 4801 | } | ||
| 4802 | // always add reference to returned objects (should release outside) | 4795 | // always add reference to returned objects (should release outside) |
| 4803 | obj->add_ref(); | 4796 | obj->add_ref(); |
| 4804 | } | 4797 | } |
| @@ -4922,18 +4915,10 @@ void Chuck_Instr_Func_Call_Static::execute( Chuck_VM * vm, Chuck_VM_Shred * shre · 117 unmodified lines | |||
| 4922 | // 1.4.2.1 (ge) | added -- ensure ref count | 4915 | // 1.4.2.1 (ge) | added -- ensure ref count |
| 4923 | if( m_func_ref && isobj(vm->env(), m_func_ref->def->ret_type) ) | 4916 | if( m_func_ref && isobj(vm->env(), m_func_ref->def->ret_type) ) |
| 4924 | { | 4917 | { |
| 4925 | // get as object pointer | 4918 | // get return value as object reference |
| 4926 | Chuck_VM_Object * obj = (Chuck_VM_Object *) retval.v_uint; | 4919 | Chuck_VM_Object * obj = (Chuck_VM_Object *) retval.v_uint; |
| 4927 | if( obj ) | 4920 | if( obj ) |
| 4928 | { | 4921 | { |
| 4929 | // check if refcount is 0 | ||
| 4930 | if( obj->m_ref_count == 0 ) | ||
| 4931 | { | ||
| 4932 | EM_log( CK_LOG_FINE, "%s(...) returned object with refcount==0", S_name(m_func_ref->def->name) ); | ||
| 4933 | EM_pushlog(); | ||
| 4934 | EM_log( CK_LOG_FINE, "auto-incrementing object refcount to 1..." ); | ||
| 4935 | EM_poplog(); | ||
| 4936 | } | ||
| 4937 | // always add reference to returned objects (should release outside) | 4922 | // always add reference to returned objects (should release outside) |
| 4938 | obj->add_ref(); | 4923 | obj->add_ref(); |
| 4939 | } | 4924 | } |