CN100474252C - 在编译过程中表示和检查程序组件的一致性的可扩展类型系统 - Google Patents

在编译过程中表示和检查程序组件的一致性的可扩展类型系统 Download PDF

Info

Publication number
CN100474252C
CN100474252C CNB2004800181124A CN200480018112A CN100474252C CN 100474252 C CN100474252 C CN 100474252C CN B2004800181124 A CNB2004800181124 A CN B2004800181124A CN 200480018112 A CN200480018112 A CN 200480018112A CN 100474252 C CN100474252 C CN 100474252C
Authority
CN
China
Prior art keywords
type
type checking
rule collection
language
phx
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CNB2004800181124A
Other languages
English (en)
Other versions
CN1875345A (zh
Inventor
M·R·普莱斯科
小D·R·塔迪提
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Microsoft Technology Licensing LLC
Original Assignee
Microsoft Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Microsoft Corp filed Critical Microsoft Corp
Publication of CN1875345A publication Critical patent/CN1875345A/zh
Application granted granted Critical
Publication of CN100474252C publication Critical patent/CN100474252C/zh
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis
    • G06F8/436Semantic checking
    • G06F8/437Type checking

Abstract

提供了用于各种形式的中间语言校验的一致性的类型表示、类型检查器和编译器。在编译器中对编程语言进行类型检查是通过取一个或多个规则集作为对类型检查器的输入来实现的,类型检查器基于多个准则中的任一个或两个或多个的组合来选择一个或多个规则集。它们之中有编译阶段、源语言、体系结构以及进行类型检查的语言中存在的类型化级别。语言然后使用所选择的一个或多个规则集来进行类型检查。规则集可包括对应于强类型检查的一个规则集、对应于弱类型检查的一个规则集、以及对应于表示类型检查的一个规则集。作为替换,可提供具有基于先前提到的准则的的任一个,或两个或多个的组合从一较大的规则集在运行时选择一个或多个规则集的类型检查器的编译器。

Description

在编译过程中表示和检查程序组件的一致性的可扩展类型系统
技术领域
本发明涉及类型系统,尤其涉及可扩展到新的和经更新的编程语言的类型系统。
背景
类型系统是在编程语言中用于协助检测和防止运行时出错的系统。如果编程语言包含一组对于诸如变量、函数等对象声明的类型,且这些类型在以该语言编写的程序的编译期间对照一组规则来检查,则该编程语言是“类型化的”。如果以类型化语言编写的源代码违反了类型规则之一,则确定为编译器错误。
用于编译器的类型化的中间语言在过去几年中经受了研究团体的大量研究。它们增强了编译器的可靠性和健壮性,以及提供了一种跟踪和检查无用信息收集器所需的信息的系统方法。其概念是具有一种在其上附加了类型且可以用类似于源程序的类型检查的方式来进行类型检查的中间表示。然而,类型化的中间语言更难以实现,因为在编译过程中把表示项的类型变得明确是必要的。
如果类型化的中间语言必须表示多个不同的高级编程语言,则它甚至更难以实现。不同的语言不仅具有不同的原语操作和类型,而且高级编程语言具有不同的类型化级别。例如,诸如汇编语言等某些语言一般是非类型化的。换言之,它们没有类型系统。在类型化的语言中,某些是强类型化的,而其它是更松散地类型化的。例如,C++是一般被认为松类型化的语言,而ML或Pascal被认为是强类型化的语言。此外,松类型化的某些语言具有较小的语言子集,这些子集允许程序内的大部分代码段是强类型化的,而其它代码段是松类型化的。例如,C#和.NET中使用的微软中间语言(MSIL)允许这一类型化。因此,用于表示这些高级语言的任一种的类型化的中间语言必须能够表示不同的类型强度。同样,这一类型化的中间语言的类型系统必须能够根据进行类型检查的代码的特征来实现不同的规则。
当贯穿整个编译过程降级类型化的中间语言时,会引发另一问题。语言的降级指的是将语言的形式从诸如程序员所编写的较高级形式改为诸如中间语言等较低级形式的过程。语言然后可从中间语言进一步降级到诸如机器相关的本机代码等接近于计算机执行的级别。为在编译过程中对被降级到不同级别的中间语言进行类型检查,必须对每一表示使用一组不同的规则。
创建类型化的中间语言的尝试通常无法解决上述问题。例如,Cedilla System的Special J编译器使用了一种类型化的中间语言。然而,这一编译器对于Java源语言是专用的,且因此不需要处理例如具有非类型安全代码的多种语言。另外,该编译器仅使用一组规则用于类型检查,且因此不能用于多个编译级别。在研究团体中,类型化的中间语言往往对源语言是高度专用的,因此难以为多个编译阶段工程实现(以及设计类型)。
概述
提供了一种用于检查各种形式的中间语言的一致性的类型表示、类型检查器、方法和编译器。具体地,类型化的中间语言适用于表示以多种(完全不同的)源语言编写的程序,这些源语言包括类型化的和非类型化的语言、松和强类型化的语言、以及带有和不带有无用信息收集的语言。另外,该类型检查器体系结构是可扩展的,以处置具有不同类型和原语操作的新语言。类型表示、类型检查器、方法和编译器包括各个方面。各个方面可分开且独立地使用,或者各个方面可以按各种组合和子组合来使用。
在一方面,提供了一种在编译器中对编程语言进行类型检查的方法。取一个或多个规则集作为对类型检查器的输入,类型检查器基于多个准则中的任何一个,或两个或多个的组合选择规则集中的一个或多个。在它们之中的是编译阶段、源语言、体系结构以及进行类型检查的语言中存在的类型化级别。语言然后使用所选择的一个或多个规则集进行类型检查。
在另一方面,提供了一种带有类型检查器的编译器,类型检查器基于多个准则中的任何一个,或两个或多个的组合构造一个或多个规则集。规则集可包括对应于强类型检查的一个规则集、对应于弱类型检查的一个规则集、对应于表示类型检查的一个规则集。弱规则集可允许类型化中的更多灵活性,诸如允许类型强制转换,而表示规则集可允许在中间程序表示的各部分中丢弃的类型信息。
在另一方面,提供了一种用于构造用于检查程序的中间表示的一致性的多个规则的编程接口。检查中间表示的一致性可包括向类型检查器提供多个规则,类型检查器基于预定准则向一个中间表示应用第一组规则,以及向另一中间表示应用第二组规则。
当参考附图阅读以下详细描述,可以清楚这些和其它方面。
附图简述
图1是通用编译过程的流程图。
图2是示出将源代码语句转换成高级表示,然后转换成机器相关的低级表示的表清单。
图3是示出用于在各个编译阶段对类型化的中间语言进行类型检查的编译器系统的一个实施例的数据流程图。
图4是用于编译器系统的类型检查器的框图。
图5是用于选择要由类型检查器应用的规则集的一种可能的过程的流程图。
图6是示出类型之间的分层关系的有向图。
图7是示出将类型添加到类型之间的分层关系的有向图。
图8是用于对照类型检查系统中的类型规则检查指令的方法的流程图。
图9是担当类型检查系统的一个实施例的操作环境的计算机系统的示例的框图。
详细描述
提供了用于检查各种形式的中间语言的一致性的类型表示、类型检查器和编译器。类型检查器和编译器允许根据编程组件和/或编译阶段的源语言使用不同的类型和类型检查规则。例如,可能期望将高级优化器应用于以各种语言编写的程序。这些语言可具有不同的原语类型和原语操作。例如,一种语言可以包含用于复杂算术的类型和操作,而另一种语言可包含对计算机图形专用的类型和操作。通过允许由不同的类型系统来参数化中间表示,优化器可用于具有不同原语类型和操作的语言。另一示例可包括其中某些组件以强类型化的语言子集来编写,而其它组件以非类型安全的完全语言来编写的程序。期望对于第一组组件进行更多的检错。这可以通过对不同的组件使用不同的类型检查规则来实现。又一示例是在编译期间丢弃类型信息。类型检查器和编译器可允许在较晚的阶段丢弃类型信息,而可在较早的阶段强迫维护精确的信息。这可以通过对不同的编译阶段结合不同的类型检查规则使用未知类型来实现。
图1示出了使用具有不同降级级别的类型化的中间语言来表示多种不同的源语言的系统的通用编译过程。源代码100-106是以四种不同的源语言来编写的,这些源语言可以是类型化或不是类型化的,且具有不同的类型强度级别。例如,以C#编写的源代码100将比以C++编写的源代码106更强地类型化。源代码首先由读取器108处理并进入系统。源语言然后被翻译成类型化的中间语言的高级中间表示(HIR)。HIR然后可在框110被可任选地分析并优化。HIR然后被翻译成类型化的中间语言的中级中间表示(MIR)。该表示低于HIR,但是仍是机器无关的。在这一点上,MIR可如框112所示被可任选地分析并优化。MIR然后由代码生成在框114翻译成类型化的中间语言的机器相关的低级表示(LIR)。LIR然后可在框116被可任选地分析并优化,并在框118被提供给发放器。发放器将以表示读入系统的原始源代码的多种格式120-126中的一种输出代码。贯穿整个过程,完成过程所必需的数据被储存在某一形式的持久存储器128中。
由此,该编译过程包括将中间语言指令从一个表示级别翻译成另一表示级别。例如,图2示出将源代码语句转换成HIR,以及将HIR转换成机器相关的LIR。源代码语句200可以用多种高级编程语言来编写。这些语言被设计成允许程序员以容易理解的方式读写代码。由此,允许程序员使用如“+”等字符用于加法,并允许使用更强大的形式,诸如添加如语句200中所示的两个以上操作数。
语句202-206是表示同一功能的语句200的HIR表示,但是以更接近于可由机器理解且仍是体系结构无关的格式来完成。语句202使用“ADD”命令来将第一和第二变量相加,并将结果赋值给第一临时变量t1。语句204然后使用另一“ADD”命令将t1与第三变量相加,并将结果赋值给第二临时变量t2。语句206然后使用“ASSIGN”指令将值t2赋值给结果变量z。
语句208-121是语句202-206的中间语言的LIR。语句208使用对x86体系结构专用的add指令将储存在指定寄存器处的两个变量的值相加,并将结果储存在被赋值给临时变量t1的寄存器中。语句210使用对x86体系结构专用的add指令来将值t1和储存在指定的寄存器处的第三变量相加,并将结果储存在被赋值给t2的指定寄存器(EAX)中。语句212然后使用对x86体系结构专用的move指令将储存在EAX中的值移至输出变量z。
为实现类型检查,类型化的中间语言包含显式或隐式表达的类型表示。显式类型表达式是直接在表示中声明的。例如,语句:
int a;
显式地将变量“a”定义为类型int。类型表示可通过为某些代码语句定义一默认类型来隐式地表达。例如,如果函数的默认返回类型是int,则语句:
f_start();
将声明没有任何形参并返回类型为int的值的函数f_start。
适用于多个表示级别处的多个编程语言的类型化的中间语言的类型表示的一个实施例在附录A中示出。应当注意,这仅是众多可能的实施例中的一个。
参考附录A,在类型类分层结构中定义了多个类型表示,使得各种语言的类型系统可由类型化的中间语言来表示。抽象基类对于所有类型被定义为“Phx::Type”。该基类可包含例如“sizekind”中用于各种类型的大小信息,这些类型诸如实际、符号或未知(或可变)类型。基类也可包含“typekind”,以指定类型分类。另外,可提供外部类型,作为包装外部定义的类型的抽象类型,以提供从类型化的中间语言到原始源代码的反向映射。
在基类之下,被定义为“Phx::PtrType”的类可表示指针类型。也可定义各种指针。例如,受管的、已收集无用信息的指针(指向已收集无用信息的对象内的位置);受管的、未收集无用信息的指针(指向未收集无用信息的对象内的位置);非受管指针(诸如在以例如C++编写的代码中找到的);引用指针(指向已收集无用信息的对象的基类);以及空指针。
在分层结构中的同一级别处,被定义为“Phx::ContainerType”的类可表示容器类型,诸如包含内部成员的类型。内部成员可具有作用域、方法以及其它类型。被定义为“Phx::FuncType”的类可表示函数类型,包括任何必要的调用约定、形参列表和返回类型列表。同样,被定义为“Phx::UnmgdArrayType”的类可表示非受管的数组类型。在分层结构中的“Phx::ContainerType”下还可定义四个类。被定义为“Phx::ClassType”的类可表示类类型,被定义为“Phx::StructType”可表示结构类型,被定义为“Phx::InterfaceType”的类可表示接口类型,而被定义为“Phx::EnumType”的类可表示枚举类型。在分层结构中的“Phx:ClassType”下,被定义为“Phx::MgdArrayType”的另一个类可表示受管的数组类型。
在附录A所示的表示中,类“primtype”被定义为结构类型的特殊实例。“primtype”可包括诸如int、float、unknown(未知)、void、condition code(条件代码)、unsigned int(无符号整数)、xint等各种类型。这些表示可在类型化的中间语言的HIR和LIR中使用。
另外,目标专用的原语类型可被包括在类型表示中。某些语言具有复杂算术类型,如果类型系统知道它们,则它们可被有效地处理。例如,考虑“MMX”指令。这一指令是被构建到某些版本的x86处理器中用于支持多媒体和通信数据类型上的单指令/多数据操作的一组外部指令集中的一个。类型系统可被定制成以对类型表示的最小改变来识别并使用这些指令。
附录A中所示的类型表示的实施例也包括“unknown”类型,它可表示任何类型,并可任选地具有与其相关联的大小。大小是值的机器表示的大小。unknown类型允许编译器通过将类型信息从特定类型改变为unknown类型以受控的方式来丢弃类型信息。它允许编译器生成取决于所操纵的值的大小的代码,即使在类型是unknown的情况下。其它类型可使用unknown类型,因此unknown类型也允许部分类型信息的表示(其中某些但并非所有信息是已知的)。
例如,假定指向int类型的指针。在某一降级阶段,可能期望丢弃类型信息int。unknown类型允许编译器用unknown类型来替换int类型。类型检查器然后无需检查所关注的指针是否指向正确的类型。它本质上进行这样的冒险:即所指向的值将以在运行时不会不利地影响程序功能的方式来处理。
使用unknown类型的另一示例是用于为函数定义类型。如果调用具有指向unknwon的类型指针的形参的函数,其中形参先前已将类型指针指向int,则编译器必需相信传递了正确的类型。解除指针引用的结果可以已知或不是已知为int;然而,它可用作int。一个更复杂的示例是在虚拟函数调用从高级到低级中间表示的转换期间中间临时变量的引入。虚拟表(v表)在面向对象的语言中广泛用于实现虚拟调用。低级中间表示中作出虚拟函数调用的第一步是从存储器中取出对象的第一字段。第一字段包含指向v表的指针。取数据的结果然后被赋值给临时变量。构造临时变量的类型(表示指向v表的指针的类型,其中v表可具有许多字段)可以是复杂且难以表示的。相反,编译器可简单地向中间临时变量赋值“指向unknown的指针”。由此,对unknown类型的使用简化了较晚阶段的编译,在这些阶段中,保存详细类型信息是不必要的,或可能对编译器实现器表现出重大负担。
图3示出了用于在编译的各阶段对类型化的中间语言表示进行类型检查,并因此示出了在各个降低级别上对类型化的中间语言进行类型检查的编译器系统的一个实施例。源代码300表示各种源语言中的任一种。源代码300被翻译成类型化的中间语言的HIR 302。通过这样做,源语言的类型表示被翻译成对于类型化的中间语言的内部类型表示。
如对于图1和2所解释的HIR贯穿整个编译过程被降级。为该图示的目的,示出了高(HIR)302、中(MIR)304以及低(LIR)306级表示。然而,该实施例不限于此。可对任意数量的编译阶段进行类型检查。
每一表示级别处的中间语言可以由类型检查器308进行类型检查。类型检查器308实现了用于向编译过程的每一阶段,并因此向中间语言的每一表示应用一个或多个规则集310的算法或过程。规则集310是为语言的各种属性,诸如源语言、编译阶段、何种类型化强度等设计的一组规则。
例如,假定源代码300包含以C++编程语言创作的代码。C++源代码300首先被翻译成类型化的中间语言的HIR 302。如有所需,在这一点上,类型检查器308可与HIR 302交互,以确定任何数量的属性。这些属性可包括编译阶段(HIR)、存在的源代码的类型(C++)、语言是否类型化(是)、是松类型化还是强类型化(松)等等。基于这些属性,类型检查器可选择一适当的规则集。一旦选择了一个规则集,类型检查器依照该规则集对HIR进行类型检查。一旦HIR被降级到MIR或LIR,将再次访问属性,并且相同或不同的规则集可以是适当的。
在一个实施例中,这些类型检查规则集可被提供给类型检查器。一个规则集可对应于“强”类型检查,诸如对C#或MSIL的类型检查是期望的。另一规则集可对应于“弱”类型检查,它可以是比“强”类型检查更松的类型检查。例如,弱类型检查规则集可以准许类型转换。类型强制转换是使一种类型的变量作为另一种类型来行动以供单次使用。例如,可使类型int的变量如char(字符)那样来行动。以下代码使用了类型转换来打印字母“P”。
int a;
a=80;
cout<<(char)a;
由此,即使“a”被定义为类型int,并被赋值80,但由于类型转换,cout语句将变量“a”作为类型char来对待,并因此显示“P”(ASCII值80)而非80。
最后,一个规则集可对应于“表示”检查。“表示”检查可允许中间程序表示的各部分中丢弃的类型信息,诸如通过使用unknown类型,并可包括指示这一类型信息何时被丢弃时或何时可用unknown类型替代另一类型时的规则。例如,返回类型Void的值的函数的结果可以禁止被赋值给unknown类型的变量。
另外,可在单个编译阶段使用一个以上规则集。例如,假定源代码300包含单个语言,但是包含强类型化的某些段和松类型化的某些段。类型检查器可对某些强类型化段的HIR使用一个规则集,并对松类型化的代码段使用另一规则集。
图4是在类似于图3所描述的编译器系统中使用的类型检查器的框图。类型检查器400可接受对应于不同源语言和/或不同编译阶段的任意数量的规则集作为输入。在图4中,将四个规则集402-408提供给类型检查器400。规则集402表示用于具有强类型化语言的HIR的规则集,规则集404表示用于具有弱类型化语言的HIR的规则集,规则集406表示用于具有无类型化语言的HIR的规则集,而规则集408表示用于LIR的规则集。程序模块410表示具有HIR形式的强类型化的语言,而程序模块412表示在被降级到LIR之后的程序模块410。
类型检查器400基于正进行类型检查的程序模块的属性选择适当的规则集,并使用结合的过程或算法将所选择的规则集应用于程序模块。例如,类型检查器400可选择规则集402(表示用于具有强类型化语言的HIR的规则集),以对程序模块410(表示具有HIR形式的强类型化的语言)进行类型检查。随后,类型检查器400然后可选择规则集408(表示用于LIR的规则集),以对程序模块412(表示具有LIR形式的强类型化的语言)进行类型检查。
图5是用于选择由类型检查器应用的规则集的过程的一个可能实施例的流程图。在框500,类型检查器读入源代码的类型化中间表示的一个段,并且必需选择用于类型检查的规则集。判别框502确定类型化的中间语言是HIR、MIR还是LIR。
如果是HIR或MIR,则处理判别504以确定原始源代码是松类型化还是强类型化的。如果是松类型化的,则处理框506以选择对应于弱类型检查的规则集。如果是强类型化的,则处理框508以选择对应于强类型检查的规则集。
如果是LIR,则处理判别框510以选择对应于表示类型检查的规则集。应当注意,图5仅是一个实施例。可选择对应于且基于不同属性的任意数量的规则集。
所描述的类型检查系统的规则集可被容易地扩展到完全新的语言,并也可被扩展到现有语言的新特征。例如,如果引入新的语言,则只需为该新语言创作新规则集。由于规则集与类型检查器或编译器本身是分离的,且被设计成接受规则集作为单独的实体,因此用于新语言的新规则集可被分发,而无需重新分发或更新现有的类型检查系统或编译器。同样,如果新特征被添加到现有语言,诸如向C++添加XML支持,则在各编译阶段处对应于C++的规则集可被任意地动态重新配置以处理新特征。再一次,无需更新或分发新的核心系统。
规则集也可允许对类型约束。例如,当类从另一类继承时是否允许对特定类型使用子类型化可以是在规则中描述的一个约束。另一约束可以是加框约束,诸如可能期望指示数据可被转换成包含数据的虚拟表。其它约束可包括大小约束,或指示相同原语类型的必要性的原语类型约束。与规则集的任何其它部分一样,新约束可如所需地添加。
由类型检查器使用的规则集可以通过用于创作规则集的应用程序编程接口来构造。该应用程序可构造规则,使得规则集在类型原语的分层结构中用分配给类型化中间语言的个别指令的规则来表示。分层结构可以用类型图的形式来表示,类型图明确地表达了与特定程序模块或编译单元有关的类型的各种元素。诸如符号和操作等IR元素与类型系统的元素相关联。类型图节点描述了原语,并构造了类型及其关系,诸如组件、嵌套类型、函数签名、接口类型、分层结构元素以及诸如源名和对模块/汇编外部类型元素的引用等其它信息。
简单类型规则的一个示例如下:
ADD
N=add n,n
为本示例的目的,假定I是signed integer(带符号整数)类型,U是unsignedinteger类型,X是任一integer类型,F是float,N是上述的任一种。图6示出了这些类型之间的分层关系。类型N在分层结构的顶部。类型F和X从类型N向下分支以形成分层结构的后续层次。最后,类型U和I从X类型向下分支以形成分层结构的最低层。由此,对于“ADD”中间语言指令,依照该规则,仅类型N或分层结构中的较低层可由add指令来处理,且操作数在分层结构中必须不高于结果。例如,两个整数可相加,以产生整数(I=ADD i,i),或者一个整数和一个浮点数可相加以产生浮点数(F=ADD i,f)。然而,浮点数和整数不能相加来产生整数(I=ADD i,f)。
将类型原语表示为分层结构允许容易地改变规则集。在过去,类型规则通常在编程上使用源代码来表达。例如,类型检查器可包含实现类型检查器规则的大量开关语句。由此,改变规则要求修改类型检查器的源代码。然而,分层的规则集提供了更容易的可扩展性。考虑先前用于ADD指令的规则。如果开发者希望添加一个类型,例如复杂类型C,则可简单地在分层结构的N类型下方添加,如图7所示,且用于ADD指令的规则无需改变以如所需地运作。
用于在类型检查系统中对照类型规则检查指令的一种方法在图8中示出。首先,对框800处理以在句法上检查指令。由此,考虑806处的指令,类型检查器确保依照用于ADD指令的类型规则存在正确数量的源和目标表达式(例如,在这一情况下,有2个源表达式以及1个目标表达式)。每一表达式(以及子表达式)可具有其上的中间表示的显式类型。在框802,类型检查器然后实际地验证e1、e2以及foo(e3)的显式类型符合用于ADD指令的类型规则。在框804,类型检查器在必要时遍历子层次以进一步对指令进行类型检查。例如,类型检查器可检查表达式e1、e2和foo(e3)与其显式类型相一致。例如,类型检查器可检查foo具有函数类型。它可检查函数类型的结果类型与foo(e3)上的显式类型相同。它还可检查有单个形参类型,以及类型e3与该类型相匹配。这确保对e3的调用的类型与类型规则相匹配。
图9示出了担当用于类型检查系统的一个实施例的操作环境的计算机系统的示例。计算机系统包括个人计算机920,包括处理单元921、系统存储器922以及将包括系统存储器的各类系统组件耦合至处理单元921的系统总线923。系统总线可以包括若干种总线结构类型的任一种,包括存储器总线或存储器控制器、外围总线以及使用各类总线体系结构的局部总线,仅举几个例子,这类体系结构诸如PCI、VESA、微通道(MCA)、ISA和EISA。系统存储器包括只读存储器(ROM)924和随机存取存储器(RAM)925。基本输入/输出系统(BIOS)926,包含如在启动时协助在计算机920内的元件之间传输信息的基本例程,可储存在ROM 924中。个人计算机920也可包括硬盘驱动器927,例如用于对可移动磁盘929进行读写的磁盘驱动器928,以及例如用于读CD-ROM或对其它光介质进行读写的光盘驱动器930。硬盘驱动器927、磁盘驱动器928以及光盘驱动器930分别通过硬盘驱动器接口932、磁盘驱动器接口933和光盘驱动器接口939连接至系统总线923。驱动器及其相关联的计算机可读介质为个人计算机920提供了数据、数据结构、计算机可执行指令(诸如动态链接库等程序模块以及可执行文件)等的非易失性存储。尽管对计算机可读介质的描述指的是硬盘、可移动磁盘以及CD,然而也可以包括计算机可读的其它类型的介质,包括盒式磁带、闪存卡、数字多功能盘、Bernoulli盒式磁盘、RAM、ROM等等。
多个程序模块可储存在驱动器和RAM 925中,包括操作系统935、一个或多个应用程序936、其它程序模块937以及程序数据938。用户可以通过键盘940和定点设备(诸如鼠标942)向计算机920输入命令和信息。其它输入设备(未示出)可包括麦克风、操纵杆、游戏垫、圆盘式卫星天线、扫描仪等等。这些和其它输入设备通常通过耦合至系统总线的串行端口接口949连接到处理单元921,但也可通过其它接口连接,如并行端口、游戏端口或通用串行总线(USB)。监视器947或另一显示设备也通过接口,如显示控制器或视频适配器948连接到系统总线923。除监视器之外,个人计算机通常包括其它外围输出设备(未示出),如扬声器和打印机。
个人计算机920可以使用到一个或多个远程计算机,如远程计算机949的逻辑连接在网络化环境中操作。远程计算机949可以是服务器、路由器、网络PC、对等设备或其它常见的网络节点,并通常包括许多或所有相对于个人计算机920所描述的元件,尽管在图9中仅示出了存储器存储设备950。图9描述的逻辑连接包括局域网(LAN)951和广域网(WAN)952。这类网络环境常见于办公室、企业范围计算机网络、内联网以及因特网。
当在LAN网络环境中使用时,计算机920通过网络接口或适配器953连接至局域网951。当在WAN网络环境中使用时,个人计算机920通常包括调制解调器954或用于通过广域网952,如因特网建立通信的其它装置。调制解调器954可以是内置或外置的,通过串行端口接口946连接至系统总线923。在网络化环境中,相对于个人计算机920所描述的程序模块或其部分可储存在远程存储器存储设备中。可以理解,示出的网络连接是示例性的,也可以使用在计算机之间建立通信链路的其它手段。
示出并描述了所示实施例的原理之后,本领域的技术人员可以明白,可以在排列和细节上修改这些实施例而不脱离这些原理。
例如,此处的一个实施例描述了一个或多个规则集,它们可被提供给类型检查器或编译器,使得编译器或类型检查器基于进行类型检查的语言和/或编译阶段来选择一个或多个规则集以对语言进行类型检查。然而,作为替换,可将单个规则集提供给类型检查器或编译器,使得编译器或类型检查器在运行时静态或动态地、基于进行类型检查的语言和/或编译阶段从该单个规则集中构造一个或多个规则子集
鉴于许多可能的实施例,可以认识到,所示实施例仅包括示例,且不应当被认为是限制本发明的范围。相反,本发明由所附权利要求书来定义。因此,要求保护落入所附权利要求书的范围内的所有这样的实施例作为本发明。
                                      附录A
//------------------------------------------------------------------------------//
// 描述:
//
//   IR类型
//
//
//   类型类分层结构                             引入的描述和原语属性
//   --------------------               -------------------------------------------
//   Phx::Type                                  - 类型的抽象基类
//      Phx::PtrType                          - 指针类型
//      Phx::ContainerType                    - 容器类型(具有成员的类型)
//             Phx::ClassType                - 类类型
//                Phx::MgdArrayType          - 受管数组类型
//             Phx::StructType               - 结构类型
//             Phx::InterfaceType           - 接口类型
//             Phx::EnumType                   - 枚举类型
//      Phx::FuncType                         - 函数类型
//                                               属性:ArgTypes,Return Type
//
//      Phx::UnmgdArrayType                    - 受管数组
//                                               属性:Dim,Referent
//
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
//
// 描述:
//
//   用于IR类型的基类
//
//------------------------------------------------------------------------------
_abstract_public_gc
class Type:public Phx::Object
{
public:
    // 用于比较类型的函数
    virtual Boolean Is Assignable(Phx::Type * srcType);
    virtual Boolean Is Equal(Phx::Type * type);
public:
    // 公有属性
    DEFINE_GET_PROPERTY(Phx::TypeKind,       TypeKind,   typeKind);
    DEFINE_GET_ROPERTY(Phx::SizeKind,       SizeKind,   sizeKind);
    DEFINE_GET_PROPERTY(Phx::BitSize,      BitSize,   bitSize);
    DEFINE_GET_PROPERTY(Symbols::ConstSym *,ConstSym,   constSym);
    DEFINE_GET_PROPERTY(Phx::ExternalType *,ExternalType,externalType);
    DEFINE_GET_PROPERTY(Phx::PrimTypeKindNum,PrimTypeKind,primTypeKind);
    GET_PROPERTY(Phx::TypeSystem *,TypeSystem);
protected:
   // 受保护域
   Phx::TypeKind        typeKind;   // type classification
   Phx::SizeKind       sizeKind;   // size classification
   Phx::BitSize       bitSize;   // size in bits when constant
   Symbols::ConstSym *constSym;   // size in bits when symbolic
   Phx::PrimTypeKindNum primTypeKind;
   Phx::ExterlType *  externalType; // optionally null
};
//------------------------------------------------------------
//
// 描述:
//
//   容器类型 - 用于具有成员的类型的抽象类
//
//--------------------------
_abstract_public_gc
class ContainerType:public QuantifiedType,public IScope
{
    DEFINE_PROPERTY(Symbols::FieldSym *,FieldSymList,fieldSymList);
private:
    // 私有域
    Symbols::FieldSym * fieldSymList;
};
//--------------------------------------------
//
// 描述:
//
//   类容器类型
//
//------------------------------------------------------------------------------
_public_gc
class ClassType:public ContainerType
{
public:
    // 公有静态构造函数
   static Phx::ClassType * New
   (
        Phx::TypeSystem *         typeSystem,
        Phx::BitSize             bitSize,
        Phx::ExternalType *     externalType
    );
public:
   // 公有属性
   DEFINE_GET_PROPERTY(Phx::Type *,UnboxedType,        unboxedType);
   DEFINE_PROPERTY(    ClassType *,ExtendsClassType,extendsClassType);
   DEFINE_GET_PROPERTY(Phx::Collections::InterfaceTypeList *,
      ExplicitlyImplements,explicitlyImplements);
protected:
   // 受保护属性
   DEFINE_SET_PROPERTY(Phx::Collections::InterfaceTypeList *,
      ExplicitlyImplements,explicitlyImplements);
private:
   // 私有域
   Phx::Type *                              unboxedType;
   Phx::ClassType *                         extendsClassType;
Phx::Collections::InterfaceTypeList * explicitlyImplements;
};
//------------------------------------------------------------------------------
//
// 类:StructType
//
// 描述:
//
//    结构类型
//
//
//------------------------------------------------------------------------------
_public_gc
class StructType:public ContainerType
{
public:
   // 公有静态构造函数
   static Phx::StructType * New
   (
        Phx::TypeSystem *           typeSystem,
        Phx::BitSize                bitSize,
        Phx::ExternalType *         externalType
);
public:
   // 公有属性
   DEFINE_GET_PROPERTY(Phx::ClassType *,BoxedType,boxedType);
private:
   // 私有域
   Phx::ClassType*boxedType;
};
//------------------------------------------------------------------------------
//
// 类:PrimType
//
// 描述:
//
//    原语类型
//
//------------------------------------------------------------------------------
_public_gc
class PrimType:public StructType
{
public:
   // 公有静态构造函数
   static Phx::PrimType *
   New
   (
      Phx::TypeSystem *          typeSystem,
      Phx::PrimTypeKindNum         primTypeKind,
      Phx::BitSize              bitSize,
      Phx::ExternalType *      externalType
   );
public:
   // 公有方法
   static Phx::PrimType *
   GetScratch
   (
      Phx::PrimType * type,
      PrimTypeKindNum kind,
      Phx::BitSize bitSize
   );
   Phx::PrimType * GetResized
   (
      Phx::BitSize bitSize
   );
public:
   // 公有属性
   DEFINE_GET_PROPERTY(Phx::TypeSystem *,TypeSystem,typeSystem);
private:
   // 私有域
Phx::TypeSystem * typeSystem;
};
//------------------------------------------------------------------------------
//
// 类:InterfaceType
//
// 描述:
//
//    接口类型
//
//------------------------------------------------------------------------------
_public_gc
class InterfaceType:public ContainerType
{
public:
   // 公有静态构造函数
   static Phx::InterfaceType * New
   (
       Phx::TypeSystem *            typeSystem,
       Phx::ExternalType *         externalType
   );
public:
   // 公有属性
   DEFINE_PROPERTY(          Phx::ClassType *,ExtendsClassType,extendsClassType);
   DEFINE_ET_PROPERTY(Phx::Collections::InterfaceTypeList *,
      ExplicitlyImplements,explicitlyImplements);
protected:
   // 受保护属性
   DEFINE_SET_PROPERTY(Phx::Collections::InterfaceTypeList *,
      ExplicitlyImplements,explicitlyImplements);
private:
   // 私有域
   Phx::ClassType *                          extendsClassType;
   Phx::Collections::InterfaceTypeList * explicitlyImplements;
};
//------------------------------------------------------------------------------
//
// 类:EnumType
//
// 描述、:
//
//   枚举类型
//
//------------------------------------------------------------------------------
_public_gc
class EnumType:public ContainerType
{
public:
   // 公有静态构造函数
   static Phx::EnumType * New
   (
       Phx::TypeSystem *         typeSystem,
       Phx::ExternalType *      externalType,
       Phx::Type *                underLyingType
   );
public:
   // 公有属性
   DEFINE_GET_PROPERTY(Phx::ClassType *,BoxedType,boxedType);
   DEFINE_GET_PROPERTY(Phx::Type *,UnderlyingType,underlyingType);
private:
   // 私有域
   Phx::Type * underlyingType;
   Phx::ClassType * boxedType;
};
//------------------------------------------------------------------------------
//
//类:MgdArrayType
//
// 描述:
//
//    受管数组类型
//
//
//------------------------------------------------------------------------------
_public_gc
class MgdArrayType:public ClassType
{
public:
   // 公有静态构造函数
   static Phx::MgdArrayType * New
   (
       Phx::TypeSystem *         typeSystem,
       Phx::ExternalType *      externalType,
       Phx::Type *               elementType
   );
public:
   // 公有属性
   DEFINE_GET_PROPERTY(Phx::Type *,        ElementType,elementType);
private:
   // 私有域
   Phx::Type * elementType;
};
//------------------------------------------------------------------------------
//
// 类:UnmgdArrayType
//
// 描述:
//
//     非受管数组类型
//
//
//------------------------------------------------------------------------------
_public_gc
class UnmgdArrayType:public Type
{
public:
   // 公有静态构造函数
   static Phx::UnmgdArrayType * New
   (
       Phx::TypeSystem *          typeSystem,
       Phx::BitSize               bitSize,
       Phx::ExternalType *       externalType,
       Phx::Type *                referentType
   );
public:
   // 公有属性
   DEFINE_GET_PROPERTY(int,         Dim,              dim);
   DEFINE_GET_PROPERTY(Phx::Type *,Referent,     referent);
private:
   // 私有域
   int         dim;
   Phx::Type * referent;
};
//------------------------------------------------------------------------------
//
// 描述:
//
//    指针类型
//
//
//------------------------------------------------------------------------------
_public_gc
class PtrType:public Type
{
public:
   // 公有静态构造函数
   static Phx::PtrType * New
   (
       Phx::TypeSystem *             typeSystem,
       Phx::PtrTypeKind              ptrTypeKind,
       Phx::BitSize                  bitSize,
       Phx::Type *                    referent,
       Phx::ExternalType *           externalType
   );
   // 不带所指向的类型的构造函数
   static Phx::PtrType * New
   (
       Phx::TypeSystem *             typeSystem,
       Phx::PtrTypeKind              ptrTypeKind,
       Phx::BitSize                  bitSize,
       Phx::ExternalType *           externalType
   );
public:
   // 公有属性
   DEFINE_GET_PROPERTY(Phx::PtrTypeKind,  PtrTypeKind,  ptrTypeKind);
   DEFINE_GET_PROPERTY(Phx::Type *,       Referent,     referent);
private:
   // 私有域
   Phx::PtrTypeKind    ptrTypeKind;
   Phx::Type *         referent;
};
//------------------------------------------------------------------------------
//
// 枚举:CallingConvention
//
// 描述:
//
// 表示调用约定类型的初步枚举
//
//------------------------------------------------------------------------------
BEGIN_ENUM(CallingConventionKind)
{
   _Illegal=0,
   CLRCall,
   CDecl,
   StdCall,
   ThisCall,
   FastCall
}
END_ENUM(CallingConventionKind);
//------------------------------------------------------------------------------
//
// 类:FuncType
//
// 描述
//
//    函数类型
//
//
//------------------------------------------------------------------------------
_public_gc
class FuncType:public QuantifiedType
{
public:
   // 公有静态构造函数
public:
   // 公有方法
   Int32           CountArgs();
   Int32           CountRets();
   Int32           CountArgsForInstr();
   Int32           CountRetsForInstr();
   Int32           CountUserDefinedArgs();
   Int32           CountUserDefinedRets();
   Phx::FuncArg * GetNthArgFuncArg(Int32 index);
   Phx::FuncArg * GetNthRetFuncArg(Int32 index);
   Phx::FuncArg * GetNthArgFuncArgForInstr(Int32 index);
   Phx::FuncArg * GetNthRetFuncArgForInstr(Int32 index);
   Phx::FuncArg * GetNthUserDefinedArgFuncArg(Int32 index);
   Phx::FuncArg * GetNthUserDefinedRetFuncArg(Int32 index);
   Phx::Type *     GetNthArgType(Int32 index);
   Phx::Type *     GetNthRetType(Int32 index);
   Phx::Type *     GetNthArgTypeForInstr(Int32 index);
   Phx::Type *     GetNthRetTypeForInstr(Int32 index);
   Phx::Type *     GetNthUserDefinedArgType(Int32 index);
   Phx::Type *     GetNthUserDefinedRetType(Int32 index);
    public:
       // 公有属性
       DEFINE_GET_PROPERTY(Phx::CallingConventionKind,        CallingConvention,
callingConvention);
       GET_PROPERTY(Phx::Type *,       RetType);
       // 如果该函数类型具有省略的函数形参则为真
       GET_PROPERTY(Boolean,           IsVarArgs);
       GET_ROPERTY(Boolean,            IsInstanceMethod);
       GET_PROPERTY(Boolean,           IsClrCall);
       GET_PROPERTY(Boolean,           IsCDecl);
       GET_PROPERTY(Boolean,           IsStdCall);
       GET_PROPERTY(Boolean,           IsThisCall);
       GET_ROPERTY(Boolean,            IsFastCall);
       // 如果该函数具有返回值则不为真
       GET_PROPERTY(Boolean,           ReturnsVoid);
    protected:
       // 受保护域
       Phx::CallingConventionKind   callingConvention;
       Phx::FuncArg *                argFuncArgs;
       Phx::FuncArg *                retFuncArgs;
    };
    //-----------------------------------------------------------------------------
    //
    // 描述:
    //
    //    编译期间使用的全局类型系统
    //
    //
    //-----------------------------------------------------------------------------
    _public_gc
    class TypeSystem:public Phx::Object
    {
    public:
       // 公有静态构造函数
       static TypeSystem *
       New
       (
          Phx::BitSize      regIntBitSize,
          Phx::BitSize      nativeIntBitSize,
          Phx::BitSize      nativePtrBitSize,
          Phx::BitSize      nativeFloatBitSize,
       );
       public:
   // 公有方法
   void Add(Type * type);
public:
   // 创建的类型的列表
   DEFINE_GET_PROPERTY(Phx::Type *,AllTypes,       allTypes);
private:
   // 系统中所有类型的列表
   Phx::Type * allTypes;
};
//------------------------------------------------------------------------------
//
// 描述:
//
//    描述类型的各种枚举
//
//------------------------------------------------------------------------------
// 用于IR类型的类和值类型
// 不同种类的类型
BEGIN_ENUM(TypeKind)
{
    _Illegal=0,
    Class,
    Struct,
    Interface,
    Enum,
    MgdArray,
    UnmgdArray,
    Ptr,
    Func,
    Variable,
    Quantifier,
    Application,
    TypedRef,
}
END_ENUM(TypeKind);
// 不同种类的类型大小
BEGIN_ENUM(SizeKind)
{
    _Illegal=0,
    Constant,
    Symbolic,
    Unknown
}
END_ENUM(SizeKind);
// 不同类型的指针
BEGIN_ENUM(Ptr TypeKind)
{
    _Illegal=0,
    ObjPtr,          // 指向整个对象的_gc指针
    MgdPtr,           // 指向内部对象的_gc指针
    UnmgdPtr,         // _nogc指针
    NullPtr,         // 不指向任何内容的指针
    _NumPtrTypeKinds
}
END_ENUM(PtrTypeKind);
}

Claims (19)

1.一种依照一个或多个类型检查规则集在编译器中对编程语言进行类型检查的方法,包括:
基于当前编译阶段选择一个或多个类型检查规则集;以及
基于所选择的一个或多个类型检查规则集对所述编程语言进行类型检查,
其中,所述多个类型检查规则集包括对应于强类型检查的一个类型检查规则集、对应于弱类型检查的一个类型检查规则集、以及对应于表示类型检查的一个类型检查规则集。
2.如权利要求1所述的方法,其特征在于,所述编程语言的特征描述了所述语言的类型系统。
3.如权利要求1所述的方法,其特征在于,对所述编程语言进行类型检查包括对所述编程语言的多个中间表示的每一个进行类型检查。
4.如权利要求3所述的方法,其特征在于,所选择的一个或多个类型检查规则集对每一中间表示是不同的。
5.如权利要求1所述的方法,其特征在于,所述编程语言包括指示所述编程语言的元素可以是多个类型中的一个类型的类型。
6.如权利要求5所述的方法,其特征在于,所述一个或多个类型检查规则集包含用于对指示所述编程语言的元素可以是多个类型中的一个类型的类型进行类型检查的规则。
7.如权利要求1所述的方法,其特征在于,所述一个或多个类型检查规则集包括分层格式的多个规则。
8.如权利要求1所述的方法,其特征在于,所述表示类型检查允许对所述编程语言的元素丢弃类型信息。
9.如权利要求1所述的方法,其特征在于,所述弱类型检查允许类型强制转换。
10.一种用于对以多种源语言创作的源代码进行类型检查的类型检查系统,包括:
多个类型检查规则集;以及
类型检查器,其中,所述类型检查器是编译器的一部分,所述类型检查器选择一个或多个类型检查规则集以在多个中间表示的每一个中间表示处应用于所述源代码,
其中,所述多个类型检查规则集包括对应于强类型检查的一个类型检查规则集、对应于弱类型检查的一个类型检查规则集、以及对应于表示类型检查的一个类型检查规则集。
11.如权利要求10所述的系统,其特征在于,所述多个类型检查规则集的每一个对应于特定的源语言。
12.如权利要求10所述的系统,其特征在于,所述多个类型检查规则集的每一个对应于特定的类型检查强度。
13.一种在编译器中对被表示为类型化的中间表示的源代码进行类型检查的方法,包括:
基于所述类型化的中间表示从不同的类型检查规则集中选择一个类型检查规则集,其中选择一个类型检查规则集是基于编译过程中的一系列阶段中的哪一阶段产生了所述类型化的中间表示;以及
基于所选择的类型检查规则集对所述类型化的中间表示进行类型检查,
其中,所述多个类型检查规则集包括对应于强类型检查的一个类型检查规则集、对应于弱类型检查的一个类型检查规则集、以及对应于表示类型检查的一个类型检查规则集。
14.如权利要求13所述的方法,其特征在于,选择类型检查规则集是基于从其中产生所述类型化的中间表示的源语言。
15.如权利要求13所述的方法,其特征在于,选择类型检查规则集是基于处理器体系结构。
16.如权利要求13所述的方法,其特征在于,选择类型检查规则集是基于所述类型化的中间表示是表示验证的还是未验证的代码。
17.如权利要求13所述的方法,其特征在于,选择类型检查规则集是基于所述类型化的中间表示是表示类型安全的代码还是非类型安全的代码。
18.如权利要求13所述的方法,其特征在于,选择类型检查规则集是基于所述类型化的中间表示是表示类型化的代码还是非类型化的代码。
19.如权利要求13所述的方法,其特征在于,选择类型检查规则集是基于所述类型化的中间表示是表示强类型化的代码还是弱类型化的代码。
CNB2004800181124A 2003-06-27 2004-05-21 在编译过程中表示和检查程序组件的一致性的可扩展类型系统 Expired - Fee Related CN100474252C (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US10/607,601 2003-06-27
US10/607,601 US7086041B2 (en) 2003-06-27 2003-06-27 Extensible type system for representing and checking consistency of program components during the process of compilation

Publications (2)

Publication Number Publication Date
CN1875345A CN1875345A (zh) 2006-12-06
CN100474252C true CN100474252C (zh) 2009-04-01

Family

ID=33540309

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004800181124A Expired - Fee Related CN100474252C (zh) 2003-06-27 2004-05-21 在编译过程中表示和检查程序组件的一致性的可扩展类型系统

Country Status (7)

Country Link
US (2) US7086041B2 (zh)
EP (1) EP1639461A4 (zh)
JP (1) JP4794437B2 (zh)
KR (1) KR101086082B1 (zh)
CN (1) CN100474252C (zh)
TW (1) TWI416412B (zh)
WO (1) WO2005006119A2 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10795651B2 (en) 2016-10-28 2020-10-06 Huawei Technologies Co., Ltd. Method and apparatus for compiling source code object, and computer

Families Citing this family (65)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7086041B2 (en) * 2003-06-27 2006-08-01 Microsoft Corporation Extensible type system for representing and checking consistency of program components during the process of compilation
US7818729B1 (en) * 2003-09-15 2010-10-19 Thomas Plum Automated safe secure techniques for eliminating undefined behavior in computer software
US7856624B2 (en) * 2003-09-15 2010-12-21 Thomas Plum Automated safe secure techniques for eliminating undefined behavior in computer software
US7810080B2 (en) * 2003-09-15 2010-10-05 Thomas Plum Automated safe secure techniques for eliminating undefined behavior in computer software
US7657874B2 (en) * 2004-08-24 2010-02-02 Microsoft Corporation Pattern types as constraints on generic type parameters
US7730465B2 (en) * 2004-10-22 2010-06-01 Microsoft Corporation Mixed types
US20060212847A1 (en) * 2005-03-18 2006-09-21 Microsoft Corporation Type checker for a typed intermediate representation of object-oriented languages
US7512938B2 (en) * 2005-03-18 2009-03-31 Microsoft Corporation Typed intermediate representation for object-oriented languages
US20070027849A1 (en) * 2005-07-29 2007-02-01 Microsoft Corporation Integrating query-related operators in a programming language
US7685567B2 (en) * 2005-07-29 2010-03-23 Microsoft Corporation Architecture that extends types using extension methods
US7702686B2 (en) * 2005-07-29 2010-04-20 Microsoft Corporation Retrieving and persisting objects from/to relational databases
US20070044083A1 (en) * 2005-07-29 2007-02-22 Microsoft Corporation Lambda expressions
US20070027905A1 (en) * 2005-07-29 2007-02-01 Microsoft Corporation Intelligent SQL generation for persistent object retrieval
US7631011B2 (en) * 2005-07-29 2009-12-08 Microsoft Corporation Code generation patterns
US7353504B2 (en) * 2005-12-09 2008-04-01 Bea Systems, Inc. System and method for efficiently generating native code calls from byte code in virtual machines
US7958493B2 (en) * 2006-01-20 2011-06-07 Kevin Edward Lindsey Type inference system and method
US8171461B1 (en) * 2006-02-24 2012-05-01 Nvidia Coporation Primitive program compilation for flat attributes with provoking vertex independence
US7870542B1 (en) 2006-04-05 2011-01-11 Mcafee, Inc. Calling system, method and computer program product
US8225294B2 (en) * 2006-04-27 2012-07-17 Oracle America, Inc. Method and apparatus for expressing and checking relationships between types
US8365157B2 (en) * 2006-11-09 2013-01-29 Oracle International Corporation System and method for early platform dependency preparation of intermediate code representation during bytecode compilation
US8255887B2 (en) * 2006-11-29 2012-08-28 International Business Machines Corporation Method and apparatus for re-using memory allocated for data structures used by software processes
US20080141230A1 (en) * 2006-12-06 2008-06-12 Microsoft Corporation Scope-Constrained Specification Of Features In A Programming Language
US8850414B2 (en) * 2007-02-02 2014-09-30 Microsoft Corporation Direct access of language metadata
US7805456B2 (en) * 2007-02-05 2010-09-28 Microsoft Corporation Query pattern to enable type flow of element types
US7865533B2 (en) * 2007-02-05 2011-01-04 Microsoft Corporation Compositional query comprehensions
US8490051B2 (en) * 2007-02-28 2013-07-16 Microsoft Corporation Generic interface for numeric types
US8079023B2 (en) * 2007-03-22 2011-12-13 Microsoft Corporation Typed intermediate language support for existing compilers
US20080282238A1 (en) * 2007-05-10 2008-11-13 Microsoft Corporation Static type for late binding
US8321847B1 (en) * 2007-05-17 2012-11-27 The Mathworks, Inc. Dynamic function wizard
US8060868B2 (en) * 2007-06-21 2011-11-15 Microsoft Corporation Fully capturing outer variables as data objects
US8032870B2 (en) * 2007-06-25 2011-10-04 Microsoft Corporation Transacting accesses via unmanaged pointers
US8196121B2 (en) * 2007-08-23 2012-06-05 International Business Machines Corporation Modular integration of distinct type systems for the compilation of programs
US8914774B1 (en) 2007-11-15 2014-12-16 Appcelerator, Inc. System and method for tagging code to determine where the code runs
US8954989B1 (en) 2007-11-19 2015-02-10 Appcelerator, Inc. Flexible, event-driven JavaScript server architecture
US8260845B1 (en) 2007-11-21 2012-09-04 Appcelerator, Inc. System and method for auto-generating JavaScript proxies and meta-proxies
US8719451B1 (en) 2007-11-23 2014-05-06 Appcelerator, Inc. System and method for on-the-fly, post-processing document object model manipulation
US8566807B1 (en) 2007-11-23 2013-10-22 Appcelerator, Inc. System and method for accessibility of document object model and JavaScript by other platforms
US8806431B1 (en) 2007-12-03 2014-08-12 Appecelerator, Inc. Aspect oriented programming
US8756579B1 (en) 2007-12-03 2014-06-17 Appcelerator, Inc. Client-side and server-side unified validation
US8819539B1 (en) 2007-12-03 2014-08-26 Appcelerator, Inc. On-the-fly rewriting of uniform resource locators in a web-page
US8938491B1 (en) 2007-12-04 2015-01-20 Appcelerator, Inc. System and method for secure binding of client calls and server functions
US8527860B1 (en) 2007-12-04 2013-09-03 Appcelerator, Inc. System and method for exposing the dynamic web server-side
US8639743B1 (en) 2007-12-05 2014-01-28 Appcelerator, Inc. System and method for on-the-fly rewriting of JavaScript
US8285813B1 (en) 2007-12-05 2012-10-09 Appcelerator, Inc. System and method for emulating different user agents on a server
US8335982B1 (en) 2007-12-05 2012-12-18 Appcelerator, Inc. System and method for binding a document object model through JavaScript callbacks
US8181167B2 (en) * 2008-01-09 2012-05-15 Kan Zhao Method and system for presenting and analyzing software source code through intermediate representation
US8291079B1 (en) 2008-06-04 2012-10-16 Appcelerator, Inc. System and method for developing, deploying, managing and monitoring a web application in a single environment
US8880678B1 (en) 2008-06-05 2014-11-04 Appcelerator, Inc. System and method for managing and monitoring a web application using multiple cloud providers
US7596620B1 (en) 2008-11-04 2009-09-29 Aptana, Inc. System and method for developing, deploying, managing and monitoring a web application in a single environment
US20100088686A1 (en) * 2008-10-06 2010-04-08 Microsoft Corporation Programming language with extensible syntax
US8276111B2 (en) * 2008-12-19 2012-09-25 Microsoft Corporation Providing access to a dataset in a type-safe manner
US8955043B2 (en) * 2010-01-27 2015-02-10 Microsoft Corporation Type-preserving compiler for security verification
US8739118B2 (en) 2010-04-08 2014-05-27 Microsoft Corporation Pragmatic mapping specification, compilation and validation
US9183014B2 (en) 2011-02-16 2015-11-10 Intel Corporation Enabling virtual calls in a SIMD environment
US9104795B2 (en) * 2011-06-28 2015-08-11 International Business Machines Corporation Integrating compiler warnings into a debug session
CN102520963B (zh) * 2011-12-26 2014-10-01 重庆新媒农信科技有限公司 基于强类型关系映射实现业务逻辑处理的方法及系统
US20140047423A1 (en) 2012-08-09 2014-02-13 Filip J. Pizlo Runtime State Based Code Re-Optimization
US9524175B2 (en) 2012-11-14 2016-12-20 Oracle International Corporation Target typing of overloaded method and constructor arguments
US9600256B2 (en) * 2013-10-18 2017-03-21 Microsoft Technology Licensing, Llc Incrementally compiling software artifacts from an interactive development environment
US9772828B2 (en) * 2014-04-22 2017-09-26 Oracle International Corporation Structural identification of dynamically generated, pattern-instantiation, generated classes
US10216501B2 (en) * 2015-06-04 2019-02-26 The Mathworks, Inc. Generating code in statically typed programming languages for dynamically typed array-based language
US10423397B2 (en) * 2016-12-29 2019-09-24 Grammatech, Inc. Systems and/or methods for type inference from machine code
CN110308908B (zh) * 2018-03-20 2023-07-18 北京小米移动软件有限公司 应用的配置文件的生成和应用页面的展示方法、装置及存储介质
US10530662B2 (en) 2018-05-11 2020-01-07 Cisco Technology, Inc. Machine learning method to validate run-time rules and detect software/hardware consistency errors for network elements
WO2022030796A1 (ko) * 2020-08-06 2022-02-10 고려대학교 산학협력단 빈타이퍼: 씨++ 프로그램 바이너리 대상의 타입 컨퓨전 버그 탐지

Family Cites Families (92)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4734854A (en) * 1985-10-08 1988-03-29 American Telephone And Telegraph Company System for generating software source code components
CA1248238A (en) * 1985-10-17 1989-01-03 Francis D. Lawlor Compiler including retargetable data generation
US5659753A (en) * 1991-02-27 1997-08-19 Digital Equipment Corporation Interface for symbol table construction in a multilanguage optimizing compiler
IL100989A (en) * 1991-02-27 1995-10-31 Digital Equipment Corp Analysis of inductive expressions in multilingual mehadoptimization
US5598560A (en) 1991-03-07 1997-01-28 Digital Equipment Corporation Tracking condition codes in translation code for different machine architectures
JP3602857B2 (ja) * 1991-04-23 2004-12-15 株式会社日立製作所 多機種対応型情報処理システム、および、方法
US5488727A (en) * 1991-09-30 1996-01-30 International Business Machines Corporation Methods to support multimethod function overloading with compile-time type checking
US5805885A (en) * 1992-12-24 1998-09-08 Microsoft Corporation Method and system for aggregating objects
CA2102089C (en) * 1993-10-29 1999-05-25 David M. Gillies Recompilation of computer programs for enhanced optimization
US5628016A (en) 1994-06-15 1997-05-06 Borland International, Inc. Systems and methods and implementing exception handling using exception registration records stored in stack memory
US5742828A (en) * 1994-08-03 1998-04-21 Microsoft Corporation Compiler and method for evaluation of foreign syntax expressions in source code
US5754858A (en) * 1996-05-01 1998-05-19 Microsoft Corporation Customizable application project generation process and system
US6151703A (en) * 1996-05-20 2000-11-21 Inprise Corporation Development system with methods for just-in-time compilation of programs
IL127492A (en) 1996-06-11 2004-06-01 Edgar Codd Delta model processing logic representation and execution system
US6041179A (en) * 1996-10-03 2000-03-21 International Business Machines Corporation Object oriented dispatch optimization
US6463581B1 (en) * 1996-10-03 2002-10-08 International Business Machines Corporation Method for determining reachable methods in object-oriented applications that use class libraries
US6247169B1 (en) 1996-11-04 2001-06-12 Sun Microsystems, Inc. Structured exception-handling methods, apparatus, and computer program products
US5937195A (en) * 1996-11-27 1999-08-10 Hewlett-Packard Co Global control flow treatment of predicated code
US5943499A (en) * 1996-11-27 1999-08-24 Hewlett-Packard Company System and method for solving general global data flow predicated code problems
US5857105A (en) * 1997-02-05 1999-01-05 Hewlett-Packard Company Compiler for reducing number of indirect calls in an executable code
US6212672B1 (en) * 1997-03-07 2001-04-03 Dynamics Research Corporation Software development system with an executable working model in an interpretable intermediate modeling language
US5918235A (en) 1997-04-04 1999-06-29 Hewlett-Packard Company Object surrogate with active computation and probablistic counter
US6149318A (en) 1997-04-15 2000-11-21 Samuel C. Kendall Link-time and run-time error detection, and program instrumentation
US6009273A (en) * 1997-05-29 1999-12-28 Hewlett-Packard Company Method for conversion of a variable argument routine to a fixed argument routine
US5999739A (en) * 1997-05-29 1999-12-07 Hewlett-Packard Company Method and apparatus for elimination of redundant branch instructions from a program
US6085035A (en) * 1997-09-09 2000-07-04 Sun Microsystems, Inc. Method and apparatus for efficient operations on primary type values without static overloading
US6070011A (en) * 1997-10-21 2000-05-30 Hewlett-Packard Co. Compiler for performing a loop fusion, dependent upon loop peeling and/or loop reversal
US5966702A (en) 1997-10-31 1999-10-12 Sun Microsystems, Inc. Method and apparatus for pre-processing and packaging class files
US6148302A (en) * 1998-02-26 2000-11-14 Sun Microsystems, Inc. Method, apparatus, system and computer program product for initializing a data structure at its first active use
US6330717B1 (en) * 1998-03-27 2001-12-11 Sony Corporation Of Japan Process and system for developing an application program for a distributed adaptive run-time platform
US6249910B1 (en) * 1998-05-04 2001-06-19 Hewlett-Packard Company Apparatus and method for incrementally update static single assignment form for cloned variable name definitions
US6578090B1 (en) * 1998-06-08 2003-06-10 Ricoh Company, Ltd. System and method for interfacing two modules supporting various applications
JP3320358B2 (ja) * 1998-06-18 2002-09-03 インターナショナル・ビジネス・マシーンズ・コーポレーション コンパイル方法、例外処理方法、及びコンピュータ
US6247172B1 (en) * 1998-07-02 2001-06-12 Hewlett-Packard Company Method for a translation system that aggressively optimizes and preserves full synchronous exception state
US6131187A (en) * 1998-08-17 2000-10-10 International Business Machines Corporation Method and system for translating exception handling semantics of a bytecode class file
US6289446B1 (en) 1998-09-29 2001-09-11 Axis Ab Exception handling utilizing call instruction with context information
US6182284B1 (en) * 1998-09-30 2001-01-30 Hewlett-Packard Company Method and system for eliminating phi instruction resource interferences and redundant copy instructions from static-single-assignment-form computer code
US6292938B1 (en) * 1998-12-02 2001-09-18 International Business Machines Corporation Retargeting optimized code by matching tree patterns in directed acyclic graphs
US6412109B1 (en) 1999-01-29 2002-06-25 Sun Microsystems, Inc. Method for optimizing java bytecodes in the presence of try-catch blocks
US6353924B1 (en) * 1999-02-08 2002-03-05 Incert Software Corporation Method for back tracing program execution
US6286134B1 (en) * 1999-04-23 2001-09-04 Sun Microsystems, Inc. Instruction selection in a multi-platform environment
US6526570B1 (en) * 1999-04-23 2003-02-25 Sun Microsystems, Inc. File portability techniques
US6374368B1 (en) * 1999-05-21 2002-04-16 Microsoft Corporation Weakest precondition analysis
US6484312B1 (en) * 1999-06-07 2002-11-19 Microsoft Corporation Inferring operand types within an intermediate language
US20020166115A1 (en) 1999-06-10 2002-11-07 A.V.S. Sastry System and method for computer program compilation using scalar register promotion and static single assignment representation
US6460178B1 (en) * 1999-06-30 2002-10-01 Microsoft Corporation Shared library optimization for heterogeneous programs
US6662356B1 (en) * 1999-06-30 2003-12-09 Microsoft Corporation Application program interface for transforming heterogeneous programs
US6481008B1 (en) * 1999-06-30 2002-11-12 Microsoft Corporation Instrumentation and optimization tools for heterogeneous programs
US6381738B1 (en) * 1999-07-16 2002-04-30 International Business Machines Corporation Method for optimizing creation and destruction of objects in computer programs
US6629312B1 (en) * 1999-08-20 2003-09-30 Hewlett-Packard Development Company, L.P. Programmatic synthesis of a machine description for retargeting a compiler
US6560774B1 (en) * 1999-09-01 2003-05-06 Microsoft Corporation Verifier to check intermediate language
US6487716B1 (en) * 1999-10-08 2002-11-26 International Business Machines Corporation Methods and apparatus for optimizing programs in the presence of exceptions
US6625808B1 (en) * 1999-12-10 2003-09-23 Microsoft Corporation Method and apparatus for facilitating memory management in a program comprised of heterogeneous components
US6598220B1 (en) * 1999-12-17 2003-07-22 Dell Products L.P. System and method for allowing registerable runtime modification of object behaviors
US6804814B1 (en) 1999-12-29 2004-10-12 Veritas Operating Corporation Method for simulating back program execution from a traceback sequence
US6745383B1 (en) * 1999-12-29 2004-06-01 Veritas Operating Corporation Early warning mechanism for enhancing enterprise availability
US6748584B1 (en) * 1999-12-29 2004-06-08 Veritas Operating Corporation Method for determining the degree to which changed code has been exercised
US6738967B1 (en) * 2000-03-14 2004-05-18 Microsoft Corporation Compiling for multiple virtual machines targeting different processor architectures
JP3974742B2 (ja) * 2000-04-14 2007-09-12 インターナショナル・ビジネス・マシーンズ・コーポレーション コンパイル装置、最適化方法および記録媒体
US6981249B1 (en) * 2000-05-02 2005-12-27 Microsoft Corporation Methods for enhancing type reconstruction
US6678805B1 (en) * 2000-05-25 2004-01-13 Microsoft Corporation Structure organization for improved cache performance
US6625804B1 (en) * 2000-07-06 2003-09-23 Microsoft Corporation Unified event programming model
CA2321018A1 (en) 2000-09-27 2002-03-27 Ibm Canada Limited-Ibm Canada Limitee Optimizing compilation by forward store movement
US6854110B2 (en) 2000-12-21 2005-02-08 Microsoft Corporation System and method for obtaining scratch registers in computer executable binaries
US6925639B2 (en) 2001-02-23 2005-08-02 Microsoft Corporation Method and system for register allocation
US6993751B2 (en) * 2001-05-14 2006-01-31 Microsoft Corporation Placing exception throwing instructions in compiled code
US7013460B2 (en) * 2001-05-15 2006-03-14 Hewlett-Packard Development Company, L.P. Specifying an invariant property (range of addresses) in the annotation in source code of the computer program
JP3790683B2 (ja) * 2001-07-05 2006-06-28 インターナショナル・ビジネス・マシーンズ・コーポレーション コンピュータ装置、その例外処理プログラム及びコンパイル方法
US6961932B2 (en) * 2001-08-15 2005-11-01 Microsoft Corporation Semantics mapping between different object hierarchies
US7117488B1 (en) * 2001-10-31 2006-10-03 The Regents Of The University Of California Safe computer code formats and methods for generating safe computer code
US6834383B2 (en) 2001-11-26 2004-12-21 Microsoft Corporation Method for binary-level branch reversal on computer architectures supporting predicated execution
US7426719B2 (en) 2001-11-29 2008-09-16 Microsoft Corporation Method and system for rewriting unwind data in the presence of exceptions
US7346901B2 (en) * 2001-12-18 2008-03-18 Microsoft Corporation Efficient generic code in a dynamic execution environment
US20030126590A1 (en) * 2001-12-28 2003-07-03 Michael Burrows System and method for dynamic data-type checking
US7600222B2 (en) * 2002-01-04 2009-10-06 Microsoft Corporation Systems and methods for managing drivers in a computing system
US6934940B2 (en) * 2002-01-30 2005-08-23 International Business Machines Corporation Source code transformation-temporary object reduction
JP4202673B2 (ja) * 2002-04-26 2008-12-24 株式会社東芝 システムlsi開発環境生成方法及びそのプログラム
US7213245B2 (en) 2002-05-14 2007-05-01 Microsoft Corporation Software on demand system
US7228540B2 (en) 2002-05-14 2007-06-05 Microsoft Corporation Preparation for software on demand system
US7185328B2 (en) 2002-05-30 2007-02-27 Microsoft Corporation System and method for improving a working set
US7243342B2 (en) * 2002-06-11 2007-07-10 Intel Corporation Methods and apparatus for determining if a user-defined software function is a memory allocation function during compile-time
US7055132B2 (en) * 2002-06-28 2006-05-30 Microsoft Corporation System and method for associating properties with objects
US7367022B2 (en) 2002-09-05 2008-04-29 Intel Corporation Methods and apparatus for optimizing the operating speed and size of a computer program
US7370321B2 (en) 2002-11-14 2008-05-06 Microsoft Corporation Systems and methods to read, optimize, and verify byte codes for a multiplatform jit
US7472400B2 (en) * 2003-02-28 2008-12-30 Bea Systems, Inc. Method for dynamically generating a wrapper class
US7380242B2 (en) * 2003-05-14 2008-05-27 Mainsoft Israel Ltd. Compiler and software product for compiling intermediate language bytecodes into Java bytecodes
DE20307903U1 (de) * 2003-05-19 2003-08-21 Trilux Lenze Gmbh & Co Kg Seilaufhängung für Leuchten
US7559050B2 (en) * 2003-06-30 2009-07-07 Microsoft Corporation Generating software development tools via target architecture specification
US7120898B2 (en) * 2003-06-26 2006-10-10 Microsoft Corporation Intermediate representation for multiple exception handling models
US7305666B2 (en) * 2003-07-23 2007-12-04 Microsoft Corporation Description language for an extensible compiler and tools infrastructure
US7086041B2 (en) * 2003-06-27 2006-08-01 Microsoft Corporation Extensible type system for representing and checking consistency of program components during the process of compilation
US7269718B2 (en) * 2004-04-29 2007-09-11 International Business Machines Corporation Method and apparatus for verifying data types to be used for instructions and casting data types if needed

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10795651B2 (en) 2016-10-28 2020-10-06 Huawei Technologies Co., Ltd. Method and apparatus for compiling source code object, and computer
US11281441B2 (en) 2016-10-28 2022-03-22 Huawei Technologies Co., Ltd. Method and apparatus for compiling source code object, and computer

Also Published As

Publication number Publication date
TWI416412B (zh) 2013-11-21
EP1639461A2 (en) 2006-03-29
US20060242628A1 (en) 2006-10-26
JP2007521567A (ja) 2007-08-02
KR101086082B1 (ko) 2011-11-25
US7086041B2 (en) 2006-08-01
EP1639461A4 (en) 2010-12-22
TW200508973A (en) 2005-03-01
CN1875345A (zh) 2006-12-06
KR20060026896A (ko) 2006-03-24
WO2005006119A2 (en) 2005-01-20
JP4794437B2 (ja) 2011-10-19
US20040268328A1 (en) 2004-12-30
WO2005006119A3 (en) 2005-12-29

Similar Documents

Publication Publication Date Title
CN100474252C (zh) 在编译过程中表示和检查程序组件的一致性的可扩展类型系统
US7162709B2 (en) System and method for common code generation
US9047583B2 (en) Ontology context logic at a key field level
US7865870B2 (en) Automatic content completion of valid values for method argument variables
US5758160A (en) Method and apparatus for building a software program using dependencies derived from software component interfaces
US7685581B2 (en) Type system for representing and checking consistency of heterogeneous program components during the process of compilation
US7788652B2 (en) Representing type information in a compiler and programming tools framework
Horton Ivor Horton's Beginning Visual C++ 2013
US20060070043A1 (en) System and method for analyzing computer code
Albahari et al. C# Essentials: Programming the. NET Framework
Boshernitsan Harmonia: A flexible framework for constructing interactive language-based programming tools
NO329240B1 (no) System og fremgangsmate for forklarende definering og bruk av undergrupper innenfor dokumentkoding
JP5399601B2 (ja) 実装コード開発システム、及び実装コード開発プログラム
Jana C++ and object-oriented programming paradigm
Jana Java and object-oriented programming paradigm
EP3966679A1 (en) System and method of computer-assisted computer programming
Papurt Inside the Object Model: the sensible Use of C++
Templeman Microsoft Visual C++/CLI Step by Step
Skansholm C++ from the Beginning
Herbert C# 4.0 The Complete Reference
Lippman C# primer: a practical approach
Schildt et al. C#: a beginner's guide
Ludin Learn BlackBerry 10 App Development: A Cascades-Driven Approach
Starr et al. Making Translation Decisions
Kent et al. Kent Modelling Framework Version–Tutorial

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: MICROSOFT TECHNOLOGY LICENSING LLC

Free format text: FORMER OWNER: MICROSOFT CORP.

Effective date: 20150422

C41 Transfer of patent application or patent right or utility model
TR01 Transfer of patent right

Effective date of registration: 20150422

Address after: Washington State

Patentee after: Micro soft technique license Co., Ltd

Address before: Washington State

Patentee before: Microsoft Corp.

CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20090401

Termination date: 20170521

CF01 Termination of patent right due to non-payment of annual fee