コード例 #1
0
ファイル: Heap.cs プロジェクト: gfajardos-glb/Dynamo
        private void GCDisposeObject(StackValue svPtr, Executive exe)
        {
            int       classIndex = svPtr.metaData.type;
            ClassNode cn         = exe.exe.classTable.ClassNodes[classIndex];

            ProcedureNode pn = cn.GetDisposeMethod();

            while (pn == null)
            {
                if (cn.Bases != null && cn.Bases.Count != 0)
                {
                    classIndex = cn.Bases[0];
                    cn         = exe.exe.classTable.ClassNodes[classIndex];
                    pn         = cn.GetDisposeMethod();
                }
                else
                {
                    break;
                }
            }

            if (pn != null)
            {
                // TODO Jun/Jiong: Use build pointer utilities
                exe.rmem.Push(StackValue.BuildArrayDimension(0));
                exe.rmem.Push(StackValue.BuildPointer(svPtr.Pointer, svPtr.metaData));
                exe.rmem.Push(StackValue.BuildInt(1));

                ++exe.RuntimeCore.FunctionCallDepth;

                // TODO: Need to move IsExplicitCall to DebugProps and come up with a more elegant solution for this
                // fix for IDE-963 - pratapa
                bool explicitCall = exe.IsExplicitCall;
                bool tempFlag     = explicitCall;
                exe.Callr(pn.RuntimeIndex, pn.ID, classIndex, ref explicitCall);

                exe.IsExplicitCall = tempFlag;

                --exe.RuntimeCore.FunctionCallDepth;
            }
        }
コード例 #2
0
ファイル: Heap.cs プロジェクト: riteshchandawar/designscript
        private void GCDisposeObject(ref StackValue svPtr, Executive exe)
        {
            int           classIndex = (int)svPtr.metaData.type;
            ClassNode     cn         = exe.exe.classTable.ClassNodes[classIndex];
            ProcedureNode pn         = null;

            while (pn == null)
            {
                pn = cn.GetDisposeMethod();
                if (pn == null && cn.baseList != null && cn.baseList.Count != 0) // search the base class
                {
                    // assume multiple inheritance is not allowed
                    // it will only has a single base class
                    classIndex = cn.baseList[0];
                    cn         = exe.exe.classTable.ClassNodes[cn.baseList[0]];
                }
                else
                {
                    break;
                }
            }

            if (pn != null)
            {
                // TODO Jun/Jiong: Use build pointer utilities
                exe.rmem.Push(StackUtils.BuildNode(AddressType.ArrayDim, 0));
                exe.rmem.Push(StackUtils.BuildPointer(svPtr.opdata, svPtr.metaData));
                exe.rmem.Push(StackUtils.BuildNode(AddressType.BlockIndex, pn.runtimeIndex));
                exe.rmem.Push(StackUtils.BuildNode(AddressType.ArrayDim, 0));
                exe.rmem.Push(StackUtils.BuildStaticType((int)ProtoCore.PrimitiveType.kTypeVar));

                ++exe.Core.FunctionCallDepth;

                // TODO: Need to move isExplicitCall to DebugProps and come up with a more elegant solution for this
                // fix for IDE-963 - pratapa
                bool explicitCall = exe.isExplicitCall;
                bool tempFlag     = explicitCall;
                exe.Callr(pn.procId, classIndex, 1, ref explicitCall);

                exe.isExplicitCall = tempFlag;

                --exe.Core.FunctionCallDepth;
            }
        }