diff options
author | Adrian Thurston <thurston@complang.org> | 2015-01-10 15:36:03 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2015-01-10 15:36:03 -0500 |
commit | ca923f14202030ea69729b60734c94b4584783c0 (patch) | |
tree | cac993451dfc53883460e52e7dea40423985fb44 /src/synthesis.cc | |
parent | b45f08baf7ac6a1846b7bc80c0fc01d278f2a41b (diff) | |
download | colm-ca923f14202030ea69729b60734c94b4584783c0.tar.gz |
more object semantics fixes and test case updates
Diffstat (limited to 'src/synthesis.cc')
-rw-r--r-- | src/synthesis.cc | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/synthesis.cc b/src/synthesis.cc index 9ef4d9e6..b3369e66 100644 --- a/src/synthesis.cc +++ b/src/synthesis.cc @@ -305,7 +305,17 @@ UniqueType *LangVarRef::loadField( Compiler *pd, CodeVect &code, UniqueType *elUT = el->typeRef->uniqueType; if ( elUT->typeId == TYPE_STRUCT || elUT->typeId == TYPE_GENERIC ) { - code.append( el->inGetValR ); + if ( forWriting ) { + /* The instruction, depends on whether or not we are reverting. */ + if ( pd->revertOn && revert ) + code.append( el->inGetValWV ); + else + code.append( el->inGetValWC ); + } + else { + /* Loading for writing */ + code.append( el->inGetValR ); + } } else { /* If it's a reference then we load it read always. */ @@ -319,7 +329,7 @@ UniqueType *LangVarRef::loadField( Compiler *pd, CodeVect &code, code.append( el->inGetWC ); } else { - /* Loading something for writing */ + /* Loading something for reading */ if ( elUT->typeId == TYPE_ITER ) code.append( elUT->iterDef->inGetCurR ); else @@ -2703,7 +2713,9 @@ void ObjectField::initField() inGetR = IN_GET_LOCAL_R; inGetWC = IN_GET_LOCAL_WC; inSetWC = IN_SET_LOCAL_WC; - inGetValR = IN_GET_LOCAL_VAL_R; + inGetValR = IN_GET_LOCAL_VAL_R; + inGetValWC = IN_GET_LOCAL_VAL_R; + inGetValWV = IN_GET_LOCAL_VAL_R; inSetValWC = IN_SET_LOCAL_VAL_WC; break; @@ -2728,6 +2740,8 @@ void ObjectField::initField() inSetWC = IN_SET_STRUCT_WC; inSetWV = IN_SET_STRUCT_WV; inGetValR = IN_GET_STRUCT_VAL_R; + inGetValWC = IN_GET_STRUCT_VAL_R; + inGetValWV = IN_GET_STRUCT_VAL_R; inSetValWC = IN_SET_STRUCT_VAL_WC; inSetValWV = IN_SET_STRUCT_VAL_WV; break; |