Permalink
Browse files

Tidy up STable fields a bit, add TiedVariable serialize

  • Loading branch information...
1 parent d91ecdf commit ab3523892fb4ff529409361253201302c8236567 @sorear committed Oct 11, 2011
Showing with 32 additions and 15 deletions.
  1. +8 −2 lib/Kernel.cs
  2. +20 −10 lib/ObjModel.cs
  3. +4 −3 lib/Serialize.cs
View
@@ -265,8 +265,14 @@ public sealed class TiedVariable: Variable {
public override Variable GetVar() {
return Kernel.BoxAnyMO<Variable>(this, Kernel.ScalarMO);
}
- public override void Freeze(FreezeBuffer fb) { throw new NotImplementedException(); }
-}
+ public override void Freeze(FreezeBuffer fb) {
+ fb.Byte((byte)SerializationCode.TiedVariable);
+ fb.ObjRef(type);
+ fb.ObjRef(fetch);
+ fb.ObjRef(store);
+ fb.ObjRef(whence);
+ }
+ }
// Used to make Variable sharing explicit in some cases; will eventually be
// the only way to share a bvalue
View
@@ -632,6 +632,7 @@ public class DispatchSet {
// (Although due to quirks of the C# implementation, Cursor and
// BoxObject can share the P6opaque STable)
public class STable: IFreeze {
+ /// well-known context handlers {{{
public static readonly ContextHandler<Variable> CallStr
= new CtxCallMethod("Str");
public static readonly ContextHandler<Variable> CallBool
@@ -684,18 +685,35 @@ public class STable: IFreeze {
= new PushyCallMethod("push");
public static readonly PushyHandler CallUnshift
= new PushyCallMethod("unshift");
+ /// }}}
+ /// "true" state {{{
public P6how mo;
public P6any how, who;
public P6any typeObject, initObject;
public Variable typeVar, initVar;
- public int fixups_from;
public string name;
public bool isSubset;
+ public Type box_type;
+ /// }}}
+
+ /// compositon-created cache {{{
public LexerCache lexcache;
+ public Dictionary<string, int> slotMap = new Dictionary<string, int>();
+ public int nslots = 0;
+ public string[] all_slot;
+ /// }}}
+
+ /// caches set up by Revalidate {{{
+ public Dictionary<string, DispatchEnt> mro_methods;
+ public Dictionary<string, P6any> private_mro;
+ public P6how.AttrInfo[] init_program;
+ /// }}}
+
+ /// caches set up in SetupVTables {{{
public ContextHandler<Variable> mro_Str, mro_Numeric, mro_Bool,
mro_defined, mro_iterator, mro_item, mro_list, mro_hash,
mro_shift, mro_pop;
@@ -713,17 +731,9 @@ public class STable: IFreeze {
public InvokeHandler mro_INVOKE;
public PushyHandler mro_push, mro_unshift;
- public Dictionary<string, DispatchEnt> mro_methods;
- public Dictionary<string, P6any> private_mro;
-
- public Dictionary<string, int> slotMap = new Dictionary<string, int>();
- public int nslots = 0;
- public string[] all_slot;
- public P6how.AttrInfo[] init_program;
-
public int num_rank = -1;
public bool is_any = false;
- public Type box_type;
+ /// }}}
public STable(string name) {
this.name = name;
View
@@ -199,12 +199,13 @@ enum SerializationCode : byte {
// miscellany
Variant, // allow 5, see FallbackFreeze
- // variables - allow 4 codes each for flag compaction
- SimpleVariable = Variant + 5,
+ // variables
+ SimpleVariable = Variant + 5, // allow 4 for flags
SubstrLValue = SimpleVariable + 4,
+ TiedVariable,
// vivification hooks
- SubViviHook = SubstrLValue + 4,
+ SubViviHook,
ArrayViviHook,
NewArrayViviHook,
HashViviHook,

0 comments on commit ab35238

Please sign in to comment.