Skip to content

Commit

Permalink
fixed select parser
Browse files Browse the repository at this point in the history
  • Loading branch information
mkhan45 committed Mar 30, 2024
1 parent 0e25181 commit ed262fa
Show file tree
Hide file tree
Showing 36 changed files with 4,922 additions and 4,627 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added benchmarks/demo-benchmarks/bst
Binary file not shown.
1 change: 1 addition & 0 deletions benchmarks/demo-benchmarks/klee-last
19 changes: 19 additions & 0 deletions benchmarks/demo-benchmarks/test-klee-uninit.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdio.h>
#include <stdlib.h>

int main() {
int* x;
if (x[10] == -1414812757) {
printf("true: %d\n", x[10]);
} else {
printf("false: %d\n", x[10]);
}

/* int* buf = (int*) malloc(1000); */
/* return buf[10]; */
/* if (buf[5] == 0xAB) { */
/* return buf[0]; */
/* } else { */
/* return 10; */
/* } */
}
1 change: 1 addition & 0 deletions benchmarks/external-lib/klee-last
1 change: 1 addition & 0 deletions benchmarks/llvm/klee-last
4 changes: 3 additions & 1 deletion benchmarks/wasm/test.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
int sym_int(char* name) { return (int) name; }
static int cnt = 0;

int sym_int(char* name) { return cnt++; }
void assert(int expr) {}

int main() {
Expand Down
21 changes: 17 additions & 4 deletions benchmarks/wasm/test.wat
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
(type (;4;) (func (param i32 i32) (result i32)))
(func $__wasm_call_ctors (type 0))
(func $sym_int (type 1) (param i32) (result i32)
(local i32 i32 i32 i32)
(local i32 i32 i32 i32 i32 i32 i32 i32)
global.get 0
local.set 1
i32.const 16
Expand All @@ -18,10 +18,23 @@
local.get 3
local.get 0
i32.store offset=12
local.get 3
i32.load offset=12
i32.const 0
local.set 4
local.get 4
i32.load offset=1028
local.set 5
i32.const 1
local.set 6
local.get 5
local.get 6
i32.add
local.set 7
i32.const 0
local.set 8
local.get 8
local.get 7
i32.store offset=1028
local.get 5
return)
(func $assert (type 2) (param i32)
(local i32 i32 i32)
Expand Down Expand Up @@ -131,7 +144,7 @@
(memory (;0;) 2)
(global (;0;) (mut i32) (i32.const 66576))
(global (;1;) i32 (i32.const 1024))
(global (;2;) i32 (i32.const 1028))
(global (;2;) i32 (i32.const 1032))
(global (;3;) i32 (i32.const 1024))
(global (;4;) i32 (i32.const 66576))
(global (;5;) i32 (i32.const 0))
Expand Down
2 changes: 1 addition & 1 deletion grammar/WatLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ RETURN: 'return' ;
IF: 'if' ;
THEN: 'then' ;
ELSE: 'else' ;
SELECT: 'select' ;
SELECT: '.select' ;
CALL: 'call' ;
CALL_INDIRECT: 'call_indirect' ;

Expand Down
4 changes: 2 additions & 2 deletions grammar/WatLexer.interp

Large diffs are not rendered by default.

1,927 changes: 964 additions & 963 deletions grammar/WatLexer.java

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion grammar/WatLexer.tokens
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ COMMENT=147
'if'=26
'then'=27
'else'=28
'select'=29
'.select'=29
'call'=30
'call_indirect'=31
'local.get'=32
Expand Down
6 changes: 5 additions & 1 deletion grammar/WatParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ plainInstr
: UNREACHABLE
| NOP
| DROP
| SELECT
| selectInstr
| BR idx
| BR_IF idx
| BR_TABLE idx+
Expand Down Expand Up @@ -170,6 +170,10 @@ store
: numType STORE (MEM_SIZE)?
;

selectInstr
: numType SELECT
;

callIndirectInstr
/* : CALL_INDIRECT typeUse? callInstrParams */
: CALL_INDIRECT idx? typeUse
Expand Down
5 changes: 3 additions & 2 deletions grammar/WatParser.interp

Large diffs are not rendered by default.

Loading

0 comments on commit ed262fa

Please sign in to comment.