Upload
david-bergvelt
View
90
Download
2
Embed Size (px)
Citation preview
Background Existing Memory Model New Memory Model Closing
A Memory Model for Expanded LLVM Semanticsin Isabelle
Presented by: David Bergvelt
University of Illinois
Friday 6 November 2015
Background Existing Memory Model New Memory Model Closing
Background
Background Existing Memory Model New Memory Model Closing
From last time
Expand LLVM semantics in Isabelle to allow complex datastructures
getelementptr is used to index through structures
Background Existing Memory Model New Memory Model Closing
From last time
Expand LLVM semantics in Isabelle to allow complex datastructures
getelementptr is used to index through structures
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabled
Int to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
Background Existing Memory Model New Memory Model Closing
getelementptr
getelementptr
Allows us to index through structures by performing addresscalculation
Pass in pointer and list of indices
Inbounds checking
Works as general memory traversal tool when inboundschecking is disabledInt to pointer, pointer to int bitcasting ”flavor”
Problem: how do we perform inbounds checks?
Background Existing Memory Model New Memory Model Closing
Existing Memory Model
Background Existing Memory Model New Memory Model Closing
Memory access datatype
Background Existing Memory Model New Memory Model Closing
Base memory model
Background Existing Memory Model New Memory Model Closing
New Memory Model
Background Existing Memory Model New Memory Model Closing
What do we need to change?
Sized memory access datatype
Raw addresses represented as ’a words
to allow for non-inbounds traversal with getelementptr
Background Existing Memory Model New Memory Model Closing
What do we need to change?
Sized memory access datatype
Raw addresses represented as ’a words
to allow for non-inbounds traversal with getelementptr
Background Existing Memory Model New Memory Model Closing
What do we need to change?
Sized memory access datatype
Raw addresses represented as ’a words
to allow for non-inbounds traversal with getelementptr
Background Existing Memory Model New Memory Model Closing
Implementation (Structures)
allocation::(raw_block set)
raw_block = {start::raw_address, length::(’a uword),memory::((’a word) -> value)}
raw_address::(’a word)
Background Existing Memory Model New Memory Model Closing
Implementation (Assumptions)
good_allocation::(allocation->bool)
good_allocation RBS = (for all rb in RBS and all rb2 in RBS,good_rb_pair rb1 rb2)
good_rb_pair::(raw_block -> raw_block->bool)
good_rb_pair rb1 rb2 = (good_block rb1) &((rb1.start = rb2.start) -> (rb1 = rb2)) &((rb1.start < rb2.start) -> (rb1.start+rb1.length <= rb2.start))
good_block::(raw_block -> bool)
good_block rb = ((rb.start + rb.length) < (max uword)) &(rb.length>=1)
Background Existing Memory Model New Memory Model Closing
Closing
Background Existing Memory Model New Memory Model Closing
Thank you!
Sources:
Concrete Semanticshttp://www.concrete-semantics.org/concrete-semantics.pdf
LLVM Language Reference Manualhttp://llvm.org/docs/LangRef.html
Background Existing Memory Model New Memory Model Closing
Thank you!
Sources:
Concrete Semanticshttp://www.concrete-semantics.org/concrete-semantics.pdf
LLVM Language Reference Manualhttp://llvm.org/docs/LangRef.html