Skip to content

Commit 609bcd5

Browse files
[llvm] Proofread ExceptionHandling.rst (#157313)
1 parent 37a1fc5 commit 609bcd5

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

llvm/docs/ExceptionHandling.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ algorithm. Thus, the specification is said to add "zero-cost" to the normal
3131
execution of an application.
3232

3333
A more complete description of the Itanium ABI exception handling runtime
34-
support of can be found at `Itanium C++ ABI: Exception Handling
34+
support can be found at `Itanium C++ ABI: Exception Handling
3535
<http://itanium-cxx-abi.github.io/cxx-abi/abi-eh.html>`_. A description of the
3636
exception frame format can be found at `Exception Frames
3737
<http://refspecs.linuxfoundation.org/LSB_3.0.0/LSB-Core-generic/LSB-Core-generic/ehframechpt.html>`_,
@@ -145,7 +145,7 @@ exception. In those circumstances, the LLVM C++ front-end replaces the call with
145145
an ``invoke`` instruction. Unlike a call, the ``invoke`` has two potential
146146
continuation points:
147147

148-
#. where to continue when the call succeeds as per normal, and
148+
#. where to continue when the call succeeds normally, and
149149

150150
#. where to continue if the call raises an exception, either by a throw or the
151151
unwinding of a throw
@@ -280,7 +280,7 @@ Throw Filters
280280
-------------
281281

282282
Prior to C++17, C++ allowed the specification of which exception types may be
283-
thrown from a function. To represent this, a top level landing pad may exist to
283+
thrown from a function. To represent this, a top-level landing pad may exist to
284284
filter out invalid types. To express this in LLVM code the :ref:`i_landingpad`
285285
will have a filter clause. The clause consists of an array of type infos.
286286
``landingpad`` will return a negative value
@@ -437,7 +437,7 @@ exception handling frame that defines information common to all functions in the
437437
unit.
438438

439439
The format of this call frame information (CFI) is often platform-dependent,
440-
however. ARM, for example, defines their own format. Apple has their own compact
440+
however. ARM, for example, defines its own format. Apple has its own compact
441441
unwind info format. On Windows, another format is used for all architectures
442442
since 32-bit x86. LLVM will emit whatever information is required by the
443443
target.
@@ -467,7 +467,7 @@ on Itanium C++ ABI platforms. The fundamental difference between the two models
467467
is that Itanium EH is designed around the idea of "successive unwinding," while
468468
Windows EH is not.
469469

470-
Under Itanium, throwing an exception typically involves allocating thread local
470+
Under Itanium, throwing an exception typically involves allocating thread-local
471471
memory to hold the exception, and calling into the EH runtime. The runtime
472472
identifies frames with appropriate exception handling actions, and successively
473473
resets the register context of the current thread to the most recently active
@@ -482,7 +482,7 @@ release its memory, and resume normal control flow.
482482
The Windows EH model does not use these successive register context resets.
483483
Instead, the active exception is typically described by a frame on the stack.
484484
In the case of C++ exceptions, the exception object is allocated in stack memory
485-
and its address is passed to ``__CxxThrowException``. General purpose structured
485+
and its address is passed to ``__CxxThrowException``. General-purpose structured
486486
exceptions (SEH) are more analogous to Linux signals, and they are dispatched by
487487
userspace DLLs provided with Windows. Each frame on the stack has an assigned EH
488488
personality routine, which decides what actions to take to handle the exception.
@@ -504,15 +504,15 @@ The C++ personality also uses funclets to contain the code for catch blocks
504504
(i.e. all user code between the braces in ``catch (Type obj) { ... }``). The
505505
runtime must use funclets for catch bodies because the C++ exception object is
506506
allocated in a child stack frame of the function handling the exception. If the
507-
runtime rewound the stack back to frame of the catch, the memory holding the
507+
runtime rewound the stack back to the frame of the catch, the memory holding the
508508
exception would be overwritten quickly by subsequent function calls. The use of
509509
funclets also allows ``__CxxFrameHandler3`` to implement rethrow without
510510
resorting to TLS. Instead, the runtime throws a special exception, and then uses
511511
SEH (``__try / __except``) to resume execution with new information in the child
512512
frame.
513513

514514
In other words, the successive unwinding approach is incompatible with Visual
515-
C++ exceptions and general purpose Windows exception handling. Because the C++
515+
C++ exceptions and general-purpose Windows exception handling. Because the C++
516516
exception object lives in stack memory, LLVM cannot provide a custom personality
517517
function that uses landingpads. Similarly, SEH does not provide any mechanism
518518
to rethrow an exception or continue unwinding. Therefore, LLVM must use the IR
@@ -780,8 +780,8 @@ structure, which funclet-based personalities may require.
780780
Exception Handling support on the target
781781
=================================================
782782

783-
In order to support exception handling on particular target, there are a few
784-
items need to be implemented.
783+
In order to support exception handling on a particular target, there are a few
784+
items that need to be implemented.
785785

786786
* CFI directives
787787

@@ -791,7 +791,7 @@ items need to be implemented.
791791
to specify how to calculate the CFA (Canonical Frame Address) and how register
792792
is restored from the address pointed by the CFA with an offset. The assembler
793793
is instructed by CFI directives to build ``.eh_frame`` section, which is used
794-
by th unwinder to unwind stack during exception handling.
794+
by the unwinder to unwind the stack during exception handling.
795795

796796
* ``getExceptionPointerRegister`` and ``getExceptionSelectorRegister``
797797

@@ -807,25 +807,25 @@ items need to be implemented.
807807
which adjusts the stack by offset and then jumps to the handler. ``__builtin_eh_return``
808808
is used in GCC unwinder (`libgcc <https://gcc.gnu.org/onlinedocs/gccint/Libgcc.html>`_),
809809
but not in LLVM unwinder (`libunwind <https://clang.llvm.org/docs/Toolchain.html#unwind-library>`_).
810-
If you are on the top of ``libgcc`` and have particular requirement on your target,
810+
If you are on the top of ``libgcc`` and have a particular requirement on your target,
811811
you have to handle ``EH_RETURN`` in ``TargetLowering``.
812812

813813
If you don't leverage the existing runtime (``libstdc++`` and ``libgcc``),
814-
you have to take a look on `libc++ <https://libcxx.llvm.org/>`_ and
814+
you have to take a look at `libc++ <https://libcxx.llvm.org/>`_ and
815815
`libunwind <https://clang.llvm.org/docs/Toolchain.html#unwind-library>`_
816-
to see what have to be done there. For ``libunwind``, you have to do the following
816+
to see what has to be done there. For ``libunwind``, you have to do the following:
817817

818818
* ``__libunwind_config.h``
819819

820820
Define macros for your target.
821821

822822
* ``include/libunwind.h``
823823

824-
Define enum for the target registers.
824+
Define an enum for the target registers.
825825

826826
* ``src/Registers.hpp``
827827

828-
Define ``Registers`` class for your target, implement setter and getter functions.
828+
Define a ``Registers`` class for your target, implement setter and getter functions.
829829

830830
* ``src/UnwindCursor.hpp``
831831

@@ -834,8 +834,8 @@ to see what have to be done there. For ``libunwind``, you have to do the followi
834834

835835
* ``src/UnwindRegistersRestore.S``
836836

837-
Write an assembly function to restore all your target registers from the memory.
837+
Write an assembly function to restore all your target registers from memory.
838838

839839
* ``src/UnwindRegistersSave.S``
840840

841-
Write an assembly function to save all your target registers on the memory.
841+
Write an assembly function to save all your target registers to memory.

0 commit comments

Comments
 (0)