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
Initial preparations for container handling.
This rips out the port of a previous approach, stubs the current one that is needed for Rakudo, and updates the serializer for it.
- Loading branch information
Showing
5 changed files
with
55 additions
and
28 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
14 changes: 14 additions & 0 deletions
14
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/ContainerConfigurer.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,14 @@ | ||
| package org.perl6.nqp.sixmodel; | ||
| import org.perl6.nqp.runtime.ThreadContext; | ||
|
|
||
| /** | ||
| * A container configurer knows how to attach a certain type of container | ||
| * to an STable and configure it. | ||
| */ | ||
| public abstract class ContainerConfigurer { | ||
| /* Sets this container spec in place for the specified STable. */ | ||
| public abstract void setContainerSpec(ThreadContext tc, STable st); | ||
|
|
||
| /* Configures the container spec with the specified info. */ | ||
| public abstract void configureContainerSpec(ThreadContext tc, STable st, SixModelObject config); | ||
| } |
39 changes: 20 additions & 19 deletions
39
src/vm/jvm/runtime/org/perl6/nqp/sixmodel/ContainerSpec.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 |
|---|---|---|
| @@ -1,27 +1,28 @@ | ||
| package org.perl6.nqp.sixmodel; | ||
| import org.perl6.nqp.runtime.ThreadContext; | ||
|
|
||
| /** | ||
| * Language interop information that we hold if the type is declaring a | ||
| * container of some sort. | ||
| * A scalar container has a ContainerSpec hung off its STable. It should be a | ||
| * subclass of this abstract base class. | ||
| */ | ||
| public class ContainerSpec { | ||
| /** | ||
| * Class handle where we find the contained value. | ||
| */ | ||
| SixModelObject ClassHandle; | ||
| public abstract class ContainerSpec { | ||
| /* Fetches a value out of a container. Used for decontainerization. */ | ||
| public abstract SixModelObject fetch(ThreadContext tc, SixModelObject cont); | ||
|
|
||
| /** | ||
| * Attribute name where we find the contained value. | ||
| */ | ||
| String AttrName; | ||
| /* Stores a value in a container. Used for assignment. */ | ||
| public abstract void store(ThreadContext tc, SixModelObject cont, SixModelObject obj); | ||
|
|
||
| /** | ||
| * Attribute lookup hint used in gradual typing. | ||
| */ | ||
| int Hint; | ||
| /* Stores a value in a container, without any checking of it (this | ||
| * assumes an optimizer or something else already did it). Used for | ||
| * assignment. */ | ||
| public abstract void storeUnchecked(ThreadContext tc, SixModelObject cont, SixModelObject obj); | ||
|
|
||
| /** | ||
| * FETCH method if applicable. | ||
| */ | ||
| SixModelObject FetchMethod; | ||
| /* Name of this container specification. */ | ||
| public String name; | ||
|
|
||
| /* Serializes the container data, if any. */ | ||
| public abstract void serialize(ThreadContext tc, STable st, SerializationWriter writer); | ||
|
|
||
| /* Deserializes the container data, if any. */ | ||
| public abstract void deserialize(ThreadContext tc, STable st, SerializationReader reader); | ||
| } |
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