diff options
| author | John Hodge <tpg@ucc.asn.au> | 2019-06-02 11:55:02 +0800 | 
|---|---|---|
| committer | John Hodge <tpg@ucc.asn.au> | 2019-06-02 11:55:02 +0800 | 
| commit | dab72ad78160ecd2a4d1759174cee837a5bedcbc (patch) | |
| tree | d7b6f4a34435a163390150476e8fa532f9f2bdfb /src/trans/monomorphise.cpp | |
| parent | 599ed0a4cdaf7e05a1c8623c015a593106ea31ec (diff) | |
| download | mrust-dab72ad78160ecd2a4d1759174cee837a5bedcbc.tar.gz | |
MIR - Refactor LValue to reduce size and linked-list-ness (seems to have had a ~10% reduction in memory usage)
Diffstat (limited to 'src/trans/monomorphise.cpp')
| -rw-r--r-- | src/trans/monomorphise.cpp | 40 | 
1 files changed, 8 insertions, 32 deletions
| diff --git a/src/trans/monomorphise.cpp b/src/trans/monomorphise.cpp index 6c331d9c..b5099918 100644 --- a/src/trans/monomorphise.cpp +++ b/src/trans/monomorphise.cpp @@ -15,38 +15,14 @@  namespace {      ::MIR::LValue monomorph_LValue(const ::StaticTraitResolve& resolve, const Trans_Params& params, const ::MIR::LValue& tpl)      { -        TU_MATCHA( (tpl), (e), -        (Return, return e; ), -        (Argument,  return e; ), -        (Local,  return e; ), -        (Static, -            return box$(params.monomorph(resolve, *e)); -            ), -        (Field, -            return ::MIR::LValue::make_Field({ -                box$(monomorph_LValue(resolve, params, *e.val)), -                e.field_index -                }); -            ), -        (Deref, -            return ::MIR::LValue::make_Deref({ -                box$(monomorph_LValue(resolve, params, *e.val)) -                }); -            ), -        (Index, -            return ::MIR::LValue::make_Index({ -                box$(monomorph_LValue(resolve, params, *e.val)), -                box$(monomorph_LValue(resolve, params, *e.idx)) -                }); -            ), -        (Downcast, -            return ::MIR::LValue::make_Downcast({ -                box$(monomorph_LValue(resolve, params, *e.val)), -                e.variant_index -                }); -            ) -        ) -        throw ""; +        if( tpl.m_root.is_Static() ) +        { +            return ::MIR::LValue( ::MIR::LValue::Storage::new_Static(params.monomorph(resolve, tpl.m_root.as_Static())), tpl.m_wrappers ); +        } +        else +        { +            return tpl.clone(); +        }      }      ::MIR::Constant monomorph_Constant(const ::StaticTraitResolve& resolve, const Trans_Params& params, const ::MIR::Constant& tpl)      { | 
