From 808d9c80045087e680e8af1c0848ec529f45d110 Mon Sep 17 00:00:00 2001 From: abdul124 Date: Fri, 23 Aug 2024 12:12:00 +0800 Subject: [PATCH] compiler: restore exception ids used --- artiq/compiler/embedding.py | 17 ++++------------- artiq/test/lit/exceptions/catch_all.py | 4 ++-- artiq/test/lit/exceptions/catch_multi.py | 4 ++-- artiq/test/lit/exceptions/reraise.py | 2 +- artiq/test/lit/exceptions/reraise_update.py | 2 +- artiq/test/lit/exceptions/uncaught.py | 2 +- 6 files changed, 11 insertions(+), 20 deletions(-) diff --git a/artiq/compiler/embedding.py b/artiq/compiler/embedding.py index a5cb2e6e1..0af02b328 100644 --- a/artiq/compiler/embedding.py +++ b/artiq/compiler/embedding.py @@ -92,6 +92,7 @@ class EmbeddingMap: # The exceptions declared here must be defined in `artiq.coredevice.exceptions` # Verify synchronization by running the test cases in `artiq.test.coredevice.test_exceptions` self.preallocate_runtime_exception_names([ + "0:RuntimeError", "RTIOUnderflow", "RTIOOverflow", "RTIODestinationUnreachable", @@ -99,20 +100,10 @@ class EmbeddingMap: "I2CError", "CacheError", "SPIError", - "SubkernelError", - - "0:AssertionError", - "0:AttributeError", + "0:ZeroDivisionError", "0:IndexError", - "0:IOError", - "0:KeyError", - "0:NotImplementedError", - "0:OverflowError", - "0:RuntimeError", - "0:TimeoutError", - "0:TypeError", - "0:ValueError", - "0:ZeroDivisionError" + "UnwrapNoneError", + "SubkernelError", ]) def preallocate_runtime_exception_names(self, names): diff --git a/artiq/test/lit/exceptions/catch_all.py b/artiq/test/lit/exceptions/catch_all.py index f3f497f12..1b4c38b8e 100644 --- a/artiq/test/lit/exceptions/catch_all.py +++ b/artiq/test/lit/exceptions/catch_all.py @@ -8,7 +8,7 @@ def catch(f): except Exception as e: print(e) -# CHECK-L: 19(0, 0, 0) +# CHECK-L: 8(0, 0, 0) catch(lambda: 1/0) -# CHECK-L: 10(10, 1, 0) +# CHECK-L: 9(10, 1, 0) catch(lambda: [1.0][10]) diff --git a/artiq/test/lit/exceptions/catch_multi.py b/artiq/test/lit/exceptions/catch_multi.py index 72712785d..dbd8bcdec 100644 --- a/artiq/test/lit/exceptions/catch_multi.py +++ b/artiq/test/lit/exceptions/catch_multi.py @@ -10,7 +10,7 @@ def catch(f): except IndexError as ie: print(ie) -# CHECK-L: 19(0, 0, 0) +# CHECK-L: 8(0, 0, 0) catch(lambda: 1/0) -# CHECK-L: 10(10, 1, 0) +# CHECK-L: 9(10, 1, 0) catch(lambda: [1.0][10]) diff --git a/artiq/test/lit/exceptions/reraise.py b/artiq/test/lit/exceptions/reraise.py index ef3f02dd1..fd5eabd4a 100644 --- a/artiq/test/lit/exceptions/reraise.py +++ b/artiq/test/lit/exceptions/reraise.py @@ -3,7 +3,7 @@ # REQUIRES: exceptions def f(): - # CHECK-L: Uncaught 19 + # CHECK-L: Uncaught 8 # CHECK-L: at input.py:${LINE:+1}: 1/0 diff --git a/artiq/test/lit/exceptions/reraise_update.py b/artiq/test/lit/exceptions/reraise_update.py index 32e1d11dc..aac8cdae1 100644 --- a/artiq/test/lit/exceptions/reraise_update.py +++ b/artiq/test/lit/exceptions/reraise_update.py @@ -9,7 +9,7 @@ def g(): try: f() except Exception as e: - # CHECK-L: Uncaught 19 + # CHECK-L: Uncaught 8 # CHECK-L: at input.py:${LINE:+1}: raise e diff --git a/artiq/test/lit/exceptions/uncaught.py b/artiq/test/lit/exceptions/uncaught.py index a86f93b88..1d44d4b2a 100644 --- a/artiq/test/lit/exceptions/uncaught.py +++ b/artiq/test/lit/exceptions/uncaught.py @@ -2,6 +2,6 @@ # RUN: OutputCheck %s --file-to-check=%t # REQUIRES: exceptions -# CHECK-L: Uncaught 19: cannot divide by zero (0, 0, 0) +# CHECK-L: Uncaught 8: cannot divide by zero (0, 0, 0) # CHECK-L: at input.py:${LINE:+1}: 1/0