--- /dev/null
+/*
+ * Copyright (C) 2010 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.
+ */
+/*
+ * Dalvik implementation specific definitions.
+ */
+
+#ifndef _DALVIK_DEFINES_H
+#define _DALVIK_DEFINES_H
+
+#if defined(ANDROID)
+
+/* Use GCC visibility */
+#define DVM_EXPORT __attribute__((visibility("default")))
+#define DEX_EXPORT DVM_EXPORT
+
+#else
+
+#define DVM_EXPORT
+#define DEX_EXPORT
+
+#endif
+
+#endif /* ! _DALVIK_DEFINES_H */
ifneq ($(SDK_ONLY),true) # SDK_only doesn't need device version
include $(CLEAR_VARS)
+
+# Make a debugging version when building the simulator (if not told
+# otherwise) and when explicitly asked.
+dvm_make_debug_vm := false
+ifeq ($(strip $(DEBUG_DALVIK_VM)),)
+ ifeq ($(dvm_simulator),true)
+ dvm_make_debug_vm := true
+ endif
+else
+ dvm_make_debug_vm := $(DEBUG_DALVIK_VM)
+endif
+
LOCAL_SRC_FILES := $(dex_src_files)
LOCAL_C_INCLUDES += $(dex_include_files)
+LOCAL_CFLAGS += -include "dalvikdefines.h"
+ifeq ($(dvm_make_debug_vm),false)
+ # hide ELF symbols to reduce code size
+ LOCAL_CFLAGS += -fvisibility=hidden
+endif
LOCAL_MODULE := libdex
include $(BUILD_STATIC_LIBRARY)
include $(CLEAR_VARS)
LOCAL_SRC_FILES := $(dex_src_files)
LOCAL_C_INCLUDES += $(dex_include_files)
+LOCAL_CFLAGS += -include "dalvikdefines.h"
LOCAL_MODULE := libdex
include $(BUILD_HOST_STATIC_LIBRARY)
*
* Returns 0 on success, errno on failure.
*/
+DEX_EXPORT
int dexOptCreateEmptyHeader(int fd)
{
DexOptHeader optHdr;
/*
* Prepare to access a ZipArchive in an open file descriptor.
*/
+DEX_EXPORT
int dexZipPrepArchive(int fd, const char* debugFileName, ZipArchive* pArchive)
{
MemMapping map;
*
* NOTE: the ZipArchive may not have been fully created.
*/
+DEX_EXPORT
void dexZipCloseArchive(ZipArchive* pArchive)
{
LOGV("Closing archive %p\n", pArchive);
*
* Returns 0 if not found.
*/
+DEX_EXPORT
ZipEntry dexZipFindEntry(const ZipArchive* pArchive, const char* entryName)
{
int nameLen = strlen(entryName);
* Returns "false" if the offsets to the fields or the contents of the fields
* appear to be bogus.
*/
+DEX_EXPORT
bool dexZipGetEntryInfo(const ZipArchive* pArchive, ZipEntry entry,
int* pMethod, long* pUncompLen, long* pCompLen, off_t* pOffset,
long* pModWhen, long* pCrc32)
* TODO: this doesn't verify the data's CRC, but probably should (especially
* for uncompressed data).
*/
+DEX_EXPORT
bool dexZipExtractEntryToFile(const ZipArchive* pArchive,
const ZipEntry entry, int fd)
{
#
LOCAL_CFLAGS += -fstrict-aliasing -Wstrict-aliasing=2 -fno-align-jumps
#LOCAL_CFLAGS += -DUSE_INDIRECT_REF
+LOCAL_CFLAGS += -include "dalvikdefines.h"
#
# Optional features. These may impact the size or performance of the VM.
# - GDB helpers enabled
# - LOGV
# - assert()
+ # - full ELF symbols
#
LOCAL_CFLAGS += -DWITH_INSTR_CHECKS
LOCAL_CFLAGS += -DWITH_EXTRA_OBJECT_VALIDATION
# - all development features disabled
# - compiler optimizations enabled (redundant for "release" builds)
# - (debugging and profiling still enabled)
+ # - minimize ELF symbols to reduce code size by 10%
#
#LOCAL_CFLAGS += -DNDEBUG -DLOG_NDEBUG=1
# "-O2" is redundant for device (release) but useful for sim (debug)
LOCAL_CFLAGS += -DDVM_SHOW_EXCEPTION=1
# if you want to try with assertions on the device, add:
#LOCAL_CFLAGS += -UNDEBUG -DDEBUG=1 -DLOG_NDEBUG=1 -DWITH_DALVIK_ASSERT
+ # use GCC Visibility to reduce the footprint of runtime library
+ LOCAL_CFLAGS += -fvisibility=hidden
endif # !dvm_make_debug_vm
# bug hunting: checksum and verify interpreted stack when making JNI calls
*
* Returns 0 on success.
*/
+DVM_EXPORT
int dvmPrepForDexOpt(const char* bootClassPath, DexOptimizerMode dexOptMode,
DexClassVerifyMode verifyMode, int dexoptFlags)
{
/*
* Not supported.
*/
+DVM_EXPORT
jint JNI_GetDefaultJavaVMInitArgs(void* vm_args)
{
return JNI_ERR;
*
* We always have zero or one.
*/
+DVM_EXPORT
jint JNI_GetCreatedJavaVMs(JavaVM** vmBuf, jsize bufLen, jsize* nVMs)
{
if (gDvm.vmList != NULL) {
* The current thread becomes the main VM thread. We return immediately,
* which effectively means the caller is executing in a native method.
*/
+DVM_EXPORT
jint JNI_CreateJavaVM(JavaVM** p_vm, JNIEnv** p_env, void* vm_args)
{
const JavaVMInitArgs* args = (JavaVMInitArgs*) vm_args;
*
* Returns "true" on success.
*/
+DVM_EXPORT
bool dvmContinueOptimization(int fd, off_t dexOffset, long dexLength,
const char* fileName, u4 modWhen, u4 crc, bool isBootstrap)
{