Commit 62fda8f6 authored by John van Groningen's avatar John van Groningen
Browse files

refactor, remove function backEndPreprocess, move constructors...

refactor, remove function backEndPreprocess, move constructors VI_SequenceNumber and VI_AliasSequenceNumber from module syntax to backendconvert, remove imports of module backendpreprocess
parent bbee9443
......@@ -4,7 +4,9 @@ import StdEnv, compare_types
from StdFunc import return
import frontend
import backend
import backendsupport, backendpreprocess
import backendsupport
:: VarInfo | VI_SequenceNumber !Int | VI_AliasSequenceNumber !VarInfoPtr;
// trace macro
(-*->) infixl
......@@ -537,7 +539,7 @@ where
= case vi of
VI_SequenceNumber sequenceNumber
-> (sequenceNumber,dvs)
VI_AliasSequenceNumber {var_info_ptr}
VI_AliasSequenceNumber var_info_ptr
-> assignOrGetVariableSequenceNumber var_info_ptr dvs
_
# {dvs_sequenceNumber,dvs_varHeap} = dvs
......@@ -560,14 +562,14 @@ instance declareVars FreeVar where
= declareVariable BELhsNodeId freeVar.fv_info_ptr freeVar.fv_ident.id_name dvs
instance declareVars LetBind where
declareVars {lb_src=App {app_symb, app_args=[Var bound_var:_]}, lb_dst=freeVar} aliasDummyId dvs
declareVars {lb_src=App {app_symb, app_args=[Var {var_info_ptr}:_]}, lb_dst=freeVar} aliasDummyId dvs
| not (isNilPtr app_symb.symb_ident.id_info) && app_symb.symb_ident==aliasDummyId
# (vi, dvs_varHeap) = readPtr bound_var.var_info_ptr dvs.dvs_varHeap
non_alias_bound_var = case vi of
VI_AliasSequenceNumber alias_bound_var -> alias_bound_var
_ -> bound_var
# (vi, dvs_varHeap) = readPtr var_info_ptr dvs.dvs_varHeap
non_alias_bound_var_info_ptr = case vi of
VI_AliasSequenceNumber alias_var_info_ptr -> alias_var_info_ptr
_ -> var_info_ptr
dvs & dvs_varHeap
= writePtr freeVar.fv_info_ptr (VI_AliasSequenceNumber non_alias_bound_var) dvs_varHeap
= writePtr freeVar.fv_info_ptr (VI_AliasSequenceNumber non_alias_bound_var_info_ptr) dvs_varHeap
= dvs // we have an alias. Don't declare the same variable twice
= declareVariable BERhsNodeId freeVar.fv_info_ptr freeVar.fv_ident.id_name dvs
declareVars {lb_dst=freeVar} _ dvs
......@@ -2521,7 +2523,7 @@ getVariableSequenceNumber varInfoPtr be
= case vi of
VI_SequenceNumber sequenceNumber
-> (sequenceNumber,be)
VI_AliasSequenceNumber {var_info_ptr}
VI_AliasSequenceNumber var_info_ptr
-> getVariableSequenceNumber var_info_ptr be
set_dictionary_field_for_instance_member_functions :: !Int !{#ClassInstance} !{#ClassDef} !{#CheckedTypeDef} !{#SelectorDef} !{#FunDef} !Int !{#DclModule} !*BackEndState -> *BackEndState
......
......@@ -4,7 +4,7 @@ import StdEnv
import frontend
import backend
import backendpreprocess, backendsupport, backendconvert
import backendsupport, backendconvert
import partition
from filesystem import fremove
......@@ -13,22 +13,6 @@ backEndInterface :: !{#Char} [{#Char}] !ListTypesOption !{#Char} !PredefinedSymb
-> (!Bool,!*VarHeap,!*TypeVarHeap,!*AttrVarHeap,!*File,!*File,!*Files)
backEndInterface outputFileName commandLineArgs listTypes typesPath predef_symbols syntaxTree=:{fe_icl,fe_components,fe_dcls} main_dcl_module_n
var_heap type_var_heap attrHeap errorFile outFile files
# varHeap
= backEndPreprocess predefined_idents.[PD_DummyForStrictAliasFun] functionIndices fe_icl var_heap
with
functionIndices = function_indices 0 fe_components
function_indices i components
| i<size components
= function_indices2 components.[i].component_members i components
= []
function_indices2 (ComponentMember member members) i components
= [member : function_indices2 members i components]
function_indices2 (GeneratedComponentMember member _ members) i components
= [member : function_indices2 members i components]
function_indices2 NoComponentMembers i components
= function_indices (i+1) components
# backEndFiles = 0
# (backEnd, backEndFiles)
= BEInit (length commandLineArgs) backEndFiles
......@@ -47,7 +31,7 @@ backEndInterface outputFileName commandLineArgs listTypes typesPath predef_symbo
= (backEndFiles == 0 && False, var_heap, type_var_heap, attrHeap, errorFile, outFile, files)
# (type_var_heap,var_heap,attrHeap,backEnd)
= backEndConvertModules predef_symbols syntaxTree main_dcl_module_n type_var_heap varHeap attrHeap backEnd
= backEndConvertModules predef_symbols syntaxTree main_dcl_module_n type_var_heap var_heap attrHeap backEnd
# (fail_success_or_use_clean_file_io, backEnd)
= BEGenerateStatesAndOptimise backEnd
| fail_success_or_use_clean_file_io==2
......
/*
module owner: Ronny Wichers Schreur
*/
definition module backendpreprocess
import checksupport
// assign sequence numbers to all variables in the syntax tree
backEndPreprocess :: !Ident ![Index] !IclModule !*VarHeap -> *VarHeap
implementation module backendpreprocess
import checksupport
import Heap
backEndPreprocess :: !Ident ![Index] !IclModule !*VarHeap -> *VarHeap
backEndPreprocess aliasDummyId functionIndices iclModule varHeap
= varHeap
......@@ -805,7 +805,6 @@ pIsSafe :== True
VI_ForwardClassVar !VarInfoPtr | /* to hold the dictionary variable generated during overloading */
VI_ForwardClassVars !VarInfoPtr !VarInfo |
VI_ForwardTypeContextVar !VarInfoPtr |
VI_SequenceNumber !Int | VI_AliasSequenceNumber !BoundVar |
VI_Used | /* for indicating that an imported function has been used */
VI_PropagationType !SymbolType | /* for storing the type with propagation environment of an imported function */
VI_ExpandedType !SymbolType | /* for storing the (expanded) type of an imported function */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment