Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

org.openquark.cal.compiler
Class Packager

java.lang.Object
  extended by org.openquark.cal.compiler.Packager

public abstract class Packager
extends Object

Warning- this class should only be used by the CAL compiler implementation. It is not part of the external API of the CAL platform.

The Packager currently is used to instrument analysis phases that occur after the compiler generates Expression values for the core functions in a module. This includes applying the global CAL optimizer, anti-alias transformations (and other optimizations done in the ExpressionAnalyzer, such as simple inlining of a few well known functions). Its end output can be used by the machines for code generation.

Author:
LWE

Nested Class Summary
static class Packager.PackagerException
          Exception raised on a packaging error
 
Field Summary
static String OPTIMIZER_LEVEL
           
 
Constructor Summary
Packager(org.openquark.cal.machine.Program program, org.openquark.cal.machine.CodeGenerator cg)
          Construct a RunPackager which packages directly to a Program then executes it.
 
Method Summary
 void abort(CompilerMessageLogger logger)
          Abort this package.
 void addStatusListener(StatusListener listener)
           
 void close(CompilerMessageLogger logger)
          Close the package.
 org.openquark.cal.machine.Module getCurrentModule()
          Return the current module.
abstract  org.openquark.cal.machine.MachineFunction getMachineFunction(CoreFunction coreFunction)
           
 ModuleTypeInfo getModuleTypeInfo(ModuleName moduleName)
          Gets the ModuleTypeInfo for modules that have already been wrapped by the Packager.
static int getOptimizerLevel()
           
 org.openquark.cal.machine.Program getProgram()
          Return the compiled program object.
 Set<StatusListener> getStatusListeners()
           
 void initAdjunct(ModuleName adjunctModuleName)
          Initialize packaging of the current adjunct.
 void newModule(ModuleName name, ClassLoader foreignClassLoader)
          Create a new module object into which future 'stores' will place program objects.
 void removeStatusListener(StatusListener listener)
           
 void setModuleIncrement(double d)
           
 void store(CoreFunction coreFunction)
          Store this core function in the package into the current module.
 void switchModule(ModuleName name)
          Switches the current module to be the specified module.
 void useOptimizer()
          The packager will load the optimizer so that for all modules subsequently compiled the optimizer will be run.
 void wrapAdjunct(CompilerMessageLogger logger)
          Wrap the current adjunct: do any cleanup processing on the entire packaged contents.
 void wrapModule(CompilerMessageLogger logger)
          Wrap the current module: do any cleanup processing on the entire packaged contents.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OPTIMIZER_LEVEL

public static final String OPTIMIZER_LEVEL
See Also:
Constant Field Values
Constructor Detail

Packager

public Packager(org.openquark.cal.machine.Program program,
                org.openquark.cal.machine.CodeGenerator cg)
Construct a RunPackager which packages directly to a Program then executes it.

Parameters:
program - Program.
Method Detail

abort

public void abort(CompilerMessageLogger logger)
Abort this package.

Parameters:
logger - the logger to use for logging error messages.

close

public void close(CompilerMessageLogger logger)
           throws Packager.PackagerException
Close the package.

Parameters:
logger - the logger to use for logging error messages.
Throws:
Packager.PackagerException

getModuleTypeInfo

public ModuleTypeInfo getModuleTypeInfo(ModuleName moduleName)
Gets the ModuleTypeInfo for modules that have already been wrapped by the Packager. Returns null if the ModuleTypeInfo doesn't exist.

Parameters:
moduleName -
Returns:
ModuleTypeInfo

newModule

public void newModule(ModuleName name,
                      ClassLoader foreignClassLoader)
               throws Packager.PackagerException
Create a new module object into which future 'stores' will place program objects.

Parameters:
foreignClassLoader - the classloader to use to resolve foreign classes for the module.
Throws:
Packager.PackagerException

store

public void store(CoreFunction coreFunction)
           throws Packager.PackagerException
Store this core function in the package into the current module.

Parameters:
coreFunction - - the function to be stored
Throws:
Packager.PackagerException

getMachineFunction

public abstract org.openquark.cal.machine.MachineFunction getMachineFunction(CoreFunction coreFunction)
Parameters:
coreFunction - a machine-independent representation of the function.
Returns:
the machine-specific implementation for the core function

switchModule

public void switchModule(ModuleName name)
                  throws Packager.PackagerException
Switches the current module to be the specified module. The module must have already been added to the package.

Parameters:
name - the name of the module to switch to
Throws:
Packager.PackagerException

getProgram

public org.openquark.cal.machine.Program getProgram()
Return the compiled program object.


useOptimizer

public void useOptimizer()
The packager will load the optimizer so that for all modules subsequently compiled the optimizer will be run.


getCurrentModule

public org.openquark.cal.machine.Module getCurrentModule()
Return the current module.

Returns:
Module

getStatusListeners

public Set<StatusListener> getStatusListeners()

addStatusListener

public void addStatusListener(StatusListener listener)

removeStatusListener

public void removeStatusListener(StatusListener listener)

setModuleIncrement

public void setModuleIncrement(double d)

wrapModule

public void wrapModule(CompilerMessageLogger logger)
                throws Packager.PackagerException,
                       UnableToResolveForeignEntityException
Wrap the current module: do any cleanup processing on the entire packaged contents.

Parameters:
logger -
Throws:
Packager.PackagerException
UnableToResolveForeignEntityException

initAdjunct

public void initAdjunct(ModuleName adjunctModuleName)
                 throws Packager.PackagerException
Initialize packaging of the current adjunct.

Parameters:
adjunctModuleName -
Throws:
Packager.PackagerException

wrapAdjunct

public void wrapAdjunct(CompilerMessageLogger logger)
                 throws Packager.PackagerException,
                        UnableToResolveForeignEntityException
Wrap the current adjunct: do any cleanup processing on the entire packaged contents.

Parameters:
logger -
Throws:
Packager.PackagerException
UnableToResolveForeignEntityException

getOptimizerLevel

public static int getOptimizerLevel()
Returns:
the current level of optimization. Zero means the Global Optimizer is not run.

Business Objects
Quark Platform Documentation
Version 1.7.0_0
Business Objects

Copyright © 2007 Business Objects. All rights reserved.