Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
BinaryFZ
committed
Aug 31, 2019
0 parents
commit f1ff21c
Showing
573 changed files
with
151,009 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
buildconfig = "//build/config/BUILDCONFIG.gn" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
group("maple") { | ||
deps = [ | ||
"${MAPLE_ROOT}/src:mapleall", | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# | ||
#Makefile for OpenArkCompiler | ||
# | ||
|
||
INSTALL_DIR := ${MAPLE_ROOT}/out | ||
BUILD_TYPE := RELEASE | ||
HOST_ARCH := 64 | ||
MIR_JAVA := 1 | ||
GN := ${MAPLE_ROOT}/tools/gn/gn | ||
NINJA := ${MAPLE_ROOT}/tools/ninja_1.9.0/ninja | ||
|
||
GN_OPTIONS := \ | ||
GN_INSTALL_PREFIX="$(MAPLE_ROOT)" \ | ||
GN_BUILD_TYPE="$(BUILD_TYPE)" \ | ||
HOST_ARCH=$(HOST_ARCH) \ | ||
MIR_JAVA=$(MIR_JAVA) | ||
|
||
.PHONY: default | ||
default: install | ||
|
||
.PHONY: mapleall | ||
mapleall: | ||
$(call build_gn, ${GN_OPTIONS}, maple) | ||
|
||
.PHONY: install | ||
install: mapleall | ||
$(shell cp -rf $(MAPLE_ROOT)/src/bin/java2jar $(MAPLE_ROOT)/out/bin/) | ||
$(shell cp -rf $(MAPLE_ROOT)/src/bin/jbc2mpl $(MAPLE_ROOT)/out/bin/) | ||
$(shell cp -rf $(MAPLE_ROOT)/src/bin/mplcg $(MAPLE_ROOT)/out/bin/) | ||
$(shell cp -rf $(MAPLE_ROOT)/out/bin/maple $(MAPLE_ROOT)/src/bin/) | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -rf out/ | ||
|
||
define build_gn | ||
mkdir -p ${INSTALL_DIR}; \ | ||
$(GN) gen ${INSTALL_DIR} --args='$(1)'; \ | ||
cd ${INSTALL_DIR}; \ | ||
$(NINJA) -v $(2); | ||
endef |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# OpenArkCompiler | ||
|
||
## 概述 | ||
----------------- | ||
> 面向多设备、支持多语言的统一编程平台。 | ||
OpenArkCompiler是来自华为方舟编译器的开源项目。 | ||
|
||
### OpenArkCompiler 四个技术特点 ### | ||
|
||
能够将不同语言代码编译成一套可执行文件,在运行环境中高效执行: | ||
- 支持多语言联合优化、消除跨语言调用开销; | ||
- 更轻量的语言运行时; | ||
- 软硬协同充分发挥硬件能效; | ||
- 支持多样化的终端设备平台 | ||
|
||
## 开源计划 | ||
**编译器框架代码开源** | ||
- 时间:2019年8月 | ||
- 开源范围:编译器IR+中端语言实现 | ||
- 开放能力: | ||
- 框架开源供参考学习,了解方舟编译器架构及框架代码 | ||
- 开发者可构建出完整编译器工具链,支持Java Sample程序编译(非应用) | ||
|
||
**后续开源范围** | ||
陆续开源编译器前端、后端、编译优化;完整支持Java程序编译、JavaScript语言应用的编译等。 | ||
|
||
**计划持续更新...** | ||
|
||
## 相关文档 | ||
|
||
- 架构设计原理 | ||
- [MAPLE IR Design](doc/MapleIRDesign.md) | ||
- [RC API](doc/RC_API.md) | ||
- [Naive RC操作插入原理](doc/Naive_RC_Insertion_Description.md) | ||
- [虚函数表和接口函数表设计介绍](doc/Vtable_Itable_Description.md) | ||
- [Phase设计介绍](doc/Compiler_Phase_Description.md) | ||
|
||
- [环境配置](doc/Development_Preparation.md) | ||
|
||
- [开发者指南](doc/Developer_Guide.md) | ||
|
||
- [编程规范](doc/Programming_Specifications.md) | ||
|
||
|
||
|
||
## 许可证 | ||
- [LICENSE](license/LICENSE) | ||
- [开源软件声明](license/Third_Party_Open_Source_Software_Notice.md) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,110 @@ | ||
# This file is the master GN build configuration, all variables | ||
# declare here will be implicitly global. | ||
|
||
# List all the input args | ||
declare_args() { | ||
GN_INSTALL_PREFIX = "" | ||
GN_BUILD_TYPE = "" | ||
HOST_ARCH = 64 | ||
MIR_JAVA = 1 | ||
} | ||
|
||
# Define global args | ||
MAPLE_ROOT = "${GN_INSTALL_PREFIX}" | ||
DYNAMICLANG = true | ||
RC_V2 = true | ||
TEST_BENCHMARK = false | ||
MEMORY_LEAK_CHECK = false | ||
MARK_CYCLE_ROOTS = false | ||
|
||
OPENSOURCE_DEPS = "${MAPLE_ROOT}/src/deplibs" | ||
OPENSOURCE_OUTPUT = "${MAPLE_ROOT}/out" | ||
MAPLEALL_ROOT = "${MAPLE_ROOT}/src" | ||
THIRD_PARTY_ROOT = "${MAPLE_ROOT}/src/third_party" | ||
|
||
# Put all built library files under lib | ||
GN_ARCHIVE_OUTPUT_DIRECTORY = "${GN_INSTALL_PREFIX}/out/lib" | ||
GN_LIBRARY_OUTPUT_DIRECTORY = "${GN_INSTALL_PREFIX}/out/lib" | ||
|
||
# Put all built binary files under bin | ||
GN_BINARY_OUTPUT_DIRECTORY = "${GN_INSTALL_PREFIX}/out/bin" | ||
|
||
# Toolchain setup | ||
GN_C_COMPILER = "${MAPLE_ROOT}/tools/clang_llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang" | ||
GN_CXX_COMPILER = "${MAPLE_ROOT}/tools/clang_llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/clang++" | ||
GN_AR_COMPILER = "${MAPLE_ROOT}/tools/clang_llvm-8.0.0-x86_64-linux-gnu-ubuntu-16.04/bin/llvm-ar" | ||
target_toolchain = "//build/toolchain:clang" | ||
set_default_toolchain(target_toolchain) | ||
|
||
# Cross compile | ||
GN_C_CROSS_COMPILER = "/usr/bin/aarch64-linux-gnu-gcc-5" | ||
GN_CXX_CROSS_COMPILER = "/usr/bin/aarch64-linux-gnu-g++-5" | ||
GN_AR_CROSS_COMPILER = "/usr/bin/aarch64-linux-gnu-ar" | ||
GN_RANLIB_CROSS_COMPILER = "/usr/bin/aarch64-linux-gnu-ranlib" | ||
|
||
# C/CXX Build flags | ||
cflags = [] | ||
if (GN_BUILD_TYPE == "RELEASE") { | ||
cflags_cc = [ "-O3" ] | ||
cflags_c = [ "-O3" ] | ||
} else if (GN_BUILD_TYPE == "DEBUG") { | ||
cflags_cc = [ | ||
"-O0", | ||
"-g3", | ||
] | ||
cflags_c = [ | ||
"-O0", | ||
"-g3", | ||
] | ||
} | ||
|
||
cflags_c += [ | ||
"-Wall", | ||
"-fstack-protector-strong", | ||
"-fPIC", | ||
"-fPIE", | ||
] | ||
cflags_cc += [ | ||
"-Wall", | ||
"-fstack-protector-strong", | ||
"-fPIC", | ||
"-fPIE", | ||
] | ||
|
||
if (HOST_ARCH == 64) { | ||
cflags_c += [ "-m64" ] | ||
cflags_cc += [ "-m64" ] | ||
} else { | ||
cflags_c += [ "-m32" ] | ||
cflags_cc += [ "-m32" ] | ||
} | ||
|
||
if (DYNAMICLANG) { | ||
cflags_cc += [ "-DDYNAMICLANG" ] | ||
} | ||
|
||
if (RC_V2) { | ||
cflags_cc += [ "-DRC_NO_MMAP" ] | ||
} | ||
|
||
if (TEST_BENCHMARK) { | ||
cflags_cc += [ "-DTEST_BENCHMARK" ] | ||
} | ||
|
||
if (MEMORY_LEAK_CHECK) { | ||
cflags_cc += [ "-DMEMORY_LEAK_CHECK" ] | ||
} | ||
|
||
if (MARK_CYCLE_ROOTS) { | ||
cflags_cc += [ "-DMARK_CYCLE_ROOTS" ] | ||
} | ||
|
||
cflags_cc += [ "-DMIR_FEATURE_FULL=1" ] | ||
|
||
if (MIR_JAVA == 1) { | ||
TARGET = "aarch64" | ||
cflags_cc += [ "-DMIR_JAVA=1" ] | ||
} else { | ||
TARGET = "vm" | ||
cflags_cc += [ "-DMIR_JAVA=0" ] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$(APP_JAR): %.jar : %.java | ||
$(JAVA2JAR) $(APP_JAR) ${MAPLE_ROOT}/libjava-core/java-core.jar "$(wildcard *.java)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
$(APP_MPL): %.mpl : %.jar $(JBC2MPL_BIN) | ||
$(JBC2MPL_BIN) --mplt $(LIB_MPLT) -injar $(APP_JAR) -out $(APP) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
include $(MAPLE_BUILD_CORE)/maple_variables.mk | ||
|
||
test: $(APP_S) | ||
include $(MAPLE_BUILD_CORE)/mplcomb.mk | ||
include $(MAPLE_BUILD_CORE)/jbc2mpl.mk | ||
include $(MAPLE_BUILD_CORE)/java2jar.mk | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -rf *.jar | ||
@rm -f *.class | ||
@rm -f *.mpl | ||
@rm -f *.mplt | ||
@rm -f *.s | ||
@rm -f *.groots.txt | ||
@rm -f *.primordials.txt | ||
@rm -rf comb.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
TARGETS := $(APP) | ||
LIB_MPLT := $(MAPLE_ROOT)/libjava-core/libjava-core.mplt | ||
APP_CLASS := $(foreach APP, $(TARGETS), $(APP).class) | ||
APP_JAR := $(foreach APP, $(TARGETS), $(APP).jar) | ||
APP_MPL := $(foreach APP, $(TARGETS), $(APP).mpl) | ||
APP_MPLT:=$(foreach APP, $(TARGETS), $(APP).mplt) | ||
APP_VTABLEIMPL_MPL := $(foreach APP, $(TARGETS), $(APP).VtableImpl.mpl) | ||
APP_S := $(foreach APP, $(TARGETS), $(APP).VtableImpl.s) | ||
|
||
JAVA2JAR := $(MAPLE_ROOT)/out/bin/java2jar | ||
JBC2MPL_BIN := $(MAPLE_ROOT)/out/bin/jbc2mpl | ||
MAPLE_BIN := $(MAPLE_ROOT)/out/bin/maple | ||
MPLCG_BIN := $(MAPLE_ROOT)/out/bin/mplcg | ||
MPLME_FLAGS := --quiet | ||
MPL2MPL_FLAGS := --quiet --regnativefunc --maplelinker | ||
MPLCG_SO_FLAGS := --fpic | ||
MPLCG_FLAGS := --quiet --no-pie --verbose-asm --maplelinker | ||
MPLCOMBO_FLAGS := --run=me:mpl2mpl:mplcg --option="$(MPLME_FLAGS):$(MPL2MPL_FLAGS):$(MPLCG_FLAGS) $(MPLCG_SO_FLAGS)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
$(APP_S): %.VtableImpl.s : %.mpl $(MAPLE_BIN) $(MPLCG_BIN) | ||
$(MAPLE_BIN) --infile $< $(MPLCOMBO_FLAGS) --save-temps | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
|
||
curdir=`pwd` | ||
unset MAPLE_ROOT | ||
export MAPLE_ROOT=${curdir} | ||
unset MAPLE_BUILD_CORE | ||
export MAPLE_BUILD_CORE=${MAPLE_ROOT}/build/core | ||
export PATH=$PATH:${MAPLE_ROOT}/src/bin |
Oops, something went wrong.