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
Add VMThread REPR and thread-related nqp:: ops.
- Loading branch information
Showing
8 changed files
with
136 additions
and
1 deletion.
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
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
34 changes: 34 additions & 0 deletions
34
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMThread.java
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,34 @@ | ||
| package org.perl6.nqp.sixmodel.reprs; | ||
|
|
||
| import org.perl6.nqp.runtime.ExceptionHandling; | ||
| 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 VMThread 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) { | ||
| VMThreadInstance obj = new VMThreadInstance(); | ||
| obj.st = st; | ||
| return obj; | ||
| } | ||
|
|
||
| public SixModelObject deserialize_stub(ThreadContext tc, STable st) { | ||
| throw ExceptionHandling.dieInternal(tc, "Cannot deserialize a thread"); | ||
| } | ||
|
|
||
| public void deserialize_finish(ThreadContext tc, STable st, | ||
| SerializationReader reader, SixModelObject obj) { | ||
| throw ExceptionHandling.dieInternal(tc, "Cannot deserialize a thread"); | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/reprs/VMThreadInstance.java
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,9 @@ | ||
| package org.perl6.nqp.sixmodel.reprs; | ||
|
|
||
| import java.lang.Thread; | ||
|
|
||
| import org.perl6.nqp.sixmodel.SixModelObject; | ||
|
|
||
| public class VMThreadInstance extends SixModelObject { | ||
| public Thread thread; | ||
| } |