Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
compiler
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
16
Issues
16
List
Boards
Labels
Service Desk
Milestones
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
clean-compiler-and-rts
compiler
Commits
4d6e56c7
Commit
4d6e56c7
authored
Jun 18, 2020
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor, remove copying of the dcl_modules and modules(CommonDefs) arrays in convertGenenerics
parent
160a29ce
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
21 deletions
+33
-21
frontend/frontend.icl
frontend/frontend.icl
+22
-5
frontend/generics1.dcl
frontend/generics1.dcl
+4
-4
frontend/generics1.icl
frontend/generics1.icl
+7
-12
No files found.
frontend/frontend.icl
View file @
4d6e56c7
...
...
@@ -53,7 +53,7 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo
#
(
ok
,
icl_mod
,
dcl_mods
,
groups
,
cached_dcl_macros
,
main_dcl_module_n
,
heaps
,
predef_symbols
,
symbol_table
,
error
,
directly_imported_dcl_modules
)
=
checkModule
mod
global_fun_range
mod_functions
support_dynamics
dynamic_type_used
dcl_module_n_in_cache
optional_dcl_mod
modules
cached_dcl_modules
cached_dcl_macros
predef_symbols
symbol_table
error
heaps
hash_table
=
{
hash_table
&
hte_symbol_heap
=
symbol_table
}
hash_table
&
hte_symbol_heap
=
symbol_table
|
not
ok
=
(
No
,{},
dcl_mods
,
main_dcl_module_n
,
predef_symbols
,
hash_table
,
files
,
error
,
io
,
out
,
tcl_file
,
heaps
)
...
...
@@ -123,14 +123,15 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo
type_heaps
=
{
type_heaps
&
th_vars
=
th_vars
}
#
heaps
=
{
heaps
&
hp_type_heaps
=
type_heaps
,
hp_expression_heap
=
hp_expression_heap
,
hp_generic_heap
=
gen_heap
,
hp_var_heap
=
hp_var_heap
}
#
heaps
&
hp_type_heaps
=
type_heaps
,
hp_expression_heap
=
hp_expression_heap
,
hp_generic_heap
=
gen_heap
,
hp_var_heap
=
hp_var_heap
|
not
error_admin
.
ea_ok
=
(
No
,{},
dcl_mods
,
main_dcl_module_n
,
predef_symbols
,
hash_table
,
files
,
error_admin
.
ea_file
,
io
,
out
,
tcl_file
,
heaps
)
#!
start_index_generic_classes
=
size
icl_common
.
com_class_defs
;
#
(
saved_main_dcl_common
,
ti_common_defs
)
=
replace
{#
dcl_common
\\
{
dcl_common
}<-:
dcl_mods
}
main_dcl_module_n
icl_common
#
(
ti_common_defs
,
dcl_mods
)
=
copy_common_defs_from_dcl_modules
dcl_mods
#
(
saved_main_dcl_common
,
ti_common_defs
)
=
replace
ti_common_defs
main_dcl_module_n
icl_common
#!
(
ti_common_defs
,
groups
,
fun_defs
,
td_infos
,
heaps
,
hash_table
,
predef_symbols
,
dcl_mods
,
cached_dcl_macros
,
error_admin
)
=
case
options
.
feo_generics
of
...
...
@@ -140,9 +141,9 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo
False
->
(
ti_common_defs
,
groups
,
fun_defs
,
td_infos
,
heaps
,
hash_table
,
predef_symbols
,
dcl_mods
,
cached_dcl_macros
,
error_admin
)
#
(
icl_common
,
ti_common_defs
)
=
replace
{#
x
\\
x
<-:
ti_common_defs
}
main_dcl_module_n
saved_main_dcl_common
#
(
icl_common
,
ti_common_defs
)
=
replace
ti_common_defs
main_dcl_module_n
saved_main_dcl_common
#
dcl_mods
=
{
{
dcl_mod
&
dcl_common
=
common
}
\\
dcl_mod
<-:
dcl_mods
&
common
<-:
ti_common_defs
}
#
dcl_mods
&
[
module_n
].
dcl_common
=
common
\\
common
<-:
ti_common_defs
&
module_n
<-[
0
..]
#
icl_mod
=
{
icl_mod
&
icl_common
=
icl_common
}
...
...
@@ -306,6 +307,22 @@ frontEndInterface opt_file_dir_time options mod_ident search_paths cached_dcl_mo
#!
nr_of_dcl_mods
=
size
dcl_mods
=
arrayCopyBegin
dcl_mods
nr_of_dcl_mods
copy_common_defs_from_dcl_modules
::
!*{#
DclModule
}
->
(!*{#
CommonDefs
},!*{#
DclModule
})
copy_common_defs_from_dcl_modules
dcl_mods
#
(
n_dcl_mods
,
dcl_mods
)
=
usize
dcl_mods
|
n_dcl_mods
==
0
=
({#},
dcl_mods
)
#
(
common_defs_0
,
dcl_mods
)
=
dcl_mods
![
0
].
dcl_common
=
copy_common_defs
1
(
createArray
n_dcl_mods
common_defs_0
)
dcl_mods
copy_common_defs
::
!
Int
!*{#
CommonDefs
}
!*{#
DclModule
}
->
(!*{#
CommonDefs
},!*{#
DclModule
})
copy_common_defs
module_n
common_defs
dcl_mods
|
module_n
<
size
dcl_mods
#
(
common_def
,
dcl_mods
)
=
dcl_mods
![
module_n
].
dcl_common
#
common_defs
&
[
module_n
]
=
common_def
=
copy_common_defs
(
module_n
+1
)
common_defs
dcl_mods
=
(
common_defs
,
dcl_mods
)
clear_group_indices_of_macros
::
!*{#*{#
FunDef
}}
->
*{#*{#
FunDef
}}
clear_group_indices_of_macros
cached_dcl_macros
=
clear_group_indices1
0
cached_dcl_macros
...
...
frontend/generics1.dcl
View file @
4d6e56c7
...
...
@@ -6,24 +6,24 @@ from transform import ::Group
convertGenerics
::
!
Int
!
NumberSet
!
{#
CommonDefs
}
!
*{#
CommonDefs
}
!{!
Group
}
!*{#
FunDef
}
!*
TypeDefInfos
!*
Heaps
!*
HashTable
!*
PredefinedSymbols
!
u
:
{#
DclModule
}
!
*
{#
DclModule
}
!*{#*{#
FunDef
}}
!*
ErrorAdmin
->
(
!{#
CommonDefs
}
->
(
!
*
{#
CommonDefs
}
,
!{!
Group
}
,
!*{#
FunDef
}
,
!*
TypeDefInfos
,
!*
Heaps
,
!*
HashTable
,
!*
PredefinedSymbols
,
!
u
:
{#
DclModule
}
,
!
*
{#
DclModule
}
,
!*{#*{#
FunDef
}}
,
!*
ErrorAdmin
)
frontend/generics1.icl
View file @
4d6e56c7
...
...
@@ -106,30 +106,28 @@ FIELD_NewType_Mask:==8;
convertGenerics
::
!
Int
// index of the main dcl module
!
NumberSet
// set of used modules
!
{#
CommonDefs
}
// common definitions of all modules
!
*{#
CommonDefs
}
// common definitions of all modules
!{!
Group
}
// groups of functions
!*{#
FunDef
}
// functions
!*
TypeDefInfos
// type definition information of all modules
!*
Heaps
// all heaps
!*
HashTable
// needed for what creating class dictionaries
!*
PredefinedSymbols
// predefined symbols
!
u
:{#
DclModule
}
// dcl modules
!
*{#
DclModule
}
// dcl modules
!*{#*{#
FunDef
}}
// dcl macros
!*
ErrorAdmin
// to report errors
->
(
!{#
CommonDefs
}
// common definitions of all modules
->
(
!
*
{#
CommonDefs
}
// common definitions of all modules
,
!{!
Group
}
// groups of functions
,
!*{#
FunDef
}
// function definitions
,
!*
TypeDefInfos
// type definition infos
,
!*
Heaps
// all heaps
,
!*
HashTable
// needed for creating class dictinaries
,
!*
PredefinedSymbols
// predefined symbols
,
!
u
:
{#
DclModule
}
// dcl modules
,
!
*
{#
DclModule
}
// dcl modules
,
!*{#*{#
FunDef
}}
// dcl macros
,
!*
ErrorAdmin
// to report errors
)
convertGenerics
main_dcl_module_n
used_module_numbers
modules
groups
funs
td_infos
heaps
hash_table
u_predefs
dcl_modules
dcl_macros
error
#!
modules
=
{
x
\\
x
<-:
modules
}
// unique copy
#!
dcl_modules
=
{
x
\\
x
<-:
dcl_modules
}
// unique copy
#!
size_predefs
=
size
u_predefs
#!
(
predefs
,
u_predefs
)
=
arrayCopyBegin
u_predefs
size_predefs
// non-unique copy
...
...
@@ -2006,8 +2004,7 @@ where
,
ds_arity
=
0
,
ds_index
=
NoIndex
/*index in the type def table, filled in later*/
}
#!
class_def
=
{
class_ident
=
class_ident
,
=
{
class_ident
=
class_ident
,
class_arity
=
1
,
class_args
=
[
class_var
],
class_context
=
[],
...
...
@@ -2017,7 +2014,6 @@ where
class_cons_vars
=
0
,
// dotted class variables
class_dictionary
=
class_dictionary
}
=
class_def
// Convert generic cases
...
...
@@ -5104,8 +5100,7 @@ where
clear_type
(
CV
tv
:@:
_)
th
=
clear_type_var
tv
th
clear_type
(
TFA
atvs
type
)
th
#!
th
=
foldSt
clear_attr
[
atv_attribute
\\
{
atv_attribute
}
<-
atvs
]
th
#!
th
=
foldSt
clear_type_var
[
atv_variable
\\
{
atv_variable
}
<-
atvs
]
th
=
th
=
foldSt
clear_type_var
[
atv_variable
\\
{
atv_variable
}
<-
atvs
]
th
clear_type
_
th
=
th
clear_atype
{
at_attribute
}
th
...
...
@@ -5114,7 +5109,7 @@ where
clear_attr
(
TA_Var
av
)
th
=
clear_attr_var
av
th
clear_attr
(
TA_RootVar
av
)
th
=
clear_attr_var
av
th
clear_attr
_
th
=
th
clear_type_var
{
tv_info_ptr
}
th
=:{
th_vars
}
=
{
th
&
th_vars
=
writePtr
tv_info_ptr
TVI_Empty
th_vars
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment