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
d79dbd92
Commit
d79dbd92
authored
Aug 25, 2018
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixup! New bytecode implementation of mruby VM.
parent
49d1b168
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
110 deletions
+0
-110
mrbgems/mruby-compiler/core/codegen.c
mrbgems/mruby-compiler/core/codegen.c
+0
-100
src/vm.c
src/vm.c
+0
-10
No files found.
mrbgems/mruby-compiler/core/codegen.c
View file @
d79dbd92
...
...
@@ -445,108 +445,8 @@ gen_move(codegen_scope *s, uint16_t dst, uint16_t src, int nopeep)
break
;
default:
goto
normal
;
=======
struct
mrb_insn_data
{
uint8_t
insn
;
uint16_t
a
;
uint16_t
b
;
uint8_t
c
;
};
struct
mrb_insn_data
mrb_decode_insn
(
codegen_scope
*
s
,
mrb_code
*
pc
)
{
struct
mrb_insn_data
data
=
{
0
};
mrb_code
insn
=
READ_B
();
uint16_t
a
=
0
;
uint16_t
b
=
0
;
uint8_t
c
=
0
;
switch
(
insn
)
{
#define FETCH_Z()
/* empty */
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x (); break;
#include "mruby/ops.h"
#undef OPCODE
}
switch
(
insn
)
{
case
OP_EXT1
:
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _1 (); break;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
case
OP_EXT2
:
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _2 (); break;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
case
OP_EXT3
:
insn
=
READ_B
();
switch
(
insn
)
{
#define OPCODE(i,x) case OP_ ## i: FETCH_ ## x ## _3 (); break;
#include "mruby/ops.h"
#undef OPCODE
}
break
;
default:
break
;
}
data
.
insn
=
insn
;
data
.
a
=
a
;
data
.
b
=
b
;
data
.
c
=
c
;
return
data
;
}
struct
mrb_insn_data
mrb_last_insn
(
codegen_scope
*
s
)
{
if
(
s
->
pc
==
s
->
lastpc
)
{
struct
mrb_insn_data
data
;
data
.
insn
=
OP_NOP
;
return
data
;
}
return
mrb_decode_insn
(
s
,
&
s
->
iseq
[
s
->
lastpc
]);
}
static
mrb_bool
no_peephole
(
codegen_scope
*
s
)
{
return
no_optimize
(
s
)
||
s
->
lastlabel
==
s
->
pc
||
s
->
pc
==
0
||
s
->
pc
==
s
->
lastpc
;
}
static
uint16_t
genjmp
(
codegen_scope
*
s
,
mrb_code
i
,
uint16_t
pc
)
{
uint16_t
pos
;
s
->
lastpc
=
s
->
pc
;
gen_B
(
s
,
i
);
pos
=
s
->
pc
;
gen_S
(
s
,
pc
);
return
pos
;
}
static
uint16_t
genjmp2
(
codegen_scope
*
s
,
mrb_code
i
,
uint16_t
a
,
int
pc
,
int
val
)
{
uint16_t
pos
;
if
(
!
no_peephole
(
s
)
&&
!
val
)
{
struct
mrb_insn_data
data
=
mrb_last_insn
(
s
);
if
(
data
.
insn
==
OP_MOVE
&&
data
.
a
==
a
)
{
s
->
pc
=
s
->
lastpc
;
a
=
data
.
b
;
}
}
return
genop
(
s
,
i
);
}
static
void
...
...
src/vm.c
View file @
d79dbd92
...
...
@@ -1069,16 +1069,6 @@ RETRY_TRY_BLOCK:
NEXT
;
}
CASE
(
OP_LOADI
,
BB
)
{
SET_INT_VALUE
(
regs
[
a
],
b
);
NEXT
;
}
CASE
(
OP_LOADINEG
,
BB
)
{
SET_INT_VALUE
(
regs
[
a
],
-
b
);
NEXT
;
}
CASE
(
OP_LOADI__1
,
B
)
goto
L_LOADI
;
CASE
(
OP_LOADI_0
,
B
)
goto
L_LOADI
;
CASE
(
OP_LOADI_1
,
B
)
goto
L_LOADI
;
...
...
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