---
title: "Optimizing MATLAB through just-in-time specialization (2010)"
description: "The authors present McVM, an open virtual machine for Matlab that pairs a simple AST interpreter with… 27 references, cited by 4 papers here."
authors: ["Maxime Chevalier-Boisvert", "Laurie Hendren", "Clark Verbrugge"]
year: 2010
venue: "Compiler Construction (CC) 2010, LNCS 6011"
source: "https://www.sable.mcgill.ca/mclab/publications/"
licence: "All rights reserved — free to read at the source"
summary_licence: "Elamur Cosmic License"
canonical: "https://research.elamur.ai/free/en/papers/boisvert-2010-optimizing-matlab-through-just-time/"
---
[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/boisvert-2010-optimizing-matlab-through-just-time/)

[home](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2010](https://md.research.elamur.ai/free/en/papers/2010/page/3/) / Optimizing MATLAB through just-in-time specialization

# Optimizing MATLAB through just-in-time specialization

**Authors:** [Maxime Chevalier-Boisvert](https://md.research.elamur.ai/free/en/authors/maxime-chevalier-boisvert/), Laurie Hendren and Clark Verbrugge · **Year:** 2010 · **Venue:** Compiler Construction (CC) 2010, LNCS 6011 · **Licence:** All rights reserved — free to read at the source

**Links:** [Publisher's page](https://www.sable.mcgill.ca/mclab/publications/) · [PDF](http://www.sable.mcgill.ca/publications/papers/2010-3/mcvmcc2010.pdf)

**Citations:** 4 in our library, of the 149,439 papers whose bibliographies we read

## Summary
Matlab is popular with scientists, but its dynamic, implicitly typed semantics make it hard to compile into fast code. Variables change type and size at run time, scalars are treated as 1×1 arrays, and code is loaded incrementally, so whole-program static compilation is impractical. The authors present McVM, an open virtual machine for Matlab that pairs a simple AST interpreter with a JIT compiler built on LLVM. Any construct the JIT cannot yet handle is delegated back to the interpreter. The central idea is to compile a separate version of a function for each distinct combination of argument types seen at call time. A lightweight type and shape inference analysis, combining eight simple abstractions, pushes these argument types through the function body and guides code generation. The specializing JIT was compared with MathWorks Matlab, GNU Octave, the McFor static compiler and McVM without specialization. It was faster than Octave by up to three orders of magnitude and sometimes faster than the commercial system. This shows that coarse, function-level online specialization is a practical way to speed up dynamic scientific languages.

## Key points
- McVM uses a mixed-mode design. The McLab front-end produces a shared AST for both the interpreter and the JIT. The JIT lowers code to a RISC-like SSA form, and LLVM then generates machine code.
- Run-time libraries include ATLAS, BLAS and LAPACK for matrix operations and the Boehm collector for garbage collection.
- Functions are cloned and specialized per call signature (argument types). The inference combines 8 abstractions, such as overall type, scalar vs. 2D matrix, and shape.
- When execution falls back to the interpreter, live register variables are written to memory. Functions that never need the interpreter pay no extra cost.
- Future work targets speculative, heuristic type guessing, because conservative merging lets "unknown" types spread and erode the results of inference.

*Our summary of the paper, in our own words — not its text. The work belongs to its authors; read it at the links above.*

📚 Shelves (1): [➗ Mathematics](https://md.research.elamur.ai/free/en/shelves/mathematics/) · 233 works

## Cite

Cite as: Maxime Chevalier-Boisvert, Laurie Hendren and Clark Verbrugge. 2010. Optimizing MATLAB through just-in-time specialization. Compiler Construction (CC) 2010, LNCS 6011.

The paper itself, not this page. BibTeX from the library's record of the work.

```bibtex
@inproceedings{chevalierboisvert2010optimizing,
  title = {{Optimizing MATLAB through just-in-time specialization}},
  author = {Maxime Chevalier-Boisvert, Laurie Hendren and Clark Verbrugge},
  booktitle = {Compiler Construction (CC) 2010, LNCS 6011},
  year = {2010},
  url = {https://www.sable.mcgill.ca/mclab/publications/}
}
```

- [← previous How Specialized are Specialized Corpora? Behavioral Evaluation of Corpus Representativeness for Maltese.](https://md.research.elamur.ai/free/en/papers/francom-2010-how-specialized-are-specialized-corpora/)
- [next → ProPOSEC: A Prosody and PoS Annotated Spoken English Corpus](https://md.research.elamur.ai/free/en/papers/brierley-2010-proposec-prosody-pos-annotated-spoken/)
- [↑ back to papers of 2010](https://md.research.elamur.ai/free/en/papers/2010/page/3/)

## References

27 references, 0 of them with a card of ours. ↗ leads to the work, «find» searches for one we have no id for yet.

1. Lattner, C.: LLVM: An Infrastructure for Multi-Stage Optimization. Master’s thesis, Comp. Sci. Dept., U. of Illinois at Urbana-Champaign (Dec 2002) [find](https://scholar.google.com/scholar?q=Lattner%2C+C%2E%3A+LLVM%3A+An+Infrastructure+for+Multi%2DStage+Optimization%2E+Master%E2%80%99s+thesis%2C+Comp%2E+Sci%2E+Dept%2E%2C+U%2E+of+Illinois+at+Urbana%2DChampaign+%28Dec+2002%29)
2. Boehm, H., Spertus, M.: Transparent programmer-directed garbage collection for C++ (2007) [find](https://scholar.google.com/scholar?q=Boehm%2C+H%2E%2C+Spertus%2C+M%2E%3A+Transparent+programmer%2Ddirected+garbage+collection+for+C%2B%2B+%282007%29)
3. Biggar, P., de Vries, E., Gregg, D.: A practical solution for scripting language compilers. In: SAC ’09, ACM (2009) 1916–1923 [find](https://scholar.google.com/scholar?q=Biggar%2C+P%2E%2C+de+Vries%2C+E%2E%2C+Gregg%2C+D%2E%3A+A+practical+solution+for+scripting+language+compilers%2E+In%3A+SAC+%E2%80%9909%2C+ACM+%282009%29+1916%E2%80%931923)
4. Almási, G., Padua, D.: MaJIC: compiling MATLAB for speed and responsiveness. In: PLDI ’02, ACM (2002) 294–303 [find](https://scholar.google.com/scholar?q=Alma%CC%81si%2C+G%2E%2C+Padua%2C+D%2E%3A+MaJIC%3A+compiling+MATLAB+for+speed+and+responsiveness%2E+In%3A+PLDI+%E2%80%9902%2C+ACM+%282002%29+294%E2%80%93303)
5. Elphick, D., Leuschel, M., Cox, S.: Partial evaluation of MATLAB. In: GPCE ’03, Springer-Verlag (2003) 344–363 [find](https://scholar.google.com/scholar?q=Elphick%2C+D%2E%2C+Leuschel%2C+M%2E%2C+Cox%2C+S%2E%3A+Partial+evaluation+of+MATLAB%2E+In%3A+GPCE+%E2%80%9903%2C+Springer%2DVerlag+%282003%29+344%E2%80%93363)
6. Derose, L., Rose, L.D., Gallivan, K., Gallivan, K., Gallopoulos, E., Gallopoulos, E., Marsolf, B., Marsolf, B., Padua, D., Padua, D.: FALCON: A MATLAB interactive restructuring compiler. In: LCPC ’95, Springer-Verlag (1995) 269–288 [find](https://scholar.google.com/scholar?q=Derose%2C+L%2E%2C+Rose%2C+L%2ED%2E%2C+Gallivan%2C+K%2E%2C+Gallivan%2C+K%2E%2C+Gallopoulos%2C+E%2E%2C+Gallopoulos%2C+E%2E%2C+Marsolf%2C+B%2E%2C+Marsolf%2C+B%2E%2C+Padua%2C+D%2E%2C+Padua%2C+D%2E%3A+FALCON%3A+A+MATLAB+interactive+restructuring+compiler%2E+In%3A+LCPC+%E2%80%9995%2C)
7. Birkbeck, N., Levesque, J., Amaral, J.N.: A dimension abstraction approach to vectorization in matlab. In: CGO ’07, IEEE Computer Society (2007) 115–130 Maxime Chevalier-Boisvert, Laurie Hendren, Clark Verbrugge [find](https://scholar.google.com/scholar?q=Birkbeck%2C+N%2E%2C+Levesque%2C+J%2E%2C+Amaral%2C+J%2EN%2E%3A+A+dimension+abstraction+approach+to+vectorization+in+matlab%2E+In%3A+CGO+%E2%80%9907%2C+IEEE+Computer+Society+%282007%29+115%E2%80%93130+Maxime+Chevalier%2DBoisvert%2C+Laurie+Hendren%2C+Clar)
8. Joisha, P.G., Banerjee, P.: A translator system for the MATLAB language: Research articles. Softw. Pract. Exper. 37(5) (2007) 535–578 [find](https://scholar.google.com/scholar?q=Joisha%2C+P%2EG%2E%2C+Banerjee%2C+P%2E%3A+A+translator+system+for+the+MATLAB+language%3A+Research+articles%2E+Softw%2E+Pract%2E+Exper%2E+37%285%29+%282007%29+535%E2%80%93578)
9. Rose, L.D., Padua, D.: A MATLAB to Fortran 90 translator and its effectiveness. In: ICS ’96, ACM (1996) 309–316 [find](https://scholar.google.com/scholar?q=Rose%2C+L%2ED%2E%2C+Padua%2C+D%2E%3A+A+MATLAB+to+Fortran+90+translator+and+its+effectiveness%2E+In%3A+ICS+%E2%80%9996%2C+ACM+%281996%29+309%E2%80%93316)
10. Joisha, P.G., Banerjee, P.: An algebraic array shape inference system for MATLAB R . ACM Trans. Program. Lang. Syst. 28(5) (2006) 848–907 [find](https://scholar.google.com/scholar?q=Joisha%2C+P%2EG%2E%2C+Banerjee%2C+P%2E%3A+An+algebraic+array+shape+inference+system+for+MATLAB+R+%2E+ACM+Trans%2E+Program%2E+Lang%2E+Syst%2E+28%285%29+%282006%29+848%E2%80%93907)
11. Haldar, M., Nayak, A., Kanhere, A., Joisha, P., Shenoy, N., Choudhary, A., Banerjee, P.: Match virtual machine: An adaptive runtime system to execute MATLAB in parallel. In: ICPP2000. (2000) 145–152 [find](https://scholar.google.com/scholar?q=Haldar%2C+M%2E%2C+Nayak%2C+A%2E%2C+Kanhere%2C+A%2E%2C+Joisha%2C+P%2E%2C+Shenoy%2C+N%2E%2C+Choudhary%2C+A%2E%2C+Banerjee%2C+P%2E%3A+Match+virtual+machine%3A+An+adaptive+runtime+system+to+execute+MATLAB+in+parallel%2E+In%3A+ICPP2000%2E+%282000%29+145%E2%80%93152)
12. Jones, N.D., Gomard, C.K., Sestoft, P.: Partial evaluation and automatic program generation. Prentice-Hall, Inc. (1993) [find](https://scholar.google.com/scholar?q=Jones%2C+N%2ED%2E%2C+Gomard%2C+C%2EK%2E%2C+Sestoft%2C+P%2E%3A+Partial+evaluation+and+automatic+program+generation%2E+Prentice%2DHall%2C+Inc%2E+%281993%29)
13. Cooper, K.D., Hall, M.W., Kennedy, K.: Procedure cloning. In: Computer Languages. (1992) 96–105 [find](https://scholar.google.com/scholar?q=Cooper%2C+K%2ED%2E%2C+Hall%2C+M%2EW%2E%2C+Kennedy%2C+K%2E%3A+Procedure+cloning%2E+In%3A+Computer+Languages%2E+%281992%29+96%E2%80%93105)
14. Chauhan, A., McCosh, C., Kennedy, K., Hanson, R.: Automatic type-driven library generation for telescoping languages. In: SC ’03. Volume 1. (1917) 58113–695 [find](https://scholar.google.com/scholar?q=Chauhan%2C+A%2E%2C+McCosh%2C+C%2E%2C+Kennedy%2C+K%2E%2C+Hanson%2C+R%2E%3A+Automatic+type%2Ddriven+library+generation+for+telescoping+languages%2E+In%3A+SC+%E2%80%9903%2E+Volume+1%2E+%281917%29+58113%E2%80%93695)
15. Chambers, C., Ungar, D.: Customization: optimizing compiler technology for SELF, a dynamically-typed object-oriented programming language. SIGPLAN Not. 24(7) (1989) 146–160 [find](https://scholar.google.com/scholar?q=Chambers%2C+C%2E%2C+Ungar%2C+D%2E%3A+Customization%3A+optimizing+compiler+technology+for+SELF%2C+a+dynamically%2Dtyped+object%2Doriented+programming+language%2E+SIGPLAN+Not%2E+24%287%29+%281989%29+146%E2%80%93160)
16. Kennedy, A., Syme, D.: Design and implementation of generics for the .NET Common Language Runtime. In: PLDI ’01, ACM New York, NY, USA (2001) 1–12 [find](https://scholar.google.com/scholar?q=Kennedy%2C+A%2E%2C+Syme%2C+D%2E%3A+Design+and+implementation+of+generics+for+the+%2ENET+Common+Language+Runtime%2E+In%3A+PLDI+%E2%80%9901%2C+ACM+New+York%2C+NY%2C+USA+%282001%29+1%E2%80%9312)
17. Shankar, A., Sastry, S.S., Bodı́k, R., Smith, J.E.: Runtime specialization with optimistic heap analysis. SIGPLAN Not. 40(10) (2005) 327–343 [find](https://scholar.google.com/scholar?q=Shankar%2C+A%2E%2C+Sastry%2C+S%2ES%2E%2C+Bod%C4%B1%CC%81k%2C+R%2E%2C+Smith%2C+J%2EE%2E%3A+Runtime+specialization+with+optimistic+heap+analysis%2E+SIGPLAN+Not%2E+40%2810%29+%282005%29+327%E2%80%93343)
18. Schultz, U., Consel, C.: Automatic program specialization for Java. ACM Trans. Program. Lang. Syst. 25(4) (2003) 452–499 [find](https://scholar.google.com/scholar?q=Schultz%2C+U%2E%2C+Consel%2C+C%2E%3A+Automatic+program+specialization+for+Java%2E+ACM+Trans%2E+Program%2E+Lang%2E+Syst%2E+25%284%29+%282003%29+452%E2%80%93499)
19. Rigo, A.: Representation-based just-in-time specialization and the Psyco prototype for Python. In: PEPM ’04, ACM (2004) 15–26 [find](https://scholar.google.com/scholar?q=Rigo%2C+A%2E%3A+Representation%2Dbased+just%2Din%2Dtime+specialization+and+the+Psyco+prototype+for+Python%2E+In%3A+PEPM+%E2%80%9904%2C+ACM+%282004%29+15%E2%80%9326)
20. Carette, J., Kucera, M.: Partial evaluation of Maple. In: PEPM ’07, ACM (2007) 41–50 [find](https://scholar.google.com/scholar?q=Carette%2C+J%2E%2C+Kucera%2C+M%2E%3A+Partial+evaluation+of+Maple%2E+In%3A+PEPM+%E2%80%9907%2C+ACM+%282007%29+41%E2%80%9350)
21. Gal, A., Eich, B., Shaver, M., Anderson, D., Mandelin, D., Haghighat, M.R., Kaplan, B., Hoare, G., Zbarsky, B., Orendorff, J., Ruderman, J., Smith, E.W., Reitmaier, R., Bebenita, M., Chang, M., Franz, M.: Trace-based just-in-time type specialization for dynamic languages. In: PLDI ’09, ACM (2009) 46… [find](https://scholar.google.com/scholar?q=Gal%2C+A%2E%2C+Eich%2C+B%2E%2C+Shaver%2C+M%2E%2C+Anderson%2C+D%2E%2C+Mandelin%2C+D%2E%2C+Haghighat%2C+M%2ER%2E%2C+Kaplan%2C+B%2E%2C+Hoare%2C+G%2E%2C+Zbarsky%2C+B%2E%2C+Orendorff%2C+J%2E%2C+Ruderman%2C+J%2E%2C+Smith%2C+E%2EW%2E%2C+Reitmaier%2C+R%2E%2C+Bebenita%2C+M%2E%2C+Chang%2C+M%2E%2C+Franz%2C)
22. Duggan, D., Bent, F.: Explaining type inference. In: Science of Computer Programming. (1996) 37–83 [find](https://scholar.google.com/scholar?q=Duggan%2C+D%2E%2C+Bent%2C+F%2E%3A+Explaining+type+inference%2E+In%3A+Science+of+Computer+Programming%2E+%281996%29+37%E2%80%9383)
23. Bacon, D.F., Sweeney, P.F.: Fast static analysis of C++ virtual function calls. In: OOPSLA ’96, ACM (1996) 324–341 [find](https://scholar.google.com/scholar?q=Bacon%2C+D%2EF%2E%2C+Sweeney%2C+P%2EF%2E%3A+Fast+static+analysis+of+C%2B%2B+virtual+function+calls%2E+In%3A+OOPSLA+%E2%80%9996%2C+ACM+%281996%29+324%E2%80%93341)
24. Tip, F., Palsberg, J.: Scalable propagation-based call graph construction algorithms. In: OOPSLA ’00, ACM (2000) 281–293 [find](https://scholar.google.com/scholar?q=Tip%2C+F%2E%2C+Palsberg%2C+J%2E%3A+Scalable+propagation%2Dbased+call+graph+construction+algorithms%2E+In%3A+OOPSLA+%E2%80%9900%2C+ACM+%282000%29+281%E2%80%93293)
25. Singer, J.: Sparse bidirectional data flow analysis as a basis for type inference. In: Web proceedings of the Applied Semantics Workshop. (2004) [find](https://scholar.google.com/scholar?q=Singer%2C+J%2E%3A+Sparse+bidirectional+data+flow+analysis+as+a+basis+for+type+inference%2E+In%3A+Web+proceedings+of+the+Applied+Semantics+Workshop%2E+%282004%29)
26. Joisha, P.G., Banerjee, P.: Correctly detecting intrinsic type errors in typeless languages such as MATLAB. In: APL ’01, ACM (2001) 7–21 [find](https://scholar.google.com/scholar?q=Joisha%2C+P%2EG%2E%2C+Banerjee%2C+P%2E%3A+Correctly+detecting+intrinsic+type+errors+in+typeless+languages+such+as+MATLAB%2E+In%3A+APL+%E2%80%9901%2C+ACM+%282001%29+7%E2%80%9321)
27. Furr, M., An, J.h.D., Foster, J.S., Hicks, M.: Static type inference for Ruby. In: SAC ’09, ACM (2009) 1859–1866 [find](https://scholar.google.com/scholar?q=Furr%2C+M%2E%2C+An%2C+J%2Eh%2ED%2E%2C+Foster%2C+J%2ES%2E%2C+Hicks%2C+M%2E%3A+Static+type+inference+for+Ruby%2E+In%3A+SAC+%E2%80%9909%2C+ACM+%282009%29+1859%E2%80%931866)

*Updated 3 November 2026*
