Package org.openquark.cal.internal.javamodel

Examples of org.openquark.cal.internal.javamodel.JavaTypeName


                modifiers = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL | Modifier.SYNCHRONIZED;
            } else {
                modifiers = Modifier.PUBLIC | Modifier.STATIC | Modifier.FINAL;
            }

            JavaTypeName returnType = JavaTypeNames.RTFUNCTION;

            // Add the method to the class.
            JavaMethod javaMethod;
            if (functions.getNCAFs() + functions.getNZeroArityFunctions() <= 1) {
                javaMethod = new JavaMethod(modifiers,
View Full Code Here


                        // We append the names of the arguments with $L to allow the declared name to
                        // be used with the unboxed primitive value.
                        javaName += "$L";
                    }

                    JavaTypeName argType = JavaTypeNames.RTVALUE;
                    if (javaDefn.isArgStrict(i) && javaDefn.isArgUnboxable(i)) {
                        argType = javaDefn.getArgumentTypeName(i);
                    }
                    LocalVariable lv = new LocalVariable (javaName, JavaTypeNames.RTVALUE);
                    args[i] = lv;
View Full Code Here

         * @param javaDefn
         * @throws CodeGenerationException
         */
        private void createMethod_fUnboxedSaturatedStrict(SCJavaDefn javaDefn) throws CodeGenerationException {
            int modifiers = Modifier.PUBLIC | Modifier.FINAL;
            JavaTypeName returnType = javaDefn.getResultType();

            // Figure out the methodName
            final int arity = javaDefn.getArity();
            String methodName = functions.getFnNamePrefix(javaDefn.getFunctionName()) + "fUnboxed";
            if (arity > 0) {
View Full Code Here

                MethodInvocation mi = new MethodInvocation.Instance(SCJavaDefn.EXECUTION_CONTEXT_VAR, "incrementNMethodCalls", JavaTypeName.VOID, MethodInvocation.InvocationType.VIRTUAL);
                javaMethod.addStatement(new ExpressionStatement(mi));
            }
            if (LECCMachineConfiguration.generateCallCounts()) {
                JavaExpression args[] = new JavaExpression[2];
                JavaTypeName argTypes[] = new JavaTypeName[2];
                args[0] = LiteralWrapper.make(javaDefn.getModuleName().toSourceText());
                args[1] = LiteralWrapper.make(javaDefn.getFunctionName());
                argTypes[0] = argTypes[1] = JavaTypeName.STRING;
                MethodInvocation mi = new MethodInvocation.Instance(SCJavaDefn.EXECUTION_CONTEXT_VAR, "scCalled", args, argTypes, JavaTypeName.VOID, MethodInvocation.InvocationType.VIRTUAL);
                javaMethod.addStatement(new ExpressionStatement(mi));
View Full Code Here

            //new RTValue[]{CAL_Int.make(take$nElements$1), take$list$2}
            JavaExpression[] argValues = new JavaExpression[arity];
            for (int i = 0; i < arity; ++i) {

                String javaArgName = argNames[i];
                JavaTypeName javaArgType = argTypes[i];

                JavaExpression javaArgValue = new LocalName(javaArgName, javaArgType);
                if (!javaArgType.equals(JavaTypeNames.RTVALUE)) {
                    javaArgValue = SCJavaDefn.boxExpression(javaArgType, javaArgValue);
                }

                argValues[i] = javaArgValue;
            }
View Full Code Here

         * @throws CodeGenerationException
         */
        private JavaClassRep getStrictAppClass(MachineFunction mf) throws CodeGenerationException{

            // Get the fully-qualified superclass and class names;
            JavaTypeName superClassTypeName = JavaTypeNames.RTFULLAPP;

            // Determine whether the sc is public or package protected.
            // Construct the class access flags.
            int classModifiers = Modifier.FINAL | Modifier.PUBLIC | Modifier.STATIC;

            // No interfaces are implemented
            JavaTypeName[] interfaces = JavaDefinitionBuilder.EMPTY_TYPE_NAME_ARRAY;

            JavaTypeName strictAppTypeName = CALToJavaNames.createStrictInnerTypeNameFromSC(mf.getQualifiedName(), module);

            // Now instantiate the java class representation.
            JavaClassRep strictAppClassRep = new JavaClassRep(strictAppTypeName, superClassTypeName, classModifiers, interfaces);

            //add the function field, which is a reference to the function singleton.
View Full Code Here

         * @return the JavaClassRep for the lazy application node class
         */
        private JavaClassRep getLazyAppClass (MachineFunction mf) {

            // Get the fully-qualified superclass and class names;
            JavaTypeName superClassTypeName = JavaTypeNames.RTFULLAPP;

            // Determine whether the sc is public or package protected.
            // Construct the class access flags.
            int classModifiers = Modifier.FINAL | Modifier.PUBLIC | Modifier.STATIC;

            // No interfaces are implemented
            JavaTypeName[] interfaces = JavaDefinitionBuilder.EMPTY_TYPE_NAME_ARRAY;

            JavaTypeName lazyAppTypeName = CALToJavaNames.createLazyInnerTypeNameFromSC(mf.getQualifiedName(), module);

            // Now instantiate the java class representation.
            JavaClassRep lazyAppClassRep = new JavaClassRep(lazyAppTypeName, superClassTypeName, classModifiers, interfaces);

            //add the function field, which is a reference to the function singleton.
View Full Code Here

            for (int i = 0, nFields = memberFields.length; i < nFields; ++i) {

                JavaField javaField = memberFields[i];
                String javaFieldName = javaField.getFieldName();
                JavaTypeName javaFieldType = javaField.getFieldType();
                JavaExpression javaFieldExpr = new JavaExpression.JavaField.Instance(null, javaFieldName, javaFieldType);
                if (!javaFieldType.equals(JavaTypeNames.RTVALUE)) {
                    javaFieldExpr = SCJavaDefn.boxExpression(javaFieldType, javaFieldExpr);
                }
                switchStatement.addCase(
                    new SwitchStatement.IntCaseGroup(i, new ReturnStatement(javaFieldExpr)));
            }
View Full Code Here

     * @param module the LECCModule instance corresponding to either the module defining the entity, or one of its dependent modules.
     *               This is used for obtaining the appropriate {@link LECCModule.ClassNameMapper} for use in mapping names.
     * @return String
     */
    static String createClassNameFromSC (QualifiedName scName, LECCModule module) {
        JavaTypeName primitiveFunctionType = primitiveFunctionsMap.get(scName);
        if (primitiveFunctionType != null) {           
            return primitiveFunctionType.getUnqualifiedJavaSourceName();
        }
       
        return createClassNameFromSC(scName.getModuleName(), scName.getUnqualifiedName(), module);       
    }
View Full Code Here

     * @param module the LECCModule instance corresponding to either the module defining the entity, or one of its dependent modules.
     *               This is used for obtaining the appropriate {@link LECCModule.ClassNameMapper} for use in mapping names.
     * @return String;
     */
    static String createFullClassNameFromSC (QualifiedName scName, LECCModule module) {
        JavaTypeName primitiveFunctionType = primitiveFunctionsMap.get(scName);
        if (primitiveFunctionType != null) {
            return primitiveFunctionType.getFullJavaSourceName();
        }
        return createFullClassNameFromSC(scName.getModuleName(), scName.getUnqualifiedName(), module);
    }
View Full Code Here

TOP

Related Classes of org.openquark.cal.internal.javamodel.JavaTypeName

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.