Package org.openquark.cal.compiler.io

Examples of org.openquark.cal.compiler.io.EntryPointSpec


                GemGraphGenerator generator = new GemGraphGenerator (calServices, jobDescription);

                //create each new job in separate modules.
                ModuleName jobModuleName = ModuleName.make(jobDescription.getJobId().toUpperCase());

                EntryPointSpec entry = calServices.addNewModuleWithFunction(jobModuleName, generator.getCalSource());

                MessageSource messageSource = MessageSourceFactory.createMessageSource (jobDescription);
                MonitorJob job = new MonitorJob (jobDescription, messageSource, entry);

                messageSource.addStatusListener (makeStatusListener (job));
View Full Code Here


                        try {

                            //Make entry point specs - there will be numCompilationsPerThread unique
                            //entry point specs
                            EntryPointSpec spec =
                                EntryPointSpec.make(CAL_Prelude.Functions.add, new InputPolicy[] {
                                        InputPolicy.makeWithMarshaler(SourceModelUtilities.TextParsing.parseExprIntoSourceModel("add ("+j*2+"::Int) # Prelude.input ", new MessageLogger())),
                                        InputPolicy.DEFAULT_INPUT_POLICY},
                                        OutputPolicy.DEFAULT_OUTPUT_POLICY);

View Full Code Here

        SourceModel.FunctionDefn function = SourceModel.FunctionDefn.Algebraic.make(
            functionName, Scope.PRIVATE, null, expr);

        try {
            EntryPointSpec entryPointSpec = calServices.addNewModuleWithFunction(moduleName, function);
           
            return calServices.runFunction(entryPointSpec, new Object[0]);

        } finally {
View Full Code Here

   
    public void testTouchesThenRuns() throws CALExecutorException, GemCompilationException {
        // Touch the List.head() function
        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();

        EntryPointSpec headString = EntryPointSpec.make(CAL_List.Functions.head,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_TYPE));
        entryPointCache.cacheEntryPoints(Collections.singletonList(headString));
       
        // Use a status listener to assert that the List adjunct module doesn't get recompiled
        calServices.getWorkspaceManager().addStatusListener(listCompilationListener);
View Full Code Here

       
        assertEquals("one", entryPointCache.runFunction(headString, new Object[] { TEST_LIST }, executionContext));
    }
   
    public void testMultipleRunsOfSameFunction() throws InterruptedException {
        final EntryPointSpec headString = EntryPointSpec.make(CAL_List.Functions.head,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_TYPE));

        // Create many threads that will use the same entry point - the first should
        // safely compile the adjunct and the rest should use it without compiling again
        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();
View Full Code Here

            element.join();
        }
    }
   
    public void testMultipleOverlappingTouches() throws CALExecutorException, GemCompilationException {
        final EntryPointSpec headString = EntryPointSpec.make(CAL_List.Functions.head,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_TYPE));
        final EntryPointSpec tailString = EntryPointSpec.make(CAL_List.Functions.tail,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_LIST_TYPE));
        final EntryPointSpec reverseString = EntryPointSpec.make(CAL_List.Functions.reverse,
                OutputPolicy.makeTypedDefaultOutputPolicy(STRING_LIST_TYPE));
        final EntryPointSpec lengthString = EntryPointSpec.make(CAL_List.Functions.length,
                new InputPolicy[] { InputPolicy.makeTypedDefaultInputPolicy(STRING_LIST_TYPE)},
                OutputPolicy.DEFAULT_OUTPUT_POLICY);
       
        final ExecutionContext executionContext = calServices.getWorkspaceManager().makeExecutionContextWithDefaultProperties();
View Full Code Here

        WorkspaceManager workspaceManager = leccCALServices.getWorkspaceManager();
        CompilerMessageLogger logger = new MessageLogger();
       
       
        // Compile the adjunct definition.       
        EntryPointSpec entryPointSpec = EntryPointSpec.make(qualifiedAdjunctName, new InputPolicy[0], OutputPolicy.DEFAULT_OUTPUT_POLICY);
        workspaceManager.getCompiler().getEntryPoint (source, entryPointSpec, adjunctModuleName,  logger);

        if (logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
            fail("Compilation failed: " + logger.getFirstError().getMessage());
        }
View Full Code Here

                }

                //update the cache with the new entry points
                // entry point spec
                for (int i = 0, n = entryPoints.size(); i < n; i++) {
                    EntryPointSpec entryPointSpec = requiredList.get(i);
                    EntryPoint entryPoint = entryPoints.get(i);
                    if (entryPoint != null) {
                        cache.put(entryPointSpec, entryPoint);
                    } else {
                        cache.remove(entryPointSpec);
View Full Code Here

     * @throws CALExecutorException
     */
    public void testTypedInput_Test() throws CALExecutorException {
        //policies can be used there.
        CompilerMessageLogger messageLogger = new MessageLogger();
        EntryPointSpec addSpec = EntryPointSpec.make(QualifiedName.make(CAL_Prelude.MODULE_NAME, "add"), new InputPolicy[] {
            InputPolicy.INT_INPUT_POLICY,
            InputPolicy.DEFAULT_INPUT_POLICY
        }, OutputPolicy.DEFAULT_OUTPUT_POLICY);
       
        EntryPoint add = compiler.getEntryPoint(addSpec, CAL_Prelude.MODULE_NAME, messageLogger);
View Full Code Here

     * @throws CALExecutorException
     */
    public void testTypedOutput_Test() throws CALExecutorException {
        //policies can be used there.
        CompilerMessageLogger messageLogger = new MessageLogger();
        EntryPointSpec addSpec = EntryPointSpec.make(QualifiedName.make(CAL_Prelude.MODULE_NAME, "add"), new InputPolicy[] {
            InputPolicy.DEFAULT_INPUT_POLICY,
            InputPolicy.DEFAULT_INPUT_POLICY
        }, OutputPolicy.INT_OUTPUT_POLICY);
       
        EntryPoint add = compiler.getEntryPoint(addSpec, CAL_Prelude.MODULE_NAME, messageLogger);
View Full Code Here

TOP

Related Classes of org.openquark.cal.compiler.io.EntryPointSpec

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.