From 8af7ddce7f5977a22adce82062dc610aa6587b70 Mon Sep 17 00:00:00 2001 From: "jiseob.jang" Date: Thu, 29 Mar 2018 13:44:51 +0900 Subject: [PATCH] [NN Runtime] Add `StringPointer.cpp` to libutils This commit adds `StringPointer.cpp` to libutils. Signed-off-by: jiseob.jang --- .../android_nn/nn/depend/libutils/CMakeLists.txt | 1 + .../nn/depend/libutils/StrongPointer.cpp | 24 ++++++++++++++++++ src/runtime/ref/nn/depend/libutils/CMakeLists.txt | 1 + .../ref/nn/depend/libutils/StrongPointer.cpp | 29 ++++++++++++++++++++++ 4 files changed, 55 insertions(+) create mode 100644 experiments/android_nn/nn/depend/libutils/StrongPointer.cpp create mode 100644 src/runtime/ref/nn/depend/libutils/StrongPointer.cpp diff --git a/experiments/android_nn/nn/depend/libutils/CMakeLists.txt b/experiments/android_nn/nn/depend/libutils/CMakeLists.txt index bbfd7a3..9738939 100644 --- a/experiments/android_nn/nn/depend/libutils/CMakeLists.txt +++ b/experiments/android_nn/nn/depend/libutils/CMakeLists.txt @@ -18,6 +18,7 @@ SET(CUR_SRCS ${CMAKE_CURRENT_SOURCE_DIR}/SharedBuffer.h ${CMAKE_CURRENT_SOURCE_DIR}/String16.cpp ${CMAKE_CURRENT_SOURCE_DIR}/String8.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/StrongPointer.cpp ${CMAKE_CURRENT_SOURCE_DIR}/SystemClock.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Threads.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Timers.cpp diff --git a/experiments/android_nn/nn/depend/libutils/StrongPointer.cpp b/experiments/android_nn/nn/depend/libutils/StrongPointer.cpp new file mode 100644 index 0000000..ba52502 --- /dev/null +++ b/experiments/android_nn/nn/depend/libutils/StrongPointer.cpp @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#define LOG_TAG "sp" + +#include + +namespace android { + +void sp_report_race() { LOG_ALWAYS_FATAL("sp<> assignment detected data race"); } +} diff --git a/src/runtime/ref/nn/depend/libutils/CMakeLists.txt b/src/runtime/ref/nn/depend/libutils/CMakeLists.txt index be58082..bf11708 100644 --- a/src/runtime/ref/nn/depend/libutils/CMakeLists.txt +++ b/src/runtime/ref/nn/depend/libutils/CMakeLists.txt @@ -18,6 +18,7 @@ SET(CUR_SRCS # ${CMAKE_CURRENT_SOURCE_DIR}/SharedBuffer.h # ${CMAKE_CURRENT_SOURCE_DIR}/String16.cpp # ${CMAKE_CURRENT_SOURCE_DIR}/String8.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/StrongPointer.cpp # ${CMAKE_CURRENT_SOURCE_DIR}/SystemClock.cpp # ${CMAKE_CURRENT_SOURCE_DIR}/Threads.cpp # ${CMAKE_CURRENT_SOURCE_DIR}/Timers.cpp diff --git a/src/runtime/ref/nn/depend/libutils/StrongPointer.cpp b/src/runtime/ref/nn/depend/libutils/StrongPointer.cpp new file mode 100644 index 0000000..619a81c --- /dev/null +++ b/src/runtime/ref/nn/depend/libutils/StrongPointer.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2017 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#if 0 // REF-ANN +#define LOG_TAG "sp" + +#include +#endif // REF-ANN + +namespace android { + +void sp_report_race() { } +#if 0 // REF-ANN +void sp_report_race() { LOG_ALWAYS_FATAL("sp<> assignment detected data race"); } +#endif // REF-ANN +} -- 2.7.4