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
079c59b9
Commit
079c59b9
authored
Jan 26, 2015
by
Paweł Bylica
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update JitVm to new EVM JIT ABI (C interface)
parent
c71aff99
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
17 deletions
+11
-17
vm_jit.go
vm/vm_jit.go
+11
-17
No files found.
vm/vm_jit.go
View file @
079c59b9
...
@@ -3,17 +3,10 @@
...
@@ -3,17 +3,10 @@
package
vm
package
vm
/*
/*
#include <stdint.h>
#include <stdlib.h>
struct evmjit_result
void* evmjit_create();
{
int evmjit_run(void* _jit, void* _data, void* _env);
int32_t returnCode;
void evmjit_destroy(void* _jit);
uint64_t returnDataSize;
void* returnData;
};
struct evmjit_result evmjit_run(void* _data, void* _env);
// Shared library evmjit (e.g. libevmjit.so) is expected to be installed in /usr/local/lib
// Shared library evmjit (e.g. libevmjit.so) is expected to be installed in /usr/local/lib
// More: https://github.com/ethereum/evmjit
// More: https://github.com/ethereum/evmjit
...
@@ -188,17 +181,17 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
...
@@ -188,17 +181,17 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
self
.
data
.
code
=
getDataPtr
(
code
)
self
.
data
.
code
=
getDataPtr
(
code
)
self
.
data
.
codeSize
=
uint64
(
len
(
code
))
self
.
data
.
codeSize
=
uint64
(
len
(
code
))
result
:=
C
.
evmjit_run
(
unsafe
.
Pointer
(
&
self
.
data
),
unsafe
.
Pointer
(
self
))
jit
:=
C
.
evmjit_create
()
retCode
:=
C
.
evmjit_run
(
jit
,
unsafe
.
Pointer
(
&
self
.
data
),
unsafe
.
Pointer
(
self
))
if
re
sult
.
returnCode
>=
10
0
{
if
re
tCode
<
0
{
err
=
errors
.
New
(
"OOG from JIT"
)
err
=
errors
.
New
(
"OOG from JIT"
)
gas
.
SetInt64
(
0
)
// Set gas to 0, JIT does not bother
gas
.
SetInt64
(
0
)
// Set gas to 0, JIT does not bother
}
else
{
}
else
{
gas
.
SetInt64
(
self
.
data
.
gas
)
gas
.
SetInt64
(
self
.
data
.
gas
)
if
result
.
returnCode
==
1
{
// RETURN
if
retCode
==
1
{
// RETURN
ret
=
C
.
GoBytes
(
result
.
returnData
,
C
.
int
(
result
.
returnDataSize
))
ret
=
C
.
GoBytes
(
unsafe
.
Pointer
(
self
.
data
.
callData
),
C
.
int
(
self
.
data
.
callDataSize
))
C
.
free
(
result
.
returnData
)
}
else
if
retCode
==
2
{
// SUICIDE
}
else
if
result
.
returnCode
==
2
{
// SUICIDE
// TODO: Suicide support logic should be moved to Env to be shared by VM implementations
// TODO: Suicide support logic should be moved to Env to be shared by VM implementations
state
:=
self
.
Env
()
.
State
()
state
:=
self
.
Env
()
.
State
()
receiverAddr
:=
llvm2hashRef
(
bswap
(
&
self
.
data
.
address
))
receiverAddr
:=
llvm2hashRef
(
bswap
(
&
self
.
data
.
address
))
...
@@ -208,7 +201,8 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
...
@@ -208,7 +201,8 @@ func (self *JitVm) Run(me, caller ContextRef, code []byte, value, gas, price *bi
state
.
Delete
(
me
.
Address
())
state
.
Delete
(
me
.
Address
())
}
}
}
}
C
.
evmjit_destroy
(
jit
);
return
return
}
}
...
...
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