Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
84c5db54
Commit
84c5db54
authored
Mar 26, 2018
by
hydai
Committed by
Péter Szilágyi
Mar 26, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
core/vm: remove JIT VM codes (#16362)
parent
23ac7833
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
9 additions
and
434 deletions
+9
-434
doc.go
core/vm/doc.go
+3
-14
instructions_test.go
core/vm/instructions_test.go
+3
-3
interpreter.go
core/vm/interpreter.go
+1
-5
logger_test.go
core/vm/logger_test.go
+1
-1
runtime.go
core/vm/runtime/runtime.go
+1
-3
vm_jit.go
core/vm/vm_jit.go
+0
-389
vm_jit_fake.go
core/vm/vm_jit_fake.go
+0
-19
No files found.
core/vm/doc.go
View file @
84c5db54
...
...
@@ -17,19 +17,8 @@
/*
Package vm implements the Ethereum Virtual Machine.
The vm package implements two EVMs, a byte code VM and a JIT VM. The BC
(Byte Code) VM loops over a set of bytes and executes them according to the set
of rules defined in the Ethereum yellow paper. When the BC VM is invoked it
invokes the JIT VM in a separate goroutine and compiles the byte code in JIT
instructions.
The JIT VM, when invoked, loops around a set of pre-defined instructions until
it either runs of gas, causes an internal error, returns or stops.
The JIT optimiser attempts to pre-compile instructions in to chunks or segments
such as multiple PUSH operations and static JUMPs. It does this by analysing the
opcodes and attempts to match certain regions to known sets. Whenever the
optimiser finds said segments it creates a new instruction and replaces the
first occurrence in the sequence.
The vm package implements one EVM, a byte code VM. The BC (Byte Code) VM loops
over a set of bytes and executes them according to the set of rules defined
in the Ethereum yellow paper.
*/
package
vm
core/vm/instructions_test.go
View file @
84c5db54
...
...
@@ -32,7 +32,7 @@ type twoOperandTest struct {
func
testTwoOperandOp
(
t
*
testing
.
T
,
tests
[]
twoOperandTest
,
opFn
func
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
))
{
var
(
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{
EnableJit
:
false
,
ForceJit
:
false
})
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{})
stack
=
newstack
()
pc
=
uint64
(
0
)
)
...
...
@@ -68,7 +68,7 @@ func testTwoOperandOp(t *testing.T, tests []twoOperandTest, opFn func(pc *uint64
func
TestByteOp
(
t
*
testing
.
T
)
{
var
(
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{
EnableJit
:
false
,
ForceJit
:
false
})
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{})
stack
=
newstack
()
)
tests
:=
[]
struct
{
...
...
@@ -198,7 +198,7 @@ func TestSLT(t *testing.T) {
func
opBenchmark
(
bench
*
testing
.
B
,
op
func
(
pc
*
uint64
,
evm
*
EVM
,
contract
*
Contract
,
memory
*
Memory
,
stack
*
Stack
)
([]
byte
,
error
),
args
...
string
)
{
var
(
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{
EnableJit
:
false
,
ForceJit
:
false
})
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{})
stack
=
newstack
()
)
// convert args
...
...
core/vm/interpreter.go
View file @
84c5db54
...
...
@@ -28,10 +28,6 @@ import (
type
Config
struct
{
// Debug enabled debugging Interpreter options
Debug
bool
// EnableJit enabled the JIT VM
EnableJit
bool
// ForceJit forces the JIT VM
ForceJit
bool
// Tracer is the op code logger
Tracer
Tracer
// NoRecursion disabled Interpreter call, callcode,
...
...
@@ -47,7 +43,7 @@ type Config struct {
// Interpreter is used to run Ethereum based contracts and will utilise the
// passed evmironment to query external sources for state information.
// The Interpreter will run the byte code VM
or JIT VM
based on the passed
// The Interpreter will run the byte code VM based on the passed
// configuration.
type
Interpreter
struct
{
evm
*
EVM
...
...
core/vm/logger_test.go
View file @
84c5db54
...
...
@@ -48,7 +48,7 @@ type dummyStateDB struct {
func
TestStoreCapture
(
t
*
testing
.
T
)
{
var
(
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{
EnableJit
:
false
,
ForceJit
:
false
})
env
=
NewEVM
(
Context
{},
nil
,
params
.
TestChainConfig
,
Config
{})
logger
=
NewStructLogger
(
nil
)
mem
=
NewMemory
()
stack
=
newstack
()
...
...
core/vm/runtime/runtime.go
View file @
84c5db54
...
...
@@ -41,7 +41,6 @@ type Config struct {
GasLimit
uint64
GasPrice
*
big
.
Int
Value
*
big
.
Int
DisableJit
bool
// "disable" so it's enabled by default
Debug
bool
EVMConfig
vm
.
Config
...
...
@@ -92,8 +91,7 @@ func setDefaults(cfg *Config) {
// It returns the EVM's return value, the new state and an error if it failed.
//
// Executes sets up a in memory, temporarily, environment for the execution of
// the given code. It enabled the JIT by default and make sure that it's restored
// to it's original state afterwards.
// the given code. It makes sure that it's restored to it's original state afterwards.
func
Execute
(
code
,
input
[]
byte
,
cfg
*
Config
)
([]
byte
,
*
state
.
StateDB
,
error
)
{
if
cfg
==
nil
{
cfg
=
new
(
Config
)
...
...
core/vm/vm_jit.go
deleted
100644 → 0
View file @
23ac7833
This diff is collapsed.
Click to expand it.
core/vm/vm_jit_fake.go
deleted
100644 → 0
View file @
23ac7833
// Copyright 2015 The go-ethereum Authors
// This file is part of the go-ethereum library.
//
// The go-ethereum library is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// The go-ethereum library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
// +build !evmjit
package
vm
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