HANDLING VALUE TYPES
    1.
    发明申请

    公开(公告)号:US20190243623A1

    公开(公告)日:2019-08-08

    申请号:US16384631

    申请日:2019-04-15

    IPC分类号: G06F8/41 G06F8/30

    摘要: In one approach, a method comprises receiving one or more higher-level instructions specifying to assign a value of a particular value type to a particular container of a plurality of containers, wherein the plurality of containers represent a data structure for maintaining one or more variables during execution of a block of code, wherein at least two containers of the plurality of containers are different sizes; generating one or more lower-level instructions that assign the value to the particular container based on applying one or more assignment rules to the one or more higher-level instructions based on the particular value type and executing the one or more lower-level instructions.

    COMPILER WITH TYPE INFERENCE
    2.
    发明申请

    公开(公告)号:US20190155587A1

    公开(公告)日:2019-05-23

    申请号:US16153700

    申请日:2018-10-05

    IPC分类号: G06F8/41

    CPC分类号: G06F8/41 G06F8/437

    摘要: A compiler is described which has a processor configured to receive a computer program comprising a plurality of instructions, the instructions comprising one or more variables and context of the variables. The compiler has a type selector configured, upon evaluation of an instruction comprising a variable by the compiler, to infer a type of the variable using the context of the variable and dereference the variable using the inferred type.

    Systems and methods for converting typed code

    公开(公告)号:US10013245B2

    公开(公告)日:2018-07-03

    申请号:US15083167

    申请日:2016-03-28

    申请人: Facebook, Inc.

    摘要: Techniques provided implement automatic data type annotation in dynamically-typed source code. A codebase, which may comprise a plurality of source code files, is scanned at a global level. The resulting scanned data may describe characteristics of the codebase, including variable and function usage. Based on inferences drawn from the scanning, data types are determined for different variables, expressions, or functions to facilitate conversion from dynamically-typed source code to statically-typed source code. For example, if a function is called once with a parameter value of data type A (e.g., class A), and another time with a parameter value of data type B (e.g., class B), a conversion tool may annotate the parameter variable in the declaration of the function with a data type D (e.g., class d) when data type D is identified as a common ancestor (e.g., superclass) to both data type A and data type B.

    PRODUCING AN INTERNAL REPRESENTATION OF A TYPE BASED ON THE TYPE'S SOURCE REPRESENTATION

    公开(公告)号:US20180081648A1

    公开(公告)日:2018-03-22

    申请号:US15469176

    申请日:2017-03-24

    IPC分类号: G06F9/45 G06F9/455

    摘要: Operations include determining a compile-time representation of a particular type. A request for the compile-time representation of the particular type comprises a source representation of the particular type. Based on and subsequent to receiving the request, a source representation of a source code file comprising the source representation of the particular type is generated. The source representation of the source code file is converted to a compile-time representation of the source code file. The compile-time representation of the particular type is derived from the source time representation of the source code file. The source code file may also be compiled to generate a set of compiled code. The set of compiled code may be loaded into a virtual machine for generating a runtime representation of the set of compiled code. A runtime representation of the particular type is derived from the runtime representation of the set of compiled code.

    Context-free type recording for virtual machines of dynamic programming languages

    公开(公告)号:US09753707B2

    公开(公告)日:2017-09-05

    申请号:US14808150

    申请日:2015-07-24

    发明人: Derek Jay Conrod

    摘要: A method and a computing device for reducing deoptimization in a virtual machine are provided. Source code of a dynamically-typed program is compiled. A context-free type-state recorder records a first data type of a value associated with a particular named memory location within the source code. Optimized code may be generated based on the first data type of the value being a matching data type for global values associated with the particular named memory location. One or more global values associated with the particular named memory location may be type-checked. The context-free type-state recorder may record, if one or more of the global values associated with the particular named memory location is a different data type than the first data type, one or more different data types associated with the particular named memory location. New optimized code may then be generated.

    Unified data type system and method

    公开(公告)号:US09690554B2

    公开(公告)日:2017-06-27

    申请号:US13274199

    申请日:2011-10-14

    IPC分类号: G06F9/45 G06F9/44

    CPC分类号: G06F8/437 G06F9/4488

    摘要: A type system includes a dual representation for basic data types. One representation is the basic data type representation common to such basic built-in data types, known as an unboxed value type or simply as a value type. Each of the basic data types also has a boxed representation that can be stored in the object hierarchy of the type system. This dual representation can also be extended to user-defined types, so that user-defined types may exist both as an unboxed value type and as an object within the object hierarchy of the type system. This dual representation allows the compiler and/or runtime environment to select the most effective and efficient representation for the data type depending on the particular need at the moment.