Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
TASTE
uPython-mirror
Commits
e5bcbcde
Commit
e5bcbcde
authored
Jan 22, 2015
by
Damien George
Browse files
py: Allow asmx64 to compile with -Wsign-compare.
See issue #699.
parent
6d1f5070
Changes
2
Hide whitespace changes
Inline
Side-by-side
py/asmx64.c
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
;
...
...
py/asmx64.h
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
);
...
...
Write
Preview
Supports
Markdown
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