Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
M
micropython
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
card10
micropython
Commits
e5bcbcde
Commit
e5bcbcde
authored
10 years ago
by
Damien George
Browse files
Options
Downloads
Patches
Plain Diff
py: Allow asmx64 to compile with -Wsign-compare.
See issue #699.
parent
6d1f5070
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
py/asmx64.c
+8
-7
8 additions, 7 deletions
py/asmx64.c
py/asmx64.h
+3
-3
3 additions, 3 deletions
py/asmx64.h
with
11 additions
and
10 deletions
py/asmx64.c
+
8
−
7
View file @
e5bcbcde
...
...
@@ -159,6 +159,7 @@ void asm_x64_start_pass(asm_x64_t *as, uint pass) {
void
asm_x64_end_pass
(
asm_x64_t
*
as
)
{
// could check labels are resolved...
(
void
)
as
;
}
// all functions must go through this one to emit bytes
...
...
@@ -501,11 +502,11 @@ void asm_x64_setcc_r8(asm_x64_t *as, int jcc_type, int dest_r8) {
asm_x64_write_byte_3
(
as
,
OPCODE_SETCC_RM8_A
,
OPCODE_SETCC_RM8_B
|
jcc_type
,
MODRM_R64
(
0
)
|
MODRM_RM_REG
|
MODRM_RM_R64
(
dest_r8
));
}
void
asm_x64_label_assign
(
asm_x64_t
*
as
,
in
t
label
)
{
void
asm_x64_label_assign
(
asm_x64_t
*
as
,
mp_uint_
t
label
)
{
assert
(
label
<
as
->
max_num_labels
);
if
(
as
->
pass
<
ASM_X64_PASS_EMIT
)
{
// assign label offset
assert
(
as
->
label_offsets
[
label
]
==
-
1
);
assert
(
as
->
label_offsets
[
label
]
==
(
mp_uint_t
)
-
1
);
as
->
label_offsets
[
label
]
=
as
->
code_offset
;
}
else
{
// ensure label offset has not changed from PASS_COMPUTE to PASS_EMIT
...
...
@@ -514,15 +515,15 @@ void asm_x64_label_assign(asm_x64_t *as, int label) {
}
}
STATIC
mp_uint_t
get_label_dest
(
asm_x64_t
*
as
,
in
t
label
)
{
STATIC
mp_uint_t
get_label_dest
(
asm_x64_t
*
as
,
mp_uint_
t
label
)
{
assert
(
label
<
as
->
max_num_labels
);
return
as
->
label_offsets
[
label
];
}
void
asm_x64_jmp_label
(
asm_x64_t
*
as
,
in
t
label
)
{
void
asm_x64_jmp_label
(
asm_x64_t
*
as
,
mp_uint_
t
label
)
{
mp_uint_t
dest
=
get_label_dest
(
as
,
label
);
mp_int_t
rel
=
dest
-
as
->
code_offset
;
if
(
dest
!=
-
1
&&
rel
<
0
)
{
if
(
dest
!=
(
mp_uint_t
)
-
1
&&
rel
<
0
)
{
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 8 bit relative jump
rel
-=
2
;
...
...
@@ -541,10 +542,10 @@ void asm_x64_jmp_label(asm_x64_t *as, int label) {
}
}
void
asm_x64_jcc_label
(
asm_x64_t
*
as
,
int
jcc_type
,
in
t
label
)
{
void
asm_x64_jcc_label
(
asm_x64_t
*
as
,
int
jcc_type
,
mp_uint_
t
label
)
{
mp_uint_t
dest
=
get_label_dest
(
as
,
label
);
mp_int_t
rel
=
dest
-
as
->
code_offset
;
if
(
dest
!=
-
1
&&
rel
<
0
)
{
if
(
dest
!=
(
mp_uint_t
)
-
1
&&
rel
<
0
)
{
// is a backwards jump, so we know the size of the jump on the first pass
// calculate rel assuming 8 bit relative jump
rel
-=
2
;
...
...
This diff is collapsed.
Click to expand it.
py/asmx64.h
+
3
−
3
View file @
e5bcbcde
...
...
@@ -104,9 +104,9 @@ void asm_x64_sub_r64_r64(asm_x64_t* as, int dest_r64, int src_r64);
void
asm_x64_cmp_r64_with_r64
(
asm_x64_t
*
as
,
int
src_r64_a
,
int
src_r64_b
);
void
asm_x64_test_r8_with_r8
(
asm_x64_t
*
as
,
int
src_r64_a
,
int
src_r64_b
);
void
asm_x64_setcc_r8
(
asm_x64_t
*
as
,
int
jcc_type
,
int
dest_r8
);
void
asm_x64_label_assign
(
asm_x64_t
*
as
,
in
t
label
);
void
asm_x64_jmp_label
(
asm_x64_t
*
as
,
in
t
label
);
void
asm_x64_jcc_label
(
asm_x64_t
*
as
,
int
jcc_type
,
in
t
label
);
void
asm_x64_label_assign
(
asm_x64_t
*
as
,
mp_uint_
t
label
);
void
asm_x64_jmp_label
(
asm_x64_t
*
as
,
mp_uint_
t
label
);
void
asm_x64_jcc_label
(
asm_x64_t
*
as
,
int
jcc_type
,
mp_uint_
t
label
);
void
asm_x64_entry
(
asm_x64_t
*
as
,
int
num_locals
);
void
asm_x64_exit
(
asm_x64_t
*
as
);
void
asm_x64_mov_local_to_r64
(
asm_x64_t
*
as
,
int
src_local_num
,
int
dest_r64
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment