`
lovnet
  • 浏览: 6819962 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
文章分类
社区版块
存档分类
最新评论

Rotor实现中用到的Macro(摘自Shared Source CLI Essentials)

阅读更多

General Macros

_ASSERTE

Defined in clr/src/inc/debugmacros.h, this is used to verify that an invariant holds true at runtime in debug-enabled builds.

C_ASSERT

CPP_ASSERT

These macros are used for language-specific compile-time assertions.

DEFINE_LOG_FACILITY

Defined in clr/src/inc/loglf.h to produce the list found in clr/src/inc/loglf.h, this is used to define facilities called out for individual configurability when tracing.

GET_UNALIGNED_16

GET_UNALIGNED_32

GET_UNALIGNED_64

Defined in clr/src/inc/palclr.h, these macros dereference a pointer and fetch a value, even if the pointer is not a naturally-aligned pointer. Natural alignment is defined as ((UINT_PTR)p & (sizeof(p)-1)) == 0.

For platforms that automatically handle misaligned memory references, these macros expand to a simple dereference. See also SET_UNALIGNED.

IfFailGoto

IfFailGo

IfFailRet

Also defined in clr/src/inc/debugmacros.h, these are used to branch conditionally on HRESULT values.

LOG

Defined in clr/src/inc/log.h, this is used in debug-enabled builds to issue a logging message. See also DEFINE_LOG_FACILITY.

MAKEDLLNAME_A

MAKEDLLNAME_W

These macros are used to convert a platform-independent basename into a platform-specific loadable library name. They append the operating system-specific prefix and suffix to the generic name. For example, MAKEDLLNAME_A("foo") will create libfoo.dylib on Mac OS X, libfoo.so on FreeBSD, and foo.dll on Windows. These macros are defined in clr/src/inc/palclr.h.

OPDEF

Use this macro, found in clr/src/inc/openum.h, to define CLI opcodes. The file clr/src/inc/opcode.def contains all opcode definitions for Rotor, and is shared by the C# compiler, the assembler and disassembler, and the execution engine.

PORTABILITY_ASSERT

PORTABILITY_WARNING

These are used within regions of code that differ from platform to platform. They are no-ops while working on a port, and once you've finished porting a platform-specific region, its WARNING should be changed to a matching ASSERT. To find regions of code that are platform-specific, use your favorite search or indexing utility to find these macros .

SET_UNALIGNED_16

SET_UNALIGNED_32

SET_UNALIGNED_64

Defined in clr/src/inc/palclr.h, these store a value into a pointer, even if the pointer is not naturally aligned. For platforms that automatically handle mis-aligned memory references, these macros expand to a simple dereferenced assignment. See also GET_UNALIGNED.

SwapString

SwapStringLength

SwapGuid

Defined in clr/src/inc/palclr.h, these perform an in-place byte swap of a string, counted string, or GUID structure.

VAL16

VAL32

VAL64

Defined in clr/src/inc/palclr.h, these are used to simplify writing code to run on both big-endian and little-endian processors. They are no-ops on little-endian platforms, but byte-swapped on big-endian platforms. Given a value composed of 16, 32, or 64 bits in little-endian format, they return the value in the native format.

Execution Engine Macros

BEGIN_FORBID

ENDFORBID

Defined in clr/src/vm/threads.h, these macros bracket code in which garbage collection is forbidden. They are activated in debug-enabled builds only.

COMPlusThrow

This macro, defined in clr/src/vm/exceptmacros.h, is used to throw exceptions from within execution engine code.

COMPLUS_TRY

COMPLUS_CATCH

COMPLUS_END_CATCH

COMPLUS_FINALLY

COMPLUS_END_FINALLY

These macros wrap the PAL_TRY family of macros with additional code that maintains internal execution engine data structures. In particular, these protect the integrity of the frame chain. They are defined in clr/src/vm/exceptmacros.h.

EE_TRY_FOR_FINALLY

EE_ FINALLY

EE_END_FINALLY

This is a simplified version of the COMPLUS_TRY macro that supports only finally clauses. (COMPLUS_TRY supports both catch and finally clauses.) It is defined in clr/src/vm/exceptmacros.h.

FCDECL*

FCIMPL*

The macros from this large series, defined and documented in clr/src/vm/fcall.h, are used to declare and implement FCalls. Platform-to-platform differences in FCall calling conventions are encapsulated inside these macros.

FCThrow

This macro is used to throw exceptions from within FCall implementations when a helper frame is not erected for the FCall. (COMPlusThrow would be used to throw exceptions if a helper frame were erected.) It is defined in clr/src/vm/frames.h.

GCPROTECT_BEGIN

GCPROTECT_ARRAY_BEGIN

GCPROTECT_BEGININTERIOR

GCPROTECT_END

This series of macros is used to mark memory locations (usually local variables) that contain object references. Locations that are protected using GC_PROTECT are visible to the garbage collector, and the objects that they reference can be promoted safely. These macros are defined in clr/src/vm/frames.h.

GETTHROWABLE

SETTHROWABLE

Defined in clr/src/vm/exceptmacros.h, these macros are used to get or set the thrown exception. GETTHROWABLE is usually used inside a COMPLUS_CATCH clause.

HELPER_METHOD_FRAME_*

Defined in clr/src/vm/fcall.h, these macros are used to erect a helper frame within an FCall implementation. These helper frames must exist when an FCall wishes to call other parts of the execution engine that might trigger garbage collection or cause nonlocal changes. Simple FCalls do not need helper frames. Some flavors of HELPER_METHOD_FRAME expose a simplified version of GC_PROTECT, to reduce the number of frames pushed in the FCall.

THROWSCOMPLUSEXCEPTION

This macro, defined in clr/src/vm/exceptmacros.h, is used to mark code blocks that can throw exceptions. This is used only in debug-enabled builds.

TRIGGERSGC

This macro is used in debug-enabled builds to mark code blocks that can trigger garbage collection. It is defined in clr/src/vm/threads.h.

JIT Compiler Macros

CHECK_STACK

CHECK_STACK_SIZE

When verification is turned on, these macros will verify that the evaluation stack is deep enough to be valid or that it matches an exact depth.

FJIT_FAIL

This macro will cause the current JIT compilation to fail and return an error code.

VALIDITY_CHECK

If verification is turned on, this macro will conditionally terminate a JIT compilation and return an error code that indicates that invalid code was provided.

VERIFICATION_CHECK

If verification is turned on, this macro will conditionally emit code to throw a verification exception. It is used within the JIT compiler.

There is a large series of macros used to emit code, which is contained in clr/src/fjit/fjitdef.h and is augmented by platform-specific redefinition files that can be found in subdirectories named after their processor targets:

x86_*

These are low-level, x86-specific macros used by fjitdef.h.

ppc_*

These are low-level, PowerPC-specific macros used by fjitdef.h.

emit_*

These are high-level, macros defined in fjitdef.h that can be redefined by platform-specific low-level macros.

emit_<IL OPCODE NAME>_*

These are portable macros that implement opcodes, and are frequently separated by the size of the stack and frame registers.

ARG_*

These definitions represent argument registers.

RETURN_*

These definitions represent return value registers.

The file clr/src/fjit/fjitdef.h also contains macros used to emit code for manipulating the stack and calling helper functions:

deregisterTOS

enregisterTOS

These macros are used by the JIT compiler to manage the top of the stack.

emit_arg

emit_reg_arg

emit_tos_arg

emit_tos_fixedsize_arg

emit_tos_indirect_to_arg

emit_reg_to_arg

These simple portable calling convention macros are used by the JIT compiler to set up arguments being passed on the stack.

emit_callhelper_*

These macros represent a portable way to make a call to a helper function.

emit_loadresult_*

emit_pushresult_*

These macros manage return value placement. (The mechanism used to return values is platform-specific.)

Finally, there are a few JIT macros that affect the runtime execution of code:

LABELSTACK

This macro, defined in clr/src/fjit/fjit.cpp, saves the a map of the evaluation stack and associates it with the current IL offset so that the garbage collector will be able to find roots on the stack. This macro is used before calls to JIT helper functions that may trigger garbage collection.

THROW_FROM_HELPER

THROW_FROM_HELPER_RET

These macros define a mechanism by which JIT helper functions can construct an exception context as though the exception occurred within the code of the JIT-compiled function that called them rather than in their own code. They are defined in clr/src/fjit/fjit.h.

PAL & Platform Macros

_PPC_

This is defined when compiling for Motorola PowerPC.

_X86_

This is defined when compiling for Intel x86.

BIGENDIAN

This is defined on big-endian platforms, and undefined on little-endian platforms.

HAVE_CASE_SENSITIVE_FILESYSTEM

This macro is defined to differentiate filesystems that are case-sensitive, such as FreeBSD, from filesystems that are case-insensitive, such as Windows or HFS+, the default and most frequently used Mac OS X filesystem.

HAVE_CFSTRING

This is defined if Mac OS X CoreFoundation CFString is present.

HAVE_COMPATIBLE_ASIN

HAVE_COMPATIBLE_ACOS

HAVE_COMPATIBLE_*

This is defined when C runtime math functions produce Windows-compatible results for edge-case values.

HAVE_POLL

This is defined if the poll( ) system call is implemented.

HAVE_STRTOK_R

This is defined if the strok_r( ) API is implemented.

MMAP_IGNORES_HINT

This is set when the mmap( ) system call ignores its hint argument.

PAL_TRY

PAL_EXCEPT

PAL_EXCEPT_EX

PAL_EXCEPT_FILTER

PAL_EXCEPT_FILTER_EX

PAL_FINALLY

PAL_FINALLY_EX

PAL_ENDTRY

The file pal/rotor_pal.h contains the API definitions for the PAL, as well as these macros, which result in calls against the PAL's exception-handling mechanism.

PLATFORM_UNIX

This is defined when building for Unix systems, and is used to control the formatting of things dictated by convention, such as line breaks, path and environment separator characters, and the like.

There are a number of macros used within the Unix PAL implementation:

ASSERT

This macro is different from the Win32 PAL and execution engine ASSERT macros in that it doesn't take an expression as an argument. It is a printf-style logger plus an optional debug breakpoint. This is a no-op in the "free" build.

LOGAPI

This is a printf-style logging call for the PAL. It is a no-ops in the "free" build.

PALASSERT

This macro asserts if its argument is false and is a no-op in the "free" build.

TRACE

WARN

ERROR

These printf-style logging calls are defined in pal/unix/include/dbgmsg.h and are no-ops in the "free" build.

分享到:
评论

相关推荐

    Shared Source CLI Essentials (2nd Edition) Draft

    #### 共享源代码 CLI(Shared Source CLI)介绍 - **定义与背景**:共享源代码 CLI(Common Language Infrastructure),代号为“Rotor”,是微软公开发布的 ECMA CLI 和 C# 语言规范的具体实现。它包含了大约三百万...

    Shared Source CLI 2.0 Internals

    《共享源代码CLI 2.0 内部结构》一书深入探讨了Microsoft Shared Source CLI(简称Rotor)的内部机制,这是对ECMA-335 CLI标准的可移植实现,以源代码形式分发。本书由Joel Pobar、Ted Neward与David Stutz和Geoff ...

    sscli_Shared Source CLI 2.0 (开发代号Rotor)

    Shared Source CLI 2.0 (开发代号Rotor) 是微软.NET Framework 2.0的Shared Source实现版本。Shared Source是微软推出的源代码共享计划,可以在一定限制的情况下获得/使用源代码,详情可以参考Microsoft Shared ...

    Shared Source CLI 2.0 Internals DRAFT

    《共享源代码CLI 2.0 内部结构》一书深入探讨了Microsoft Shared Source CLI(简称Rotor)的内部机制,这是对ECMA-335 CLI标准的可移植实现,以源代码形式分发。本书由Joel Pobar、Ted Neward与David Stutz和Geoff ...

    rotor37_CFD_rotor37_rotor37网格划分_MeshCase_NASARotor37_

    本资源“rotor37_CFD_rotor37_rotor37网格划分_MeshCase_NASARotor37_”提供了一个专门针对rotor37问题的网格案例,适用于CFD初学者进行学习和交流。 rotor37是一个经典的风力涡轮机叶片研究案例,源自NASA...

    Rotor37.rar

    标题中的"Rotor37.rar"指的是一个RAR格式的压缩文件,通常用于打包并压缩多个相关文件,便于存储和传输。RAR是一种高效的压缩算法,由尤里·扎哈罗夫开发,它提供了比ZIP更高的压缩率,并支持恢复记录,可以在文件...

    rotor37.geomTurbo

    rotor37的几何模型文件

    NASA_Rotor_67_Blade_data

    NASA_Rotor_67_Blade_data 是一个与航空领域密切相关的数据集,主要包含了NASA设计的第67号旋翼叶片的详细几何信息。这个数据集可能是为了研究、教学或模拟飞行器性能而提供的,尤其是直升机或倾转旋翼机等使用旋翼...

    NASA rotor37网格

    ROTOR37的numeca网格,格式为igg,带叶顶间隙,另外还有geomturbo文件

    rotor37的geomturbo文件

    NUMECA AUTOblade读取的rotor37文件,希望初学者有用!!

    SAMCEF ROTOR 理论手册

    《SAMCEF ROTOR 理论手册》是一本深入介绍转子动力学分析软件SAMCEF ROTOR的理论基础和应用的手册。SAMCEF ROTOR是一款专为旋转系统设计的分析工具,广泛应用于旋转机械的设计与分析,帮助工程师和研究人员理解和...

    rotor37网格文件和算例

    rotor37网格文件和算例

    Rotor software 说明文档

    安装过程相对简单,用户只需要创建一个新目录,将脚本复制到这个目录中,然后将该目录的位置添加到MATLAB的路径设置中(在最新版本的MATLAB中,路径设置选项位于“文件”菜单下)。示例文件可以放在另一个单独的目录...

    TRMS.rar_TRMS_Twin rotor mimo_rotor_twin rotor_wind simulator

    【TRMS.rar_TRMS_Twin rotor mimo_rotor_twin rotor_wind simulator】是一个与风力模拟和多轴旋翼系统相关的压缩包文件。这个文件很可能包含了一套名为"Twin Rotor MIMO System"(双旋翼多输入多输出系统)的相关...

    Andrew D. Dimarogonas-Analytical Methods in Rotor Dynamics(Second Edition)

    Dimarogonas-Analytical Methods in Rotor Dynamics(Second Edition)》是一本关于转子动力学的分析方法的教程书籍。作者Andrew D. Dimarogonas是希腊帕特雷大学机械工程和航空系的教授,他的研究工作为转子动力学...

    Rotor-Gene_2_0_2_4.exe

    Rotor-Gene_2_0_2_4.exe

    rotor wake

    这里涉及到的关键知识点包括转子尾迹的概念、转子尾迹对下游静子的动态压力响应、以及影响转子尾迹效应的关键因素。 首先,转子尾迹是由上游转子叶片产生的不均匀流场,它对下游的静子叶片产生影响。尾迹效应通常...

    Numerical analysis of nonlinear rotor–seal system

    The seal characteristic is an important factor affecting the performance of the rotor system. The nonlinear model of the rotor–seal system is established using Muszynska’s nonlinear seal forces. An ...

    HOPF BIFURCATION ANALYSIS OF A ROTOR/SEAL SYSTEM

    The Hopf bifurcation behaviour of a symmetric rotor/seal system was investigated using Muszynska's non-linear seal fluid dynamic force model.

    Computational techniques of rotor dynamics

    1. 利用有限元方法实现旋转结构中所有陀螺力的最精确计算仿真。 2. 高效准确的计算和数值技术的细节,用于动态仿真。 3. 计算结果的解释,这对于开发更稳定的旋转机械装置至关重要。 4. 旋转结构对内外激励动态响应...

Global site tag (gtag.js) - Google Analytics