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
c5e0c628
Commit
c5e0c628
authored
Feb 01, 2018
by
John van Groningen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove some unnecessary update_a and pop_a instructions when creating an ARRAY node
parent
90bc14c1
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
25 deletions
+36
-25
backendC/CleanCompilerSources/codegen.c
backendC/CleanCompilerSources/codegen.c
+3
-2
backendC/CleanCompilerSources/codegen1.c
backendC/CleanCompilerSources/codegen1.c
+3
-7
backendC/CleanCompilerSources/codegen2.c
backendC/CleanCompilerSources/codegen2.c
+15
-13
backendC/CleanCompilerSources/codegen3.c
backendC/CleanCompilerSources/codegen3.c
+8
-2
backendC/CleanCompilerSources/instructions.c
backendC/CleanCompilerSources/instructions.c
+6
-1
backendC/CleanCompilerSources/instructions.h
backendC/CleanCompilerSources/instructions.h
+1
-0
No files found.
backendC/CleanCompilerSources/codegen.c
View file @
c5e0c628
...
...
@@ -930,16 +930,17 @@ static void CodeRule (ImpRuleP rule)
case
TupleState
:
BuildTuple
(
asize
,
bsize
,
asize
,
bsize
,
function_state_p
[
-
1
].
state_arity
,
function_state_p
[
-
1
].
state_tuple_arguments
,
asize
,
bsize
,
asize
,
NormalFill
,
True
);
GenUpdatePopA
(
0
,
asize
);
break
;
case
RecordState
:
BuildRecord
(
function_state_p
[
-
1
].
state_record_symbol
,
asize
,
bsize
,
asize
,
bsize
,
asize
,
bsize
,
asize
,
NormalFill
,
True
);
GenUpdatePopA
(
0
,
asize
);
break
;
case
ArrayState
:
GenBuildArray
(
0
);
GenBuildArray
Pop
(
);
break
;
}
GenUpdatePopA
(
0
,
asize
);
}
GenPopB
(
bsize
);
...
...
backendC/CleanCompilerSources/codegen1.c
View file @
c5e0c628
...
...
@@ -1878,21 +1878,17 @@ void ApplyEntry (StateS *const function_state_p,int arity,Label ea_lab,int ea_la
case
TupleState
:
BuildTuple
(
asize
,
bsize
,
asize
,
bsize
,
function_state_p
[
-
1
].
state_arity
,
function_state_p
[
-
1
].
state_tuple_arguments
,
asize
,
bsize
,
asize
,
NormalFill
,
True
);
GenUpdatePopA
(
0
,
asize
);
break
;
case
RecordState
:
BuildRecord
(
function_state_p
[
-
1
].
state_record_symbol
,
asize
,
bsize
,
asize
,
bsize
,
asize
,
bsize
,
asize
,
NormalFill
,
True
);
GenUpdatePopA
(
0
,
asize
);
break
;
case
ArrayState
:
GenBuildArray
(
0
);
GenBuildArray
Pop
(
);
break
;
}
#if UPDATE_POP
GenUpdatePopA
(
0
,
asize
);
#else
GenUpdateA
(
0
,
asize
);
GenPopA
(
asize
);
#endif
GenPopB
(
bsize
);
GenRtn
(
1
,
0
,
OnAState
);
#if SHARE_UPDATE_CODE
...
...
backendC/CleanCompilerSources/codegen2.c
View file @
c5e0c628
...
...
@@ -687,19 +687,27 @@ void CoerceArgumentOnTopOfStack (int *asp_p,int *bsp_p,StateS argstate,StateS no
BuildTuple
(
*
asp_p
,
*
bsp_p
,
*
asp_p
,
*
bsp_p
,
nodestate
.
state_arity
,
nodestate
.
state_tuple_arguments
,
asize
,
bsize
,
*
asp_p
,
NormalFill
,
True
);
*
asp_p
+=
1
;
GenUpdatePopA
(
0
,
asize
);
*
asp_p
-=
asize
;
break
;
case
RecordState
:
BuildRecord
(
nodestate
.
state_record_symbol
,
*
asp_p
,
*
bsp_p
,
*
asp_p
,
*
bsp_p
,
asize
,
bsize
,
*
asp_p
,
NormalFill
,
True
);
*
asp_p
+=
1
;
GenUpdatePopA
(
0
,
asize
);
*
asp_p
-=
asize
;
break
;
case
ArrayState
:
if
(
asize
==
1
)
GenBuildArrayPop
();
else
{
GenBuildArray
(
0
);
++*
asp_p
;
break
;
}
GenUpdatePopA
(
0
,
asize
);
*
asp_p
-=
asize
;
}
break
;
}
GenPopB
(
bsize
);
*
bsp_p
-=
bsize
;
}
else
{
...
...
@@ -3845,9 +3853,8 @@ static void FillUpdateNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_i
}
if
(
update_immediately
){
#if 1
BuildArgs
(
record_arg
->
arg_next
,
asp_p
,
bsp_p
,
code_gen_node_ids_p
);
#endif
if
(
record_node
->
node_kind
==
NodeIdNode
){
NodeIdP
record_node_id
;
...
...
@@ -3860,9 +3867,6 @@ static void FillUpdateNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_i
#if BOXED_RECORDS
record_node_id
->
nid_mark2
|=
NID_RECORD_USED_BY_NON_SELECTOR_OR_UPDATES
;
#endif
#if 0
BuildArgs (record_arg->arg_next,asp_p,bsp_p,code_gen_node_ids_p);
#endif
DetermineSizeOfState
(
*
record_state_p
,
&
record_a_size
,
&
record_b_size
);
...
...
@@ -3896,11 +3900,9 @@ static void FillUpdateNode (Node node,int *asp_p,int *bsp_p,NodeId update_node_i
#endif
record_arg
->
arg_state
=*
record_state_p
;
#if 1
BuildArg
(
node
->
node_arguments
,
asp_p
,
bsp_p
,
code_gen_node_ids_p
);
#else
BuildArgs
(
node
->
node_arguments
,
asp_p
,
bsp_p
,
code_gen_node_ids_p
);
#endif
DetermineSizeOfState
(
*
record_state_p
,
&
record_a_size
,
&
record_b_size
);
{
...
...
backendC/CleanCompilerSources/codegen3.c
View file @
c5e0c628
...
...
@@ -255,15 +255,21 @@ void RedirectResultAndReturn (int asp,int bsp,int source_a_index,int source_b_in
BuildTuple
(
source_a_index
,
source_b_index
,
asp
,
bsp
,
offstate
.
state_arity
,
offstate
.
state_tuple_arguments
,
offasize
,
offbsize
,
0
,
ReleaseAndFill
,
True
);
GenUpdatePopA
(
0
,
asp
);
break
;
case
RecordState
:
BuildRecord
(
offstate
.
state_record_symbol
,
source_a_index
,
source_b_index
,
asp
,
bsp
,
offasize
,
offbsize
,
0
,
ReleaseAndFill
,
True
);
GenUpdatePopA
(
0
,
asp
);
break
;
case
ArrayState
:
if
(
asp
==
source_a_index
&&
asp
==
1
)
GenBuildArrayPop
();
else
{
GenBuildArray
(
asp
-
source_a_index
);
}
GenUpdatePopA
(
0
,
asp
);
}
}
GenPopB
(
bsp
);
}
else
{
switch
(
offstate
.
state_type
){
...
...
backendC/CleanCompilerSources/instructions.c
View file @
c5e0c628
...
...
@@ -2168,10 +2168,15 @@ void GenBuildU (Label symblab,int a_size,int b_size,Label contlab)
GenDescriptorOrNodeEntryLabel
(
contlab
);
}
void
GenBuildArrayPop
(
void
)
{
GenBuildh
(
&
BasicDescriptors
[
ArrayObj
],
1
);
}
void
GenBuildArray
(
int
argoffset
)
{
GenPushA
(
argoffset
);
GenBuild
h
(
&
BasicDescriptors
[
ArrayObj
],
1
);
GenBuild
ArrayPop
(
);
}
void
GenBuildString
(
SymbValue
val
)
...
...
backendC/CleanCompilerSources/instructions.h
View file @
c5e0c628
...
...
@@ -64,6 +64,7 @@ void GenBuild (Label symblab,int arity,Label contlab);
void
GenBuildh
(
Label
symblab
,
int
arity
);
void
GenBuildPartialFunctionh
(
Label
symblab
,
int
arity
);
void
GenBuildU
(
Label
symblab
,
int
a_size
,
int
b_size
,
Label
contlab
);
void
GenBuildArrayPop
(
void
);
void
GenBuildArray
(
int
argoffset
);
void
GenBuildString
(
SymbValue
val
);
...
...
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