Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mu-impl-fast
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
40
Issues
40
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
mu
mu-impl-fast
Commits
cc5f2249
Commit
cc5f2249
authored
Nov 15, 2016
by
John Zhang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
GETFIELDIREF test
parent
99c0d195
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
80 additions
and
0 deletions
+80
-0
tests/test_jit/suite/test_getfieldiref.c
tests/test_jit/suite/test_getfieldiref.c
+62
-0
tests/test_jit/test_memops.py
tests/test_jit/test_memops.py
+18
-0
No files found.
tests/test_jit/suite/test_getfieldiref.c
0 → 100644
View file @
cc5f2249
// Compile with flag -std=c99
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <dlfcn.h>
#include "muapi.h"
#include "mu-fastimpl.h"
int
main
(
int
argc
,
char
**
argv
)
{
MuVM
*
mu_29
;
MuCtx
*
ctx_29
;
MuIRBuilder
*
bldr_29
;
MuID
id_412
;
MuID
id_413
;
MuID
id_414
;
MuID
id_415
;
MuID
id_416
;
MuID
id_417
;
MuID
id_418
;
MuID
id_419
;
MuID
id_420
;
MuID
id_421
;
MuID
id_422
;
MuID
id_423
;
MuID
id_424
;
MuID
id_425
;
MuID
id_426
;
mu_29
=
mu_fastimpl_new
();
ctx_29
=
mu_29
->
new_context
(
mu_29
);
bldr_29
=
ctx_29
->
new_ir_builder
(
ctx_29
);
id_412
=
bldr_29
->
gen_sym
(
bldr_29
,
"@i8"
);
bldr_29
->
new_type_int
(
bldr_29
,
id_412
,
8
);
id_413
=
bldr_29
->
gen_sym
(
bldr_29
,
"@i32"
);
bldr_29
->
new_type_int
(
bldr_29
,
id_413
,
32
);
id_414
=
bldr_29
->
gen_sym
(
bldr_29
,
"@i64"
);
bldr_29
->
new_type_int
(
bldr_29
,
id_414
,
64
);
id_415
=
bldr_29
->
gen_sym
(
bldr_29
,
"@stt"
);
bldr_29
->
new_type_struct
(
bldr_29
,
id_415
,
(
MuTypeNode
[
3
]){
id_412
,
id_414
,
id_413
},
3
);
id_416
=
bldr_29
->
gen_sym
(
bldr_29
,
"@pstt"
);
bldr_29
->
new_type_uptr
(
bldr_29
,
id_416
,
id_415
);
id_417
=
bldr_29
->
gen_sym
(
bldr_29
,
"@sig_pstt_i32"
);
bldr_29
->
new_funcsig
(
bldr_29
,
id_417
,
(
MuTypeNode
[
1
]){
id_416
},
1
,
(
MuTypeNode
[
1
]){
id_413
},
1
);
id_418
=
bldr_29
->
gen_sym
(
bldr_29
,
"@test_fnc"
);
bldr_29
->
new_func
(
bldr_29
,
id_418
,
id_417
);
id_419
=
bldr_29
->
gen_sym
(
bldr_29
,
"@test_fnc.v1"
);
id_420
=
bldr_29
->
gen_sym
(
bldr_29
,
"@test_fnc.v1.blk0"
);
id_421
=
bldr_29
->
gen_sym
(
bldr_29
,
"@test_fnc.v1.blk0.ps"
);
id_422
=
bldr_29
->
gen_sym
(
bldr_29
,
"@test_fnc.v1.blk0.pfld"
);
id_423
=
bldr_29
->
gen_sym
(
bldr_29
,
"@test_fnc.v1.blk0.res"
);
id_424
=
bldr_29
->
gen_sym
(
bldr_29
,
NULL
);
bldr_29
->
new_getfieldiref
(
bldr_29
,
id_424
,
id_422
,
true
,
id_415
,
2
,
id_421
);
id_425
=
bldr_29
->
gen_sym
(
bldr_29
,
NULL
);
bldr_29
->
new_load
(
bldr_29
,
id_425
,
id_423
,
true
,
MU_ORD_NOT_ATOMIC
,
id_413
,
id_422
,
MU_NO_ID
);
id_426
=
bldr_29
->
gen_sym
(
bldr_29
,
NULL
);
bldr_29
->
new_ret
(
bldr_29
,
id_426
,
(
MuVarNode
[
1
]){
id_423
},
1
);
bldr_29
->
new_bb
(
bldr_29
,
id_420
,
(
MuID
[
1
]){
id_421
},
(
MuTypeNode
[
1
]){
id_416
},
1
,
MU_NO_ID
,
(
MuInstNode
[
3
]){
id_424
,
id_425
,
id_426
},
3
);
bldr_29
->
new_func_ver
(
bldr_29
,
id_419
,
id_418
,
(
MuBBNode
[
1
]){
id_420
},
1
);
bldr_29
->
load
(
bldr_29
);
mu_29
->
compile_to_sharedlib
(
mu_29
,
"test_getfieldiref.dylib"
,
NULL
,
0
);
printf
(
"%s
\n
"
,
"test_getfieldiref.dylib"
);
return
0
;
}
tests/test_jit/test_memops.py
View file @
cc5f2249
...
...
@@ -11,3 +11,21 @@ def test_uptr_bytestore_load():
ui32
=
ctypes
.
c_uint32
()
assert
fn
(
ctypes
.
byref
(
ui32
))
==
0x8d9f9c1d
assert
ui32
.
value
==
0x8d9f9c1d
def
test_getfieldiref
():
class
Stt
(
ctypes
.
Structure
):
_fields_
=
[(
'ui8'
,
ctypes
.
c_uint8
),
(
'ui64'
,
ctypes
.
c_uint64
),
(
'ui32'
,
ctypes
.
c_uint32
)]
fn
,
_
=
fncptr_from_c_script
(
"test_getfieldiref.c"
,
"test_fnc"
,
argtypes
=
[
ctypes
.
POINTER
(
Stt
)],
restype
=
ctypes
.
c_uint32
)
stt
=
Stt
()
stt
.
ui8
=
25
stt
.
ui64
=
0xabcdef01234567890
stt
.
ui32
=
0xcaffebabe
res
=
fn
(
ctypes
.
byref
(
stt
))
assert
res
==
0xcaffebabe
,
"result: %s"
%
hex
(
res
)
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