Abstract
We present FunTAL, the first multi-language system to formalize safe interoperability between a high-level functional language and low-level assembly code while supporting compositional reasoning about the mix. A central challenge in developing such a multi-language is bridging the gap between assembly, which is staged into jumps to continuations, and high-level code, where subterms return a result. We present a compositional stack-based typed assembly language that supports components, comprised of one or more basic blocks, that may be embedded in high-level contexts. We also present a logical relation for FunTAL that supports reasoning about equivalence of high-level components and their assembly replacements, mixed-language programs with callbacks between languages, and assembly components comprised of different numbers of basic blocks.
Supplemental Material
Available for Download
We present a type checker and stepper for the FunTAL machine semantics. We include well-typed, runnable examples from the paper, as well as a few smaller examples to start with. With our artifact, you write programs and then type check / load them into a FunTAL machine. You can then step forward and backwards through the evaluation. At each step, the machine shows the registers, stack, and heap, as well as the redex and the context.
- A. Ahmed. Verified Compilers for a Multi-Language World. In T. Ball, R. Bodik, S. Krishnamurthi, B. S. Lerner, and G. Morrisett, editors, 1st Summit on Advances in Programming Languages (SNAPL 2015), volume 32 of Leibniz International Proceedings in Informatics (LIPIcs), pages 15–31, 2015.Google Scholar
- A. Ahmed and M. Blume. An equivalence-preserving CPS translation via multi-language semantics. In International Conference on Functional Programming (ICFP), Tokyo, Japan, pages 431–444, Sept. 2011. Google Scholar
Digital Library
- A. Ahmed, A. W. Appel, and R. Virga. An indexed model of impredicative polymorphism and mutable references. Available at http://www.cs.princeton.edu/ ∼appel/papers/impred.pdf, Jan. 2003.Google Scholar
- A. Ahmed, D. Dreyer, and A. Rossberg. State-dependent representation independence. In ACM Symposium on Principles of Programming Languages (POPL), Savannah, Georgia, Jan. 2009. Google Scholar
Digital Library
- A. Ahmed, A. W. Appel, C. D. Richards, K. N. Swadi, G. Tan, and D. C. Wang. Semantic foundations for typed assembly languages. ACM Transactions on Programming Languages and Systems, 32(3):1–67, Mar. 2010. Google Scholar
Digital Library
- A. J. Ahmed. Semantics of Types for Mutable State. PhD thesis, Princeton University, Nov. 2004. Google Scholar
Digital Library
- N. Benton. A typed, compositional logic for a stack-based abstract machine. In Proceedings of the Third Asian Symposium on Programming Languages and Systems (APLAS), Tsukuba, Japan, pages 364–380, 2005. Google Scholar
Digital Library
- N. Benton and C.-K. Hur. Biorthogonality, step-indexing and compiler correctness. In International Conference on Functional Programming (ICFP), Edinburgh, Scotland, Sept. 2009. Google Scholar
Digital Library
- D. Dreyer. RustBelt: Logical foundations for the future of safe systems programming. http://plv.mpi-sws.org/ rustbelt/, 2016. Accessed: 2016-11-15.Google Scholar
- D. Dreyer, G. Neis, and L. Birkedal. The impact of higherorder state and control effects on local relational reasoning. Journal of Functional Programming, 22(4&5):477–528, 2012. Google Scholar
Digital Library
- M. Furr and J. S. Foster. Checking type safety of foreign function calls. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), Chicago, Illinois, pages 62–72, June 2005. Google Scholar
Digital Library
- N. Glew and G. Morrisett. Type-safe linking and modular assembly language. In ACM Symposium on Principles of Programming Languages (POPL), San Antonio, Texas, pages 250–261, 1999. Google Scholar
Digital Library
- C.-K. Hur and D. Dreyer. A Kripke logical relation between ML and assembly. In ACM Symposium on Principles of Programming Languages (POPL), Austin, Texas, Jan. 2011. Google Scholar
Digital Library
- G. Jaber and N. Tabareau. The journey of biorthogonal logical relations to the realm of assembly code. Workshop on Low-Level Languages (LOLA), http://web.emn.fr/ x-info/ntabareau/fichiers/lola2011.pdf, 2011. Accessed: 2016-11-15.Google Scholar
- A. Larmuseau and D. Clarke. Formalizing a secure foreign function interface. In Proceedings of the 13th International Conference on Software Engineering and Formal Methods (SEFM), York, UK, pages 215–230, 2015.Google Scholar
Cross Ref
- J. Matthews and R. B. Findler. Operational semantics for multi-language programs. In ACM Symposium on Principles of Programming Languages (POPL), Nice, France, pages 3– 10, Jan. 2007. Google Scholar
Digital Library
- G. Morrisett, D. Walker, K. Crary, and N. Glew. From System F to typed assembly language. In ACM Symposium on Principles of Programming Languages (POPL), San Diego, California, pages 85–97, Jan. 1998. Google Scholar
Digital Library
- G. Morrisett, K. Crary, N. Glew, and D. Walker. Stack-based typed assembly language. Journal of Functional Programming, 12(1):43–88, 2002. Google Scholar
Digital Library
- G. Neis, C.-K. Hur, J.-O. Kaiser, C. McLaughlin, D. Dreyer, and V. Vafeiadis. Pilsner: A compositionally verified compiler for a higher-order imperative language. In International Conference on Functional Programming (ICFP), Vancouver, British Columbia, Canada, Aug. 2015. Google Scholar
Digital Library
- M. S. New, W. J. Bowman, and A. Ahmed. Fully abstract compilation via universal embedding. In International Conference on Functional Programming (ICFP), Nara, Japan, Sept. 2016. Google Scholar
Digital Library
- D. Patterson, J. Perconti, C. Dimoulas, and A. Ahmed. FunTAL: Reasonably mixing a functional language with assembly (technical appendix). Available at http://www.ccs.neu.edu/home/amal/papers/ funtal-tr.pdf, Mar. 2017.Google Scholar
- J. T. Perconti and A. Ahmed. Verifying an open compiler using multi-language semantics. In European Symposium on Programming (ESOP), Apr. 2014. Google Scholar
Digital Library
- G. Tan. JNI Light: An operational model for the core JNI. In Proceedings of the 8th Asian Conference on Programming Languages and Systems (APLAS), Shanghai, China, pages 114–130, 2010. Google Scholar
Digital Library
- G. Tan, A. W. Appel, S. Chakradhar, R. Srivaths, A. Raghunathan, and D. Wang. Safe java native interface. In Proceedings of the 2006 IEEE International Symposium on Secure Software Engineering, pages 97–106, 2006.Google Scholar
- P. Wang, S. Cuellar, and A. Chlipala. Compiler verification meets cross-language linking via data abstraction. In ACM Symposium on Object Oriented Programming: Systems, Languages, and Applications (OOPSLA), Oct. 2014. Google Scholar
Digital Library
Index Terms
FunTAL: reasonably mixing a functional language with assembly
Recommendations
FunTAL: reasonably mixing a functional language with assembly
PLDI 2017: Proceedings of the 38th ACM SIGPLAN Conference on Programming Language Design and ImplementationWe present FunTAL, the first multi-language system to formalize safe interoperability between a high-level functional language and low-level assembly code while supporting compositional reasoning about the mix. A central challenge in developing such a ...
Heap-Bounded Assembly Language
We present a first-order linearly typed assembly language, HBAL, that allows the safe reuse of heap space for elements of different types. Linear typing ensures the single pointer property, disallowing aliasing but allowing safe, in-place-update ...
An equivalence-preserving CPS translation via multi-language semantics
ICFP '11: Proceedings of the 16th ACM SIGPLAN international conference on Functional programmingLanguage-based security relies on the assumption that all potential attacks follow the rules of the language in question. When programs are compiled into a different language, this is true only if the translation process preserves observational ...






Comments