gov.llnl.babel.backend.c

Class StubHeader


public class StubHeader
extends java.lang.Object

Class StubHeader writes a C client header to a language writer output stream. The constructor takes a language writer stream and method generateCode writes the C client header code for the specified symbol to the output stream. The language writer output stream is not closed by this object.

Field Summary

static int
DUMP_STATS
Indices associated with the special, stub-only built-in methods.
static int
MAX_RARRAY_INLINE
Maximum number of rarray arguments allowed in an inlined method.
static int
SET_CHECKING
static int
SET_HOOKS
static String
s_epv
static String
s_self
static String
s_sepv_func

Constructor Summary

StubHeader(LanguageWriterForC writer, Context context)
Create a StubHeader object that will write symbol information to the provided output language writer stream.

Method Summary

static void
generateBuiltinSignature(LanguageWriterForC lw, int type, SymbolID id, boolean doStatic, String terminator)
Generate the specified stub-only built-in method signature.
void
generateCode(Symbol symbol)
Write C client header information for the provided symbol to the language writer output stream provided in the constructor.
static void
generateCode(Symbol symbol, LanguageWriterForC writer, Context context)
This is a convenience utility function that writes the C client header information into the provided language writer output stream.
static String
getBuiltinArgList(int type)
Return the comma-separated list of arguments associated with the specified built-in method.
static String
getBuiltinComment(int type, boolean doStatic)
Return the comment description associated with the specified built-in stub.
static String
getDerefFunctionPtr(String baseName, boolean doStatic)
Return a string that dereferences the specified IOR function pointer.
static boolean
stubInlineMethod(Method m)

Field Details

DUMP_STATS

public static final int DUMP_STATS
Indices associated with the special, stub-only built-in methods.
Field Value:
0

MAX_RARRAY_INLINE

public static final int MAX_RARRAY_INLINE
Maximum number of rarray arguments allowed in an inlined method. <= 0 means no inlining of methods with rarray arguments > 0 allows some inlining of methods with rarray arguments. It's unclear what a good value of this should be. Each rarray argument increases the size of the stub which may cause binary file sizes to increase.
Field Value:
1

SET_CHECKING

public static final int SET_CHECKING
Field Value:
1

SET_HOOKS

public static final int SET_HOOKS
Field Value:
2

s_epv

public static final String s_epv

s_self

public static final String s_self

s_sepv_func

public static final String s_sepv_func

Constructor Details

StubHeader

public StubHeader(LanguageWriterForC writer,
                  Context context)
Create a StubHeader object that will write symbol information to the provided output language writer stream.
Parameters:
writer - the output writer to which the header will be written. This will not be closed.

Method Details

generateBuiltinSignature

public static void generateBuiltinSignature(LanguageWriterForC lw,
                                            int type,
                                            SymbolID id,
                                            boolean doStatic,
                                            String terminator)
Generate the specified stub-only built-in method signature.

generateCode

public void generateCode(Symbol symbol)
            throws CodeGenerationException
Write C client header information for the provided symbol to the language writer output stream provided in the constructor. This method does not close the writer output stream and may be called for more than one symbol (although the written header may not be valid input for the C compiler). A code generation exception is written if an error is detected.
Parameters:
symbol - the Symbol whose header will be written.
Throws:
CodeGenerationException - this is a catch all exception. It can be caused by I/O trouble or violations of the data type invariants.

generateCode

public static void generateCode(Symbol symbol,
                                LanguageWriterForC writer,
                                Context context)
            throws CodeGenerationException
This is a convenience utility function that writes the C client header information into the provided language writer output stream. The output stream is not closed on exit. A code generation exception is thrown if an error is detected.
Parameters:
symbol - the symbol for which a C client header will be written.
writer - the output writer to which the header will be written. This will not be closed.

getBuiltinArgList

public static String getBuiltinArgList(int type)
Return the comma-separated list of arguments associated with the specified built-in method. The entries must match the names and ordering found (above) in generateStubBuiltinSignature().

getBuiltinComment

public static String getBuiltinComment(int type,
                                       boolean doStatic)
Return the comment description associated with the specified built-in stub.

getDerefFunctionPtr

public static String getDerefFunctionPtr(String baseName,
                                         boolean doStatic)
Return a string that dereferences the specified IOR function pointer.

stubInlineMethod

public static boolean stubInlineMethod(Method m)