Typed Assembly Language
Neal Glew   Intel Research

Runtime stack
  TAL2 (adding a stack)
  - machine state (H, R, S, B)
    S::= nil | v::S
  - new instructions
    i ::= salloc n | sfree n | sld r = (n) | sst (n) = 0

    Correspond 1:1 for RISC instctuctions
    CISC versions can be synthesized
      -- push o = salloc 1; sst(0) = 0
      -- pop r = sld r = (0); sfree 1
      -- call o = push L; jmp o; L:

    Error conditions: free too much stack, try to load/store
    beyond the bottom of stack

  - operational semantics
      -- add a new value ? to represent junk
      -- salloc
      -- sfree
      -- sld (load)
      -- sst (store)

  - typing
      -- stack types
	 allow polymorphism over stack types too
      -- add a junk type ?
      -- type error
	 polymorphism protect the caller stack

  - type safety
      TAL2 is type safe
	- doesn't ensure any bound on stack, but ensures
	  no write outsdie the stack or free from an emtpy
	  one
        - with an append stack type can deal with the 
	  longjmp exception scheme
 
  - the compiler
    -- complete certified-code system needs a type preserving
       compiler from a type-safe source language
    -- possible on example source language: Tiny
    -- doing type-preserving compilation
	- type transformation
	- term transformation
    -- Popcorn compiler (Tiny -> TAL)
  
  - can prove that compiler can product type-correct assmbly
    from type-correct source
