Ignore:
Timestamp:
Feb 25, 2008, 11:00:24 PM (17 years ago)
Author:
dai
Message:

gcからのppTryLayersのスキャンに失敗してしまっていたため、List型に改修した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Include/system/exception.ab

    r411 r422  
    9393
    9494Class ExceptionService
    95     ppTryLayers As **TryLayer
    96     nTryLayers As Long
     95    tryLayers As System.Collections.Generic.List<TryLayer>
    9796
    9897    Sub FreeLocalObjects()
     
    102101
    103102    Sub ExceptionService()
    104         ppTryLayers = _System_malloc( 1 )
    105         nTryLayers = 0
     103        tryLayers = New System.Collections.Generic.List<TryLayer>
    106104    End Sub
    107105    Sub ~ExceptionService()
    108         Dim i As Long
    109         For i = 0 To ELM( nTryLayers )
    110             Delete ppTryLayers[i]
    111         Next
    112         _System_free( ppTryLayers )
    113         ppTryLayers = 0
    114106    End Sub
    115107
    116108    'Try
    117109    Function _BeginTryScope( catchTable As *LONG_PTR, addressOfFinally As VoidPtr, basePtr As LONG_PTR, stackPtr As LONG_PTR ) As TryLayer
    118         ppTryLayers = _System_realloc( ppTryLayers, ( nTryLayers + 1 ) * SizeOf( *TryLayer ) )
    119         ppTryLayers[nTryLayers] = New TryLayer( catchTable, addressOfFinally, basePtr, stackPtr )
    120         nTryLayers++
    121 
    122         Return ByVal ppTryLayers[nTryLayers-1]
     110        Dim tryLayer = New TryLayer( catchTable, addressOfFinally, basePtr, stackPtr )
     111        tryLayers.Add( tryLayer )
     112
     113        Return tryLayer
    123114    End Function
    124115
     
    129120    'End Try
    130121    Sub EndTryScope()
    131         nTryLayers--
    132         Delete ppTryLayers[nTryLayers]
     122        tryLayers.RemoveAt( tryLayers.Count - 1 )
    133123    End Sub
    134124
    135125    'Throw
    136126    Sub _Throw( ex As Object )
    137         If nTryLayers <= 0 then
     127        If tryLayers.Count <= 0 then
    138128            '例外処理スコープ制御が無効なとき
    139129
     
    151141        FreeLocalObjects()
    152142
    153         Dim pTryLayer = ppTryLayers[nTryLayers - 1] As *TryLayer
    154 
    155         Dim addressOfCatch = pTryLayer->ResolveCatchesOverload( ex ) As LONG_PTR
     143        Dim tryLayer = tryLayers[tryLayers.Count - 1]
     144
     145        Dim addressOfCatch = tryLayer.ResolveCatchesOverload( ex ) As LONG_PTR
    156146        If addressOfCatch = NULL Then
    157147            ' Catchが定義されていないときはFinallyへ誘導
    158             addressOfCatch = pTryLayer->addressOfFinally As LONG_PTR
     148            addressOfCatch = tryLayer.addressOfFinally As LONG_PTR
    159149        End If
    160150
     
    174164#ifdef _WIN64
    175165        context.Rip = addressOfCatch As QWord
    176         context.Rbp = pTryLayer->basePtr
    177         context.Rsp = pTryLayer->stackPtr
     166        context.Rbp = tryLayer.basePtr
     167        context.Rsp = tryLayer.stackPtr
    178168#else
    179169        context.Eip = addressOfCatch As DWord
    180         context.Ebp = pTryLayer->basePtr
    181         context.Esp = pTryLayer->stackPtr
     170        context.Ebp = tryLayer.basePtr
     171        context.Esp = tryLayer.stackPtr
    182172#endif
    183173
     
    186176        ThreadNum=_DebugSys_GetThread()
    187177        If ThreadNum <> -1 Then
    188             _DebugSys_ProcNum[ThreadNum] = pTryLayer->debugProcNum-1
     178            _DebugSys_ProcNum[ThreadNum] = tryLayer.debugProcNum-1
    189179        End If
    190180#endif
     
    205195
    206196    Sub FinishFinally()
    207         Dim pTryLayer = ppTryLayers[nTryLayers - 1] As *TryLayer
    208         pTryLayer->FinishFinally()
     197        Dim tryLayer = tryLayers[tryLayers.Count - 1]
     198        tryLayer.FinishFinally()
    209199    End Sub
    210200End Class
Note: See TracChangeset for help on using the changeset viewer.