Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
b0cea30f
Commit
b0cea30f
authored
Nov 28, 2020
by
dearblue
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change the catch handler address to 32 bits
Follow commit
7150c675
.
parent
6d07d9b3
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
11 deletions
+14
-11
include/mruby/irep.h
include/mruby/irep.h
+6
-3
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+3
-3
src/dump.c
src/dump.c
+1
-1
src/load.c
src/load.c
+1
-1
src/vm.c
src/vm.c
+3
-3
No files found.
include/mruby/irep.h
View file @
b0cea30f
...
...
@@ -47,9 +47,9 @@ enum mrb_catch_type {
struct
mrb_irep_catch_handler
{
uint8_t
type
;
/* enum mrb_catch_type */
uint8_t
begin
[
2
];
/* The starting address to match the hander. Includes this. */
uint8_t
end
[
2
];
/* The endpoint address that matches the hander. Not Includes this. */
uint8_t
target
[
2
];
/* The address to jump to if a match is made. */
uint8_t
begin
[
4
];
/* The starting address to match the hander. Includes this. */
uint8_t
end
[
4
];
/* The endpoint address that matches the hander. Not Includes this. */
uint8_t
target
[
4
];
/* The address to jump to if a match is made. */
};
/* Program data array struct */
...
...
@@ -139,6 +139,9 @@ mrb_irep_catch_handler_table(const struct mrb_irep *irep)
}
}
#define mrb_irep_catch_handler_pack(n, v) uint32_to_bin(n, v)
#define mrb_irep_catch_handler_unpack(v) bin_to_uint32(v)
MRB_END_DECL
#endif
/* MRUBY_IREP_H */
mrbgems/mruby-compiler/core/codegen.c
View file @
b0cea30f
...
...
@@ -3229,9 +3229,9 @@ catch_handler_set(codegen_scope *s, int ent, enum mrb_catch_type type, uint32_t
e
=
&
s
->
catch_table
[
ent
];
uint8_to_bin
(
type
,
&
e
->
type
);
uint16_to_bin
(
begin
,
e
->
begin
);
uint16_to_bin
(
end
,
e
->
end
);
uint16_to_bin
(
target
,
e
->
target
);
mrb_irep_catch_handler_pack
(
begin
,
e
->
begin
);
mrb_irep_catch_handler_pack
(
end
,
e
->
end
);
mrb_irep_catch_handler_pack
(
target
,
e
->
target
);
}
static
struct
RProc
*
...
...
src/dump.c
View file @
b0cea30f
...
...
@@ -277,7 +277,7 @@ write_catch_table_block(mrb_state *mrb, const mrb_irep *irep, uint8_t *buf)
{
uint8_t
*
cur
=
buf
;
const
struct
mrb_irep_catch_handler
*
e
=
mrb_irep_catch_handler_table
(
irep
);
mrb_static_assert1
(
sizeof
(
*
e
)
==
7
);
mrb_static_assert1
(
sizeof
(
*
e
)
==
13
);
if
(
e
==
NULL
)
return
0
;
/* irep->clen has already been written before iseq block */
...
...
src/load.c
View file @
b0cea30f
...
...
@@ -107,7 +107,7 @@ read_irep_record_1(mrb_state *mrb, const uint8_t *bin, size_t *len, uint8_t flag
if
(
irep
->
ilen
>
0
)
{
size_t
data_len
=
sizeof
(
mrb_code
)
*
irep
->
ilen
+
sizeof
(
struct
mrb_irep_catch_handler
)
*
irep
->
clen
;
mrb_static_assert1
(
sizeof
(
struct
mrb_irep_catch_handler
)
==
7
);
mrb_static_assert1
(
sizeof
(
struct
mrb_irep_catch_handler
)
==
13
);
if
(
SIZE_ERROR_MUL
(
irep
->
ilen
,
sizeof
(
mrb_code
)))
{
return
NULL
;
}
...
...
src/vm.c
View file @
b0cea30f
...
...
@@ -813,7 +813,7 @@ catch_handler_find(mrb_state *mrb, mrb_callinfo *ci, const mrb_code *pc, uint32_
e
=
mrb_irep_catch_handler_table
(
irep
)
+
cnt
-
1
;
for
(;
cnt
>
0
;
cnt
--
,
e
--
)
{
if
(((
UINT32_C
(
1
)
<<
e
->
type
)
&
filter
)
&&
catch_cover_p
(
xpc
,
bin_to_uint16
(
e
->
begin
),
bin_to_uint16
(
e
->
end
)))
{
catch_cover_p
(
xpc
,
mrb_irep_catch_handler_unpack
(
e
->
begin
),
mrb_irep_catch_handler_unpack
(
e
->
end
)))
{
return
e
;
}
}
...
...
@@ -1312,7 +1312,7 @@ RETRY_TRY_BLOCK:
ch
=
catch_handler_find
(
mrb
,
mrb
->
c
->
ci
,
pc
,
MRB_CATCH_FILTER_ENSURE
);
if
(
ch
)
{
/* avoiding a jump from a catch handler into the same handler */
if
(
a
<
bin_to_uint16
(
ch
->
begin
)
||
a
>=
bin_to_uint16
(
ch
->
end
))
{
if
(
a
<
mrb_irep_catch_handler_unpack
(
ch
->
begin
)
||
a
>=
mrb_irep_catch_handler_unpack
(
ch
->
end
))
{
THROW_TAGGED_BREAK
(
mrb
,
RBREAK_TAG_JUMP
,
proc
,
mrb_fixnum_value
(
a
));
}
}
...
...
@@ -2009,7 +2009,7 @@ RETRY_TRY_BLOCK:
mrb
->
c
->
stack
=
ci
[
1
].
stackent
;
}
mrb_stack_extend
(
mrb
,
irep
->
nregs
);
pc
=
irep
->
iseq
+
bin_to_uint16
(
ch
->
target
);
pc
=
irep
->
iseq
+
mrb_irep_catch_handler_unpack
(
ch
->
target
);
}
else
{
mrb_int
acc
;
...
...
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