diff --git a/AppKit/Jakefile b/AppKit/Jakefile index 69f958e4c..b08853fda 100644 --- a/AppKit/Jakefile +++ b/AppKit/Jakefile @@ -33,8 +33,9 @@ appKitTask = framework ("AppKit", function(appKitTask) return "--include \"" + aFilename + "\""; }).join(" "); - if ($CONFIGURATION === "Release") - appKitTask.setCompilerFlags("-O " + INCLUDES); + if ($CONFIGURATION === "Release") { + appKitTask.setCompilerFlags(($INLINE_MSG_SEND ? "-O2 " : "-O ") + INCLUDES); + } else appKitTask.setCompilerFlags("-DDEBUG -g " + INCLUDES); }); diff --git a/AppKit/Themes/BlendKit/Jakefile b/AppKit/Themes/BlendKit/Jakefile index da9439c09..f8797ec56 100644 --- a/AppKit/Themes/BlendKit/Jakefile +++ b/AppKit/Themes/BlendKit/Jakefile @@ -20,7 +20,7 @@ blendKitTask = framework ("BlendKit", function(blendKitTask) blendKitTask.setFlattensSources(true); // FIXME: how do we non flatten? if ($CONFIGURATION === "Release") - blendKitTask.setCompilerFlags("-O"); + blendKitTask.setCompilerFlags($INLINE_MSG_SEND ? "-O2" : "-O"); else blendKitTask.setCompilerFlags("-DDEBUG -g"); }); diff --git a/Foundation/Jakefile b/Foundation/Jakefile index 20d218c9e..e180f19b0 100644 --- a/Foundation/Jakefile +++ b/Foundation/Jakefile @@ -51,7 +51,7 @@ foundationTask = framework ("Foundation", function(foundationTask) INCLUDES = "--include \"../AppKit/Platform/Platform.h\" " + INCLUDES; if ($CONFIGURATION === "Release") - foundationTask.setCompilerFlags("-O " + INCLUDES); + foundationTask.setCompilerFlags(($INLINE_MSG_SEND ? "-O2 " : "-O ") + INCLUDES); else foundationTask.setCompilerFlags("-DDEBUG -g " + INCLUDES); }); diff --git a/Jakefile b/Jakefile index 9bbc5ff57..107458477 100644 --- a/Jakefile +++ b/Jakefile @@ -21,7 +21,7 @@ var subprojects = ["Objective-J", "CommonJS", "Foundation", "AppKit", "Tools"]; $BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS = FILE.join($BUILD_CJS_OBJECTIVE_J, "Frameworks", "Debug"); -filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function() +filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, [], function() { FILE.mkdirs($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS); @@ -30,7 +30,7 @@ filedir ($BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, ["debug", "release"], function $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS = FILE.join($BUILD_CJS_CAPPUCCINO, "Frameworks", "Debug"); -filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function() +filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, [], function() { FILE.mkdirs($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS); @@ -39,7 +39,9 @@ filedir ($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, ["debug", "release"], function( cp_r(FILE.join($BUILD_DIR, "Debug", "BlendKit"), FILE.join($BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "BlendKit")); }); -task ("CommonJS", [$BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"]); +task ("CommonJS", ["debug", "release", $BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release"]); + +task ("CommonJS-inline", ["debug", "release-inline", $BUILD_CJS_OBJECTIVE_J_DEBUG_FRAMEWORKS, $BUILD_CJS_CAPPUCCINO_DEBUG_FRAMEWORKS, "debug", "release-inline"]); task ("install", ["CommonJS"], function() { @@ -47,6 +49,12 @@ task ("install", ["CommonJS"], function() installCopy($BUILD_CJS_CAPPUCCINO, false); }); +task ("install-inline", ["CommonJS-inline"], function() +{ + installCopy($BUILD_CJS_OBJECTIVE_J, false); + installCopy($BUILD_CJS_CAPPUCCINO, false); +}); + task ("sudo-install", ["CommonJS"], function() { installCopy($BUILD_CJS_OBJECTIVE_J, true); diff --git a/Objective-J/CFHTTPRequest.js b/Objective-J/CFHTTPRequest.js index eff9a49df..a961cc67b 100644 --- a/Objective-J/CFHTTPRequest.js +++ b/Objective-J/CFHTTPRequest.js @@ -351,7 +351,7 @@ function FileRequest(/*CFURL*/ aURL, onsuccess, onfailure, onprogress) { var aFilePath = aURL.toString().substring(5), OS = require("os"), - gccFlags = require("objective-j").currentCompilerFlags(), + gccFlags = require("objective-j").currentGccCompilerFlags(), chunk, fileContents = ""; diff --git a/Objective-J/CommonJS/lib/objective-j/compiler.js b/Objective-J/CommonJS/lib/objective-j/compiler.js index 34416cde0..6f7f91972 100644 --- a/Objective-J/CommonJS/lib/objective-j/compiler.js +++ b/Objective-J/CommonJS/lib/objective-j/compiler.js @@ -192,8 +192,12 @@ function resolveFlags(args) else if (argument.indexOf("-g") === 0) objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols; - else if (argument.indexOf("-O") === 0) + else if (argument.indexOf("-O") === 0) { objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.Compress; + // FIXME: currently we are sending in '-O2' when we want InlineMsgSend. Here we only check if we it is '-O...' + if (argument.length > 2) + objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.InlineMsgSend; + } else if (argument.indexOf("-G") === 0) objjcFlags |= ObjectiveJ.ObjJAcornCompiler.Flags.Generate; diff --git a/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js b/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js index e71b9129f..613d9b254 100644 --- a/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js +++ b/Objective-J/CommonJS/lib/objective-j/jake/bundletask.js @@ -907,7 +907,7 @@ BundleTask.prototype.defineSourceTasks = function() basePath = absolutePath.substring(0, absolutePath.length - theTranslatedFilename.length); // Here we set the current compiler flags so the load system will know what compiler flags to use - ObjectiveJ.setCurrentCompilerFlags(environmentCompilerFlags); + ObjectiveJ.setCurrentGccCompilerFlags(environmentCompilerFlags); // Here we tell the CFBundle to load frameworks for the current build enviroment and not the enviroment that is running CFBundle.environments = function() {return [anEnvironment.name(), "ObjJ"]}; ObjectiveJ.make_narwhal_factory(absolutePath, basePath, translateFilenameToPath)(require, e, module, system, print); diff --git a/Objective-J/FileExecutable.js b/Objective-J/FileExecutable.js index 8e9bcac7a..a3b471a7e 100644 --- a/Objective-J/FileExecutable.js +++ b/Objective-J/FileExecutable.js @@ -41,7 +41,7 @@ function FileExecutable(/*CFURL|String*/ aURL, /*Dictionary*/ aFilenameTranslate if (fileContents.match(/^@STATIC;/)) executable = decompile(fileContents, aURL); else if ((extension === "j" || !extension) && !fileContents.match(/^{/)) - executable = exports.ObjJAcornCompiler.compileFileDependencies(fileContents, aURL, ObjJAcornCompiler.Flags.IncludeDebugSymbols); + executable = exports.ObjJAcornCompiler.compileFileDependencies(fileContents, aURL, exports.currentCompilerFlags()); else executable = new Executable(fileContents, [], aURL); diff --git a/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j b/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j index fcd96ba3c..5b5ffa070 100644 --- a/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j +++ b/Tests/Objective-J/Preprocessor/OutputTests/OutputTest.j @@ -49,7 +49,7 @@ var FILENAMES = [ correct = FILE.read(FILE.join(FILE.dirname(module.path), filename + ".js")); [self assertNoThrow:function() { - preprocessed = ObjectiveJ.ObjJAcornCompiler.compileToExecutable(unpreprocessed).code(); + preprocessed = ObjectiveJ.ObjJAcornCompiler.compileToExecutable(unpreprocessed, nil, ObjectiveJ.ObjJAcornCompiler.Flags.IncludeDebugSymbols/* | ObjectiveJ.ObjJAcornCompiler.Flags.IncludeTypeSignatures*/).code(); preprocessed = compressor.compress(preprocessed, { charset : "UTF-8", useServer : true }); correct = compressor.compress(correct, { charset : "UTF-8", useServer : true }); }]; diff --git a/Tools/capp/Resources/Templates/Application/Jakefile b/Tools/capp/Resources/Templates/Application/Jakefile index 08a8c0c8b..a25464947 100644 --- a/Tools/capp/Resources/Templates/Application/Jakefile +++ b/Tools/capp/Resources/Templates/Application/Jakefile @@ -40,7 +40,7 @@ app (projectName, function(task) if (configuration === "Debug") task.setCompilerFlags("-DDEBUG -g"); else - task.setCompilerFlags("-O"); + task.setCompilerFlags("-O2"); }); task ("default", [projectName], function() diff --git a/Tools/capp/Resources/Templates/Application/index-debug.html b/Tools/capp/Resources/Templates/Application/index-debug.html index d862fd07e..96a9a1106 100644 --- a/Tools/capp/Resources/Templates/Application/index-debug.html +++ b/Tools/capp/Resources/Templates/Application/index-debug.html @@ -61,6 +61,11 @@