Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
First pass at exception handling.
Makes basic try/CATCH work. Enough to pass 3 out of 8 tests in 44-try-catch.t.
- Loading branch information
Showing
12 changed files
with
248 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package org.perl6.nqp.runtime; | ||
|
|
||
| import org.perl6.nqp.sixmodel.reprs.VMExceptionInstance; | ||
|
|
||
| /* Describes an exception handler currently being processed. */ | ||
| public class HandlerInfo { | ||
| public VMExceptionInstance exObj; | ||
|
|
||
| public HandlerInfo(VMExceptionInstance exObj) { | ||
| this.exObj = exObj; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,18 @@ | ||
| package org.perl6.nqp.runtime; | ||
|
|
||
| import org.perl6.nqp.sixmodel.SixModelObject; | ||
|
|
||
| public class UnwindException extends RuntimeException { | ||
| private static final long serialVersionUID = -2452898396745530180L; | ||
|
|
||
| /* What we're unwinding to. */ | ||
| public long unwindTarget; | ||
|
|
||
| /* The category, if we're a simple handler. */ | ||
| public long category; | ||
|
|
||
| /* If there was a block handler, this is the result the block | ||
| * produced. | ||
| */ | ||
| public SixModelObject result; | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| package org.perl6.nqp.sixmodel.reprs; | ||
|
|
||
| import org.perl6.nqp.runtime.ThreadContext; | ||
| import org.perl6.nqp.sixmodel.REPR; | ||
| import org.perl6.nqp.sixmodel.STable; | ||
| import org.perl6.nqp.sixmodel.SerializationReader; | ||
| import org.perl6.nqp.sixmodel.SixModelObject; | ||
| import org.perl6.nqp.sixmodel.TypeObject; | ||
|
|
||
| public class VMException extends REPR { | ||
| public SixModelObject type_object_for(ThreadContext tc, SixModelObject HOW) { | ||
| STable st = new STable(this, HOW); | ||
| SixModelObject obj = new TypeObject(); | ||
| obj.st = st; | ||
| st.WHAT = obj; | ||
| return st.WHAT; | ||
| } | ||
|
|
||
| public SixModelObject allocate(ThreadContext tc, STable st) { | ||
| VMExceptionInstance obj = new VMExceptionInstance(); | ||
| obj.st = st; | ||
| return obj; | ||
| } | ||
|
|
||
| public SixModelObject deserialize_stub(ThreadContext tc, STable st) { | ||
| throw new RuntimeException("VMException does not participate in serialization"); | ||
| } | ||
|
|
||
| public void deserialize_finish(ThreadContext tc, STable st, | ||
| SerializationReader reader, SixModelObject obj) { | ||
| throw new RuntimeException("VMException does not participate in serialization"); | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| package org.perl6.nqp.sixmodel.reprs; | ||
|
|
||
| import org.perl6.nqp.runtime.CallFrame; | ||
| import org.perl6.nqp.sixmodel.SixModelObject; | ||
|
|
||
| public class VMExceptionInstance extends SixModelObject { | ||
| public String message; | ||
| public SixModelObject payload; | ||
| public long category; | ||
| public boolean resumable; | ||
| public CallFrame origin; | ||
| } |