[Webkit-unassigned] [Bug 130523] Need target to produce llvm ir

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Apr 1 14:24:13 PDT 2014


--- Comment #8 from Mark Rowe (bdash) <mrowe at apple.com>  2014-04-01 14:24:32 PST ---
(From update of attachment 228316)
View in context: https://bugs.webkit.org/attachment.cgi?id=228316&action=review

> Source/JavaScriptCore/Configurations/JavaScriptCoreRuntimeToLLVMir.xcconfig:1
> +// Copyright (C) 2009 Apple Inc. All rights reserved.


> Source/JavaScriptCore/Configurations/JavaScriptCoreRuntimeToLLVMir.xcconfig:24
> +#include "JavaScriptCore.xcconfig"

I don't think you want to pull in JavaScriptCore.xcconfig here. Targets typically #include only FeatureDefines.xcconfig and Version.xcconfig (unless they're following a common template like ToolExecutable.xcconfig).

> Source/JavaScriptCore/Configurations/JavaScriptCoreRuntimeToLLVMir.xcconfig:26

This doesn't seem relevant for this target.

> Source/JavaScriptCore/Configurations/JavaScriptCoreRuntimeToLLVMir.xcconfig:31
> +INFOPLIST_FILE = Info.plist;

Nor does this.

> Source/JavaScriptCore/Configurations/JavaScriptCoreRuntimeToLLVMir.xcconfig:37

This is already set in Base.xcconfig, which is pulled in at the project level.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:5909
> +		5540756C18DA58AD00EFF7F2 /* Headers */ = {
> +			isa = PBXHeadersBuildPhase;

I don't think this target needs a copy headers phase. We wouldn't do anything with the headers anyway.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7621
> +		5540756218DA58AD00EFF7F2 /* JavaScriptCoreRuntimeToLLVMir */ = {

I'm not a huge fan of the name of this target. "Compile runtime to LLVM IR" would be more descriptive.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7640
> +			productInstallPath = "${SYSTEM_LIBRARY_DIR}/Frameworks/WebKit.framework/Versions/A/Frameworks";

I'm not quite clear on what this specifies, but it doesn't seem right for something related to JavaScriptCore?

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7756
> +			files = (
> +				5581AC2A18EB45D200D7CBF1 /* JavaScriptCoreRuntimeToLLVMir.xcconfig in Resources */,
> +				5540756B18DA58AD00EFF7F2 /* framework.sb in Resources */,

These don't look like they're really resources of this target.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7837
> +		5536CC9518EB53A30093F8DB /* ShellScript */ = {

This script phase should have a more descriptive name.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7843
> +				"$(TARGET_TEMP_DIR)/Objects-normal/$(CURRENT_ARCH)/*.o",

Does Xcode expand wildcards in the input paths? I'm not sure whether it does or not.

Does this work when building for multiple architectures? I suspect the script phase only gets run once, meaning you'll only handle a single architecture?

Hardcoding "Objects-normal" doesn't seem great either. I think you can use something like $(OBJECT_FILE_DIR_$(CURRENT_VARIANT))/$(CURRENT_ARCH) to get the path you're after.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7850
> +			shellScript = "import os\nimport subprocess\nimport glob\nfrom operator import itemgetter\n\ndef runBash(cmd):\n    p = subprocess.Popen(cmd, shell=True, stdout=subprocess.PIPE)\n    out = p.stdout.read().strip()\n    return out  #This is the stdout from the shell command\n\ndir = os.getenv(\"TARGET_TEMP_DIR\")+\"/Objects-normal/\"+os.getenv(\"CURRENT_ARCH\")\n\nsymbol_table_loc = os.getenv(\"BUILT_PRODUCTS_DIR\")+\"/DerivedSources/JavaScriptCoreRuntime.symtbl\"\n\nsymbol_table = {}\n\nmodified = False\n\nfor f in glob.iglob(dir + \"/*.o\"):\n    if not os.path.isfile(f+\".bc\") or os.path.getmtime(f) >= os.path.getmtime(f+\".bc\"):\n        modified = True\n        print(\"ASSEMBLING: \"+f)\n        runBash(\"llvm-as \"+f)\n        print(\"APPENDING SYMBOLS\")\n        lines = runBash(\"llvm-nm --defined-only -P \"+f+\".bc\").splitlines()\n        for l in lines:\n            sym,_,ty = l.partition(\" \")\n            if ty != \"d\" and ty != \"D\":\n                name = f+\".bc\"\n                symbol_table[sym] = name\n\nif modified:\n    if os.path.isfile(symbol_table_loc):\n        with open(symbol_table_loc, 'r') as file:\n            print(\"LOADING SYMBOL TABLE\")\n            for l in iter(file.readline, ''):\n                symbol,_,loc = l[:-1].partition(\" \")\n                if not symbol in symbol_table:\n                    symbol_table[symbol] = loc\n\n    symbol_list = symbol_table.items()\n\n    print(\"WRITING SYMBOL TABLE\")\n    with open(symbol_table_loc, \"w\") as file:\n        file.writelines(map(lambda (symbol, loc): symbol + \" \" + loc + \"\\n\", symbol_list))\n    print(\"DONE\")";

This script is long enough that it should really live in a standalone file. As it is it's difficult to review.

How long does it take to run? Are the dependencies set up correctly so it won't be run when its input hasn't changed? If not and that's hard to arrange, does it at least exit quickly without doing redundant work in that scenario?

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7853
> +		5540756918DA58AD00EFF7F2 /* Update Info.plist with version information */ = {
> +			isa = PBXShellScriptBuildPhase;

This build phase doesn't seem relevant to this target.

> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:7868
> +		5540789918DA58AD00EFF7F2 /* Postprocess Headers */ = {


> Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:9116
> +			buildSettings = {
> +			};

I think you may need to set a few settings in the Debug configuration only to get the same defines as we do in JavaScriptCore proper:


Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

More information about the webkit-unassigned mailing list