mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
codegen.c: gen_jmpdst always needs to generate relative address.
This commit is contained in:
@@ -398,17 +398,15 @@ gen_jmpdst(codegen_scope *s, uint32_t pc)
|
||||
{
|
||||
|
||||
if (pc == JMPLINK_START) {
|
||||
gen_S(s, 0);
|
||||
pc = 0;
|
||||
}
|
||||
else {
|
||||
uint32_t pos2 = s->pc+2;
|
||||
int32_t off = pc - pos2;
|
||||
uint32_t pos2 = s->pc+2;
|
||||
int32_t off = pc - pos2;
|
||||
|
||||
if (off > INT16_MAX || INT16_MIN > off) {
|
||||
codegen_error(s, "too big jump offset");
|
||||
}
|
||||
gen_S(s, (uint16_t)off);
|
||||
if (off > INT16_MAX || INT16_MIN > off) {
|
||||
codegen_error(s, "too big jump offset");
|
||||
}
|
||||
gen_S(s, (uint16_t)off);
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
|
||||
Reference in New Issue
Block a user