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
f5bff41a
Commit
f5bff41a
authored
Jun 09, 2020
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add code to optimise just_symb and nothing_symb in optimisations.c
parent
a5f9bf00
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
54 additions
and
2 deletions
+54
-2
backendC/CleanCompilerSources/optimisations.c
backendC/CleanCompilerSources/optimisations.c
+52
-2
backendC/CleanCompilerSources/syntaxtr.t
backendC/CleanCompilerSources/syntaxtr.t
+2
-0
No files found.
backendC/CleanCompilerSources/optimisations.c
View file @
f5bff41a
...
...
@@ -1593,6 +1593,8 @@ static char *create_arguments_for_local_function (NodeP node_p,ArgS ***arg_h,Arg
}
else
if
(
arg_node
->
node_kind
==
NormalNode
){
#ifdef STRICT_STATE_FOR_LAZY_TUPLE_CONSTRUCTORS
if
(
BETWEEN
(
tuple_symb
,
nothing_symb
,
arg_node
->
node_symbol
->
symb_kind
)
&&
!
(
arg_node
->
node_symbol
->
symb_kind
==
cons_symb
&&
(
arg_node
->
node_symbol
->
symb_head_strictness
>
LAZY_CONS
||
arg_node
->
node_symbol
->
symb_tail_strictness
))
&&
!
(
arg_node
->
node_symbol
->
symb_kind
==
just_symb
&&
arg_node
->
node_symbol
->
symb_head_strictness
>
LAZY_CONS
)
&&
arg_node
->
node_state
.
state_type
==
SimpleState
&&
arg_node
->
node_state
.
state_kind
==
OnA
)
{
call_state_p
=&
StrictState
;
...
...
@@ -2292,8 +2294,37 @@ static void optimise_normal_node (Node node)
init_apply_symb_function_state_p
();
function_state_p
=
apply_symb_function_state_p
;
}
else
#endif
return
;
#endif
{
if
(
symbol
->
symb_kind
==
just_symb
&&
(
symbol
->
symb_head_strictness
==
STRICT_CONS
||
symbol
->
symb_head_strictness
==
UNBOXED_CONS
)
&&
node
->
node_arity
==
1
)
{
function_state_p
=
symbol
->
symb_head_strictness
==
STRICT_CONS
?
&
StrictState
:
symbol
->
symb_unboxed_cons_state_p
;
if
(
has_optimisable_argument
(
node
,
function_state_p
)
&&
!
can_build_strict_constructor_or_record_in_lazy_context
(
node
,
function_state_p
))
create_new_local_function
(
node
,
function_state_p
);
}
if
(
symbol
->
symb_kind
==
cons_symb
&&
node
->
node_arity
==
2
){
StateS
function_state
[
2
];
if
(
symbol
->
symb_head_strictness
==
STRICT_CONS
||
symbol
->
symb_head_strictness
==
UNBOXED_CONS
){
function_state
[
0
]
=
symbol
->
symb_head_strictness
==
STRICT_CONS
?
StrictState
:
*
symbol
->
symb_unboxed_cons_state_p
;
function_state
[
1
]
=
symbol
->
symb_tail_strictness
?
StrictState
:
LazyState
;
}
else
if
(
symbol
->
symb_tail_strictness
){
function_state
[
0
]
=
LazyState
;
function_state
[
1
]
=
StrictState
;
}
else
return
;
if
(
has_optimisable_argument
(
node
,
function_state
)
&&
!
can_build_strict_constructor_or_record_in_lazy_context
(
node
,
function_state
))
create_new_local_function
(
node
,
function_state
);
}
return
;
}
}
#ifdef MOVE_APPLY_NODES_IN_LAZY_CONTEXT_TO_NEW_FUNCTION
else
...
...
@@ -3122,6 +3153,25 @@ static void optimise_strict_constructor_in_lazy_context (NodeP node,FreeUniqueNo
}
}
}
}
else
if
(
symbol
->
symb_kind
==
just_symb
){
if
(
node
->
node_state
.
state_type
==
SimpleState
&&
node
->
node_state
.
state_kind
==
OnA
&&
node
->
node_arity
==
1
){
if
(
symbol
->
symb_head_strictness
==
LAZY_CONS
){
node
->
node_state
.
state_kind
=
StrictOnA
;
}
else
if
(
(
symbol
->
symb_head_strictness
==
STRICT_CONS
&&
ChangeArgumentNodeStatesIfStricter
(
node
,
&
StrictState
))
||
(
symbol
->
symb_head_strictness
==
UNBOXED_CONS
&&
ChangeArgumentNodeStatesIfStricter
(
node
,
symbol
->
symb_unboxed_cons_state_p
))
){
node
->
node_state
.
state_kind
=
StrictOnA
;
#ifdef REUSE_UNIQUE_NODES
if
(
*
f_node_ids_l
!=
NULL
)
try_insert_constructor_update_node
(
node
,
f_node_ids_l
);
#endif
}
}
}
else
if
(
symbol
->
symb_kind
==
nothing_symb
){
if
(
node
->
node_state
.
state_type
==
SimpleState
&&
node
->
node_state
.
state_kind
==
OnA
&&
node
->
node_arity
==
0
)
if
((
symbol
->
symb_head_strictness
&
1
)
==
0
)
node
->
node_state
.
state_kind
=
StrictOnA
;
}
}
...
...
backendC/CleanCompilerSources/syntaxtr.t
View file @
f5bff41a
...
...
@@ -122,7 +122,9 @@ struct unboxed_cons {
};
#endif
#define LAZY_CONS 0
#define OVERLOADED_CONS 1
#define STRICT_CONS 2
#define UNBOXED_OVERLOADED_CONS 3
#define UNBOXED_CONS 4
...
...
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