TypeInference: Difference between revisions

Jump to navigation Jump to search
m
no edit summary
mNo edit summary
Line 21: Line 21:


The inference engine is working in the shell. GP and FPU register allocation works, as does registers across control-flow edges.
The inference engine is working in the shell. GP and FPU register allocation works, as does registers across control-flow edges.
== Some Numbers ==
{| width="50%" cellspacing="1" cellpadding="1" border="0"
|-
|
| align="right" | '''v8-crypto'''
| align="right" | '''access-fannkuch(10)'''
| align="right" | '''sudoku'''
| align="right" | '''array microbench'''
|-
| JM+TI
| align="right" | 56ms
| align="right" | 832ms
| align="right" | 794ms
| align="right" | 662ms
|-
| v8
| align="right" | 51ms
| align="right" | 1552ms
| align="right" | 871ms
| align="right" | 983ms
|-
| JM
| align="right" | 97ms
| align="right" | 1930ms
| align="right" | 1120ms
| align="right" | 3173ms
|-
| JM+TM
| align="right" | 127ms
| align="right" | 1913ms
| align="right" | 1170ms
| align="right" | 2120ms
|}


== Next Steps  ==
== Next Steps  ==
Line 37: Line 72:
Type inference has a somewhat invasive integration into the engine as a whole, but is designed to integrate with JaegerMonkey with as few changes to the compiler as possible. It uses the existing FrameState API to act as an oracle for JaegerMonkey's register allocator and type information queries.
Type inference has a somewhat invasive integration into the engine as a whole, but is designed to integrate with JaegerMonkey with as few changes to the compiler as possible. It uses the existing FrameState API to act as an oracle for JaegerMonkey's register allocator and type information queries.


Type sets for stack slots are queried based on a script, program counter, and stack/local/argument index. Type information for object properties is stored in each JSObject, and eventually be merged with js::Shape and JSObject::prototype. For both, the type information forms the constraint graph necessary for propagating new additions to type sets, causing recompilation if necessary.
Type sets for stack slots are queried based on a script, program counter, and stack/local/argument index. Type information for object properties is stored in each JSObject, and contains the set of properties and types of those properties that can be visible from that object at any point in time. For each js::Shape, there is exactly one type object; but a type object can be shared across multiple shapes.
 
For both, the type information forms the constraint graph necessary for propagating new additions to type sets, causing recompilation.


This propagation is critical for correctness in code that depends on type inference information, and thus the interpreter and VM helpers must carefully place type checks where necessary.
This propagation is critical for correctness in code that depends on type inference information, and thus the interpreter and VM helpers must carefully place type checks where necessary.
Confirmed users
156

edits

Navigation menu