Improving handling of refcounted user values (to be improved later), removing old cruft
Publish PHP Package / docker (push) Successful in 6s Details

This commit is contained in:
Pavel Shevaev 2024-11-18 18:22:06 +03:00
parent d8c72c3e99
commit 58cbd3c08b
1 changed files with 7 additions and 15 deletions

View File

@ -367,8 +367,8 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{{arg_prefix}}{{arg.name}} = default;
{% else %}
{
if({{arg_prefix}}{{arg.name}} is IDisposable dsp)
dsp.Dispose();
if({{arg_prefix}}{{arg.name}} is IValRefcounted rfc)
rfc.Release();
{{arg_prefix}}{{arg.name}} = default;
}
{% endif %}
@ -427,14 +427,11 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{# any special case #}
{%- if type == 'any' -%}
{{native}} = {{value}}
{# bhl functor special case #}
{%- elseif type == "ConfScript" -%}
{{native}}.fct.obj = {{value}}._obj
{%- else -%}
{%- if type is instanceof('\\mtgMetaFunc') -%}
{%~ if type is instanceof('\\mtgMetaFunc') -%}
{{native}} = (VM.FuncPtr){{value}}._obj;
{{native}}.Retain()
{{native}}.Retain();
{%- endif -%}
{%- if type is instanceof('\\mtgArrType') -%}
@ -444,23 +441,21 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{%~ if type == 'any[]'-%}
{{native}} = (ValList){{value}}._obj;
{{native}}.Retain()
{%~ else ~%}
if({{value}}._obj is ValList vl)
{
vl.Retain();
{{native}} = ValList<{{type.value|native_type}}>.New(vl,
((NativeListTypeSymbol<{{type.value|native_type}}>)Types_List_{{type.value|norm_name}}.Value).Val2Native);
}
else if({{value}}._obj != null)
{{native}} = (IList<{{type.value|native_type}}>){{value}}._obj;
else
throw new Exception("Null value");
{{native}} = (IList<{{type.value|native_type}}>){{value}}._obj;
{%~ endif -%}
{{value}}._refc?.Retain();
{%- else -%}
var _src_arr_type = (ArrayTypeSymbol){{value}}.type;
@ -533,9 +528,6 @@ Script_{{o.name|norm_name}}.Method_{{m.name}}.ReturnValue(frm, stack
{# any special case #}
{%- if type == 'any' -%}
{{value}}.SetObj({{native}}, Types.Any)
{# bhl functor special case #}
{%- elseif type == "ConfScript" -%}
{{value}}.obj = {{native}}.fct.obj
{%- else -%}
{%- if type is instanceof('\\mtgMetaFunc') -%}