Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
clean-compiler-and-rts
compiler
Commits
2d14eb47
Commit
2d14eb47
authored
Jan 22, 2019
by
johnvg@science.ru.nl
Browse files
make function set_mark in module partition faster, don't allocate a new array
parent
1be29a0b
Changes
1
Hide whitespace changes
Inline
Side-by-side
frontend/partition.icl
View file @
2d14eb47
...
...
@@ -214,8 +214,6 @@ where
::
Mark
=
{
m_fun
::
!
Int
,
m_mark
::
!
Int
}
create_marks
max_fun_nr
functions
// # marks = createArray max_fun_nr max_fun_nr
// = {marks & [i] = NotChecked \\ i <- functions}
=
{{
m_fun
=
fun
,
m_mark
=
NotChecked
}
\\
fun
<-
component_members_to_list
functions
}
component_members_to_list
(
ComponentMember
member
members
)
...
...
@@ -226,7 +224,6 @@ component_members_to_list NoComponentMembers
=
[]
get_mark
max_fun_nr
marks
fun
// :== marks.[fun]
:==
get_mark
0
marks
fun
max_fun_nr
where
get_mark
::
!
Int
!{#
Mark
}
!
Int
!
Int
->
Int
...
...
@@ -238,9 +235,14 @@ where
=
max_fun_nr
set_mark
marks
fun
val
// :== { marks & [fun] = val}
// :== { if (m_fun==fun) {m & m_mark = val} m \\ m=:{m_fun=m_fun} <-: marks}
:==
{
if
(
m
.
m_fun
==
fun
)
{
m
&
m_mark
=
val
}
m
\\
m
<-:
marks
}
:==
set_mark
0
marks
fun
val
where
set_mark
::
!
Int
!*{#
Mark
}
!
Int
!
Int
->
*{#
Mark
}
set_mark
i
marks
fun
val
// | i<size marks
|
marks
.[
i
].
m_fun
<>
fun
=
set_mark
(
i
+1
)
marks
fun
val
=
{
marks
&
[
i
].
m_mark
=
val
}
partitionateFunctions``
::
!
Int
!
Int
!*{#
FunDef
}
!
ComponentMembers
!
Index
!
Int
!
Int
!*
FunctionHeap
!*
PredefinedSymbols
!*
VarHeap
!*
ExpressionHeap
!*
ErrorAdmin
->
(!
Int
,
![
Component
],
!*{#
FunDef
},
!*
FunctionHeap
,
!*
PredefinedSymbols
,
!*
VarHeap
,
!*
ExpressionHeap
,
!*
ErrorAdmin
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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