-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Custom hooked Map
externalisation
#363
Closed
Closed
Changes from all commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
a091812
Add integration tests to try and capture the sort-forgetting issue
geo2a 05be53c
Rename files
geo2a 5dec4c1
Add another wasm integration test
geo2a c6d3ec2
Rename test case files
geo2a c794d51
Add response files
geo2a 9c0dc9d
Include argument sorts when externalizing map elements
geo2a 9e27050
Format with fourmolu
invalid-email-address 2eb6ecf
Add profiling scripts (#357)
goodlyrottenapple 18ebc9a
Further profiling scripts improvements (#359)
geo2a 439ff76
271 simplifier cache (per request) (#358)
jberthold acb6f19
Improvements to map unification (#360)
goodlyrottenapple 444d2fd
Do not simplify before calling kore-rpc (#362)
jberthold 0a85137
Add LLVM and Cache simplification tracing (#365)
jberthold bac937d
Create more focused integration tests
geo2a 62f87f0
Merge branch 'main' into georgy/better-map-internalisation
geo2a 30e8ee7
Output arguments' and result's sorts for symbols in summary
geo2a 4b53a03
Drop MapInt2Int
geo2a d38e79e
Construct minimised wasm configuration
geo2a 3ee5724
Drop simplify request/responses
geo2a 26d8851
Add execute request, demonstrating correct sorts
geo2a db01a14
Implelemt Map.update for MapInt2Val
geo2a 4b9cb7d
Format with fourmolu
invalid-email-address 981a45e
Force evaluation to happen in the LLVM backend
geo2a c4608e8
Add definition of a customized hooked map
geo2a b50af99
Add int-to-int Map to the LLVM integration test definition
geo2a 3003462
Format with fourmolu
invalid-email-address 68f1598
add prim update test
goodlyrottenapple 566487d
Format with fourmolu
invalid-email-address 1d5cc6b
Chnages to wasm-map.k
geo2a File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ module LLVM | |
imports MAP | ||
imports SET | ||
imports K-EQUAL | ||
imports MAP-INT2INT | ||
|
||
syntax Num ::= Even | Odd | ||
syntax Even ::= Zero() | Two() | Four() | Six() | Eight() | Ten() | ||
|
@@ -39,3 +40,40 @@ module LLVM | |
rule div2(Ten()) => Five() | ||
|
||
endmodule | ||
|
||
module MAP-INT2INT | ||
imports INT | ||
|
||
syntax WrappedInt | ||
|
||
syntax WrappedInt ::= wrap(Int) [symbol, klabel(wrapInt)] | ||
syntax Int ::= unwrap(WrappedInt) [function, total, injective, symbol, klabel(unwrapInt)] | ||
rule unwrap(wrap(A:Int)) => A | ||
|
||
syntax MapInt2Int [hook(MAP.Map)] | ||
syntax MapInt2Int ::= MapInt2Int MapInt2Int | ||
[ left, function, hook(MAP.concat), klabel(_MapInt2Int_), | ||
symbol, assoc, comm, unit(.MapInt2Int), element(_Int2Int|->_), | ||
index(0), format(%1%n%2) | ||
] | ||
syntax MapInt2Int ::= ".MapInt2Int" | ||
[ function, total, hook(MAP.unit), | ||
klabel(.MapInt2Int), symbol, latex(\dotCt{MapInt2Int}) | ||
] | ||
syntax MapInt2Int ::= WrappedInt "Int2Int|->" WrappedInt | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here's the production I believe corresponds to the above comment @geo2a |
||
[ function, total, hook(MAP.element), | ||
klabel(_Int2Int|->_), symbol, | ||
latex({#1}\mapsto{#2}), injective | ||
] | ||
|
||
syntax MapInt2Int ::= MapInt2Int "[" key: WrappedInt "<-" value: WrappedInt "]" | ||
[function, total, klabel(MapInt2Val:update), symbol, hook(MAP.update), prefer] | ||
|
||
|
||
syntax MapInt2Int ::= MapInt2Int "{{" key: Int "<-" value: WrappedInt "}}" | ||
[ function, total, klabel(MapInt2Val:primitiveUpdate), symbol, | ||
prefer | ||
] | ||
rule M:MapInt2Int {{ Key:Int <- Value:WrappedInt }} | ||
=> M[wrap(Key) <- Value] | ||
endmodule |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
module WASM-MAPS | ||
imports MAP-VAL-TO-VAL | ||
|
||
configuration | ||
<wasm> | ||
<instrs> $PGM </instrs> | ||
<locals> .MapValToVal </locals> | ||
</wasm> | ||
|
||
syntax Instr ::= "init_local" Int Int | ||
// ----------------------------------- | ||
rule <instrs> init_local INDEX VALUE => . ... </instrs> | ||
<locals> LOCALS => LOCALS {{ wrap(INDEX) <- wrap(VALUE) }} </locals> | ||
|
||
endmodule | ||
|
||
module MAP-VAL-TO-VAL | ||
imports WRAPPED-INT | ||
|
||
syntax Val ::= WrappedInt | ||
// ----------------------- | ||
|
||
syntax MapValToVal [hook(MAP.Map)] | ||
syntax MapValToVal ::= MapValToVal MapValToVal | ||
[ left, function, hook(MAP.concat), klabel(_MapValToVal_), | ||
symbol, assoc, comm, unit(.MapValToVal), element(_Val2Val|->_) | ||
] | ||
syntax MapValToVal ::= ".MapValToVal" | ||
[function, total, hook(MAP.unit),klabel(.MapValToVal), symbol] | ||
syntax MapValToVal ::= Val "Val2Val|->" Val | ||
[function, total, hook(MAP.element), klabel(_Val2Val|->_), symbol] | ||
|
||
syntax MapValToVal ::= MapValToVal "[" key: Val "<-" value: Val "]" [function, total, klabel(MapVal2Val:update), symbol, hook(MAP.update), prefer] | ||
|
||
syntax priorities _Val2Val|->_ > _MapValToVal_ .MapValToVal | ||
syntax non-assoc _Val2Val|->_ | ||
|
||
syntax MapValToVal ::= MapValToVal "{{" key: Val "<-" value: Val "}}" | ||
[ function, total, klabel(MapValToVal:primitiveUpdate), symbol, | ||
prefer | ||
] | ||
rule M:MapValToVal {{ Key:Val <- Value:Val }} | ||
=> M[Key <- Value] | ||
|
||
endmodule | ||
|
||
module WRAPPED-INT | ||
imports INT | ||
|
||
syntax WrappedInt ::= wrap(Int) [symbol, klabel(wrapInt)] | ||
// ------------------------------------------------------- | ||
|
||
syntax Int ::= unwrap(WrappedInt) [function, total, injective, symbol, klabel(unwrapInt)] | ||
// --------------------------------------------------------------------------------------- | ||
rule unwrap(wrap(A:Int)) => A | ||
endmodule |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@geo2a I don't follow why the second argument has sort
Int
here; in the corresponding definition the second argument has sortWrappedInt
? I might be missing something though.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, and it indeed makes the test I constructed to pass. We have been able to pin-point the problem to the
MAP.update
hook in the LLVM backend. I'll update the integration tests and also open an issue in the LLVm backend with the somewhat minimized definition and input.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remarkable timing; I had also just managed to build and get the same test to pass with the value sort as
WrappedInt
! Let's take a look at your new minimized example in our meeting this afternoon.