LiquidVM User Guide

     Previous  Next    Open TOC in new window    View as PDF - New Window  Get Adobe Reader - New Window
Content starts here

Native Code Library Support in LiquidVM

This section discusses how to use native code libraries in LiquidVM.

 


Overview

As a best practice, BEA recommends that you deploy pure Java applications on LiquidVM, since this guarantees the maximum benefit of LiquidVM. However, this does not mean that LiquidVM cannot run native code; in fact, the JVM itself and the OS kernel below it are both native code. Native libraries can be built for LiquidVM and loaded the same way they are loaded for Java in any environment.

Moreover, it is possible to use your shared libraries that are built for Linux on LiquidVM if your library only uses the functions in Linux that LiquidVM also provides. LiquidVM’s native interface is nix-like, but it only implements the functions the JVM needs from the OS because BEA does not provide a fully POSIX-compliant function interface to LiquidVM. LiquidVM’s OS-kernel is developed entirely by BEA and is not a Linux or BSD-derivative, even though some Linux and BSD binaries can be loaded.

Caution: BEA provides no guarantees and no support for third-party native code that is trying to use functions that are not on the list of officially available functions.

 


Native Functions That Will Work with LiquidVM

The following list is an overview of the kind of native functions LiquidVM does provide. For a complete list of provided functions, see the Supported Native Code Functions in LiquidVM.

 


Native Functions That Will Not Work with LiquidVM

The following list is an overview of the native functions LiquidVM does not provide. For a complete list of provided native functions, see the Supported Native Code Functions in LiquidVM.

 


Building a Shared Library for LiquidVM

LiquidVM can load 32-bit, x86 shared libraries that follows the ELF-standard. This is the linker format typically used by Linux and BSD OSes. This means that you can compile your shared library for LiquidVM on a Linux system exactly as you would compile a normal library for this OS.

In fact, in many cases an existing shared library for Linux will work for LiquidVM too, as long as the called functions exist in LiquidVM as well.

Loading a Shared Library Inside LiquidVM

Use the following guidelines when loading a shared library inside LiquidVM:

What Happens If a Shared Library Calls Non-existent Functions?

The shared library will load as normal, but as soon as you try to call a function that does not exist in LiquidVM, the VM will display an error message and a stack-trace of the offending call, and will then shut down.

 


Supported Native Code Functions in LiquidVM

Table A-1 lists the native code functions that are supported in LiquidVM.

Table A-1 Supported Native Code Functions
Supported Native Code Functions
JNI_GetDefaultJavaVMInitArgs
JNI_CreateJavaVM
JNI_GetCreatedJavaVMs
JNI_OnLoad
JNI_OnUnload
jni->GetVersion
jni->DefineClass
jni->FindClass
jni->FromReflectedMethod
jni->FromReflectedField
jni->ToReflectedMethod
jni->GetSuperclass
jni->IsAssignableFrom
jni->ToReflectedField
jni->Throw
jni->ThrowNew
jni->ExceptionOccurred
jni->ExceptionDescribe
jni->ExceptionClear
jni->FatalError
jni->PushLocalFrame
jni->PopLocalFrame
jni->NewGlobalRef
jni->DeleteGlobalRef
jni->DeleteLocalRef
jni->IsSameObject
jni->NewLocalRef
jni->EnsureLocalCapacity
jni->AllocObject
jni->NewObject
jni->NewObjectV
jni->NewObjectA
jni->GetObjectClass
jni->IsInstanceOf
jni->GetMethodID
jni->CallObjectMethod
jni->CallObjectMethodV
jni->CallObjectMethodA
jni->CallBooleanMethod
jni->CallBooleanMethodV
jni->CallBooleanMethodA
jni->CallByteMethod
jni->CallByteMethodV
jni->CallByteMethodA
jni->CallCharMethod
jni->CallCharMethodV
jni->CallCharMethodA
jni->CallShortMethod
jni->CallShortMethodV
jni->CallShortMethodA
jni->CallIntMethod
jni->CallIntMethodV
jni->CallIntMethodA
jni->CallLongMethod
jni->CallLongMethodV
jni->CallLongMethodA
jni->CallFloatMethod
jni->CallFloatMethodV
jni->CallFloatMethodA
jni->CallDoubleMethod
jni->CallDoubleMethodV
jni->CallDoubleMethodA
jni->CallIntMethod
jni->CallIntMethodV
jni->CallIntMethodA
jni->CallLongMethod
jni->CallLongMethodV
jni->CallLongMethodA
jni->CallFloatMethod
jni->CallFloatMethodV
jni->CallFloatMethodA
jni->CallDoubleMethod
jni->CallDoubleMethodV
jni->CallDoubleMethodA
jni->CallVoidMethod
jni->CallVoidMethodV
jni->CallVoidMethodA
jni->CallNonvirtualObjectMethod
jni->CallNonvirtualObjectMethodV
jni->CallNonvirtualObjectMethodA
jni->CallNonvirtualBooleanMethod
jni->CallNonvirtualBooleanM..V
jni->CallNonvirtualBooleanM.A
jni->CallNonvirtualByteMethod
jni->CallNonvirtualByteMethodV
jni->CallNonvirtualByteMethodA
jni->CallNonvirtualCharMethod
jni->CallNonvirtualCharMethodV
jni->CallNonvirtualCharMethodA
jni->CallNonvirtualShortMethod
jni->CallNonvirtualShortMethodV
jni->CallNonvirtualShortMethodA
jni->CallNonvirtualIntMethod
jni->CallNonvirtualIntMethodV
jni->CallNonvirtualIntMethodA
jni->CallNonvirtualLongMethod
jni->CallNonvirtualLongMethodV
jni->CallNonvirtualLongMethodA
jni->CallNonvirtualFloatMethod
jni->CallNonvirtualFloatMethodV
jni->CallNonvirtualFloatMethodA
jni->CallNonvirtualDoubleMethod
jni->CallNonvirtualDoubleMethodV
jni->CallNonvirtualDoubleMethodA
jni->CallNonvirtualVoidMethod
jni->CallNonvirtualVoidMethodV
jni->CallNonvirtualVoidMethodA
jni->GetFieldID
jni->GetObjectField
jni->GetBooleanField
jni->GetByteField
jni->GetCharField
jni->GetShortField
jni->GetIntField
jni->GetLongField
jni->GetFloatField
jni->GetDoubleField
jni->SetObjectField
jni->SetBooleanField
jni->SetByteField
jni->SetCharField
jni->SetShortField
jni->SetIntField
jni->SetLongField
jni->SetFloatField
jni->SetDoubleField
jni->GetStaticMethodID
jni->CallStaticObjectMethod
jni->CallStaticObjectMethodV
jni->CallStaticObjectMethodA
jni->CallStaticBooleanMethod
jni->CallStaticBooleanMethodV
jni->CallStaticBooleanMethodA
jni->CallStaticByteMethod
jni->CallStaticByteMethodV
jni->CallStaticByteMethodA
jni->CallStaticCharMethod
jni->CallStaticCharMethodV
jni->CallStaticCharMethodA
jni->CallStaticShortMethod
jni->CallStaticShortMethodV
jni->CallStaticShortMethodA
jni->CallStaticIntMethod
jni->CallStaticIntMethodV
jni->CallStaticIntMethodA
jni->CallStaticLongMethod
jni->CallStaticLongMethodV
jni->CallStaticLongMethodA
jni->CallStaticFloatMethod
jni->CallStaticFloatMethodV
jni->CallStaticFloatMethodA
jni->CallStaticDoubleMethod
jni->CallStaticDoubleMethodV
jni->CallStaticDoubleMethodA
jni->CallStaticVoidMethod
jni->CallStaticVoidMethodV
jni->CallStaticVoidMethodA
jni->GetStaticFieldID
jni->GetStaticObjectField
jni->GetStaticBooleanField
jni->GetStaticByteField
jni->GetStaticCharField
jni->GetStaticShortField
jni->GetStaticIntField
jni->GetStaticLongField
jni->GetStaticFloatField
jni->GetStaticDoubleField
jni->SetStaticObjectField
jni->SetStaticBooleanField
jni->SetStaticByteField
jni->SetStaticCharField
jni->SetStaticShortField
jni->SetStaticIntField
jni->SetStaticLongField
jni->SetStaticFloatField
jni->SetStaticDoubleField
jni->NewString
jni->GetStringLength
jni->GetStringChars
jni->ReleaseStringChars
jni->NewStringUTF
jni->GetStringUTFLength
jni->GetStringUTFChars
jni->ReleaseStringUTFChars
jni->GetArrayLength
jni->NewObjectArray
jni->GetObjectArrayElement
jni->SetObjectArrayElement
jni->NewBooleanArray
jni->NewByteArray
jni->NewCharArray
jni->NewShortArray
jni->NewIntArray
jni->NewLongArray
jni->NewFloatArray
jni->NewDoubleArray
jni->GetBooleanArrayElements
jni->GetByteArrayElements
jni->GetCharArrayElements
jni->GetShortArrayElements
jni->GetIntArrayElements
jni->GetLongArrayElements
jni->GetFloatArrayElements
jni->GetDoubleArrayElements
jni->ReleaseBooleanArrayElements
jni->ReleaseByteArrayElements
jni->ReleaseCharArrayElements
jni->ReleaseShortArrayElements
jni->ReleaseIntArrayElements
jni->ReleaseLongArrayElements
jni->ReleaseFloatArrayElements
jni->ReleaseDoubleArrayElements
jni->GetBooleanArrayRegion
jni->GetByteArrayRegion
jni->GetCharArrayRegion
jni->GetShortArrayRegion
jni->GetIntArrayRegion
jni->GetLongArrayRegion
jni->GetFloatArrayRegion
jni->GetDoubleArrayRegion
jni->SetBooleanArrayRegion
jni->SetByteArrayRegion
jni->SetCharArrayRegion
jni->SetShortArrayRegion
jni->SetIntArrayRegion
jni->SetLongArrayRegion
jni->SetFloatArrayRegion
jni->SetDoubleArrayRegion
jni->RegisterNatives
jni->UnregisterNatives
jni->MonitorEnter
jni->MonitorExit
jni->GetJavaVM
jni->GetStringRegion
jni->GetStringUTFRegion
jni->GetPrim…ArrayCritical
jni->ReleasePrim...ArrayCritical
jni->GetStringCritical
jni->ReleaseStringCritical
jni->NewWeakGlobalRef
jni->DeleteWeakGlobalRef
jni->ExceptionCheck
jni->NewDirectByteBuffer
jni->GetDirectBufferAddress
jni->GetDirectBufferCapacity
Agent_OnLoad
Agent_OnUnload
jvmti->SetEventNotificationMode
jvmti->GetAllThreads
jvmti->SuspendThread
jvmti->ResumeThread
jvmti->StopThread
jvmti->InterruptThread
jvmti->GetThreadInfo
jvmti->GetOwnedMonitorInfo
jvmti->GetCurrentCont..Monitor
jvmti->RunAgentThread
jvmti->GetTopThreadGroups
jvmti->GetThreadGroupInfo
jvmti->GetThreadGroupChildren
jvmti->GetFrameCount
jvmti->GetThreadState
jvmti->GetFrameLocation
jvmti->NotifyFramePop
jvmti->GetLocalObject
jvmti->GetLocalInt
jvmti->GetLocalLong
jvmti->GetLocalFloat
jvmti->GetLocalDouble
jvmti->SetLocalObject
jvmti->SetLocalInt
jvmti->SetLocalLong
jvmti->SetLocalFloat
jvmti->SetLocalDouble
jvmti->CreateRawMonitor
jvmti->DestroyRawMonitor
jvmti->RawMonitorEnter
jvmti->RawMonitorExit
jvmti->RawMonitorWait
jvmti->RawMonitorNotify
jvmti->RawMonitorNotifyAll
jvmti->SetBreakpoint
jvmti->ClearBreakpoint
jvmti->SetFieldAccessWatch
jvmti->ClearFieldAccessWatch
jvmti->SetFieldModificationWatch
jvmti->ClearFieldMod…Watch
jvmti->Allocate
jvmti->Deallocate
jvmti->GetClassSignature
jvmti->GetClassStatus
jvmti->GetSourceFileName
jvmti->GetClassModifiers
jvmti->GetClassMethods
jvmti->GetClassFields
jvmti->GetImplementedInterfaces
jvmti->IsInterface
jvmti->IsArrayClass
jvmti->GetClassLoader
jvmti->GetObjectHashCode
jvmti->GetObjectMonitorUsage
jvmti->GetFieldName
jvmti->GetFieldDeclaringClass
jvmti->GetFieldModifiers
jvmti->IsFieldSynthetic
jvmti->GetMethodName
jvmti->GetMethodDeclaringClass
jvmti->GetMethodModifiers
jvmti->GetMaxLocals
jvmti->GetArgumentsSize
jvmti->GetLineNumberTable
jvmti->GetMethodLocation
jvmti->GetLocalVariableTable
jvmti->GetBytecodes
jvmti->IsMethodNative
jvmti->IsMethodSynthetic
jvmti->GetLoadedClasses
jvmti->GetClassLoaderClasses
jvmti->PopFrame
jvmti->RedefineClasses
jvmti->GetVersionNumber
jvmti->GetCapabilities
jvmti->GetSourceDebugExtension
jvmti->IsMethodObsolete
jvmti->SuspendThreadList
jvmti->ResumeThreadList
jvmti->GetAllStackTraces
jvmti->GetThreadListStackTraces
jvmti->GetThreadLocalStorage
jvmti->SetThreadLocalStorage
jvmti->GetStackTrace
jvmti->GetTag
jvmti->SetTag
jvmti->ForceGarbageCollection
jvmti->IterateOverObjectsReach..
jvmti->IterateOverReachable...
jvmti->IterateOverHeap
jvmti->IterateOverInst...
jvmti->GetObjectsWithTags
jvmti->SetJNIFunctionTable
jvmti->GetJNIFunctionTable
jvmti->SetEventCallbacks
jvmti->GenerateEvents
jvmti->GetExtensionFunctions
jvmti->GetExtensionEvents
jvmti->SetExtensionEventCallback
jvmti->DisposeEnvironment
jvmti->GetErrorName
jvmti->GetJLocationFormat
jvmti->GetSystemProperties
jvmti->GetSystemProperty
jvmti->SetSystemProperty
jvmti->GetPhase
jvmti->GetCur…ThreadCpuTimerInfo
jvmti->GetCurrentThreadCpuTime
jvmti->GetThreadCpuTimerInfo
jvmti->GetThreadCpuTime
jvmti->GetTimerInfo
jvmti->GetTime
jvmti->GetPotentialCapabilities
jvmti->AddCapabilities
jvmti->RelinquishCapabilities
jvmti->GetAvailableProcessors
jvmti->GetEnv…LocalStorage
jvmti->SetEnv..LocalStorage
jvmti->AddToBootstrapClass…
jvmti->SetVerboseFlag
jvmti->GetObjectSize
accept
access
atan
atan2
basename
bind
bsearch
calloc
ceil
close
closedir
connect
exit
exp
floor
getsockopt
gettimeofday
isinf
isnan
listen
log
lseek
malloc
memchr
memcmp
memcpy
memmove
memset
nanosleep
open
opendir
pow
pread
printf
pthread_cond_broadcast
pthread_cond_destroy
pthread_cond_init
pthread_cond_signal
pthread_cond_timedwait
pthread_cond_wait
pthread_mutex_destroy
pthread_mutex_init
pthread_mutex_lock
pthread_mutex_unlock
putc
putchar
puts
pwrite
qsort
read
readdir
realloc
realpath
recv
recvfrom
recvmsg
scalbn
sem_destroy
sem_init
sem_post
sem_wait
semdmsg
send
sendto
setsockopt
sin
sleep
snprintf
socket
sprintf
sqrt
stat
stderr
stdout
strcasecmp
strcat
strchr
strcmp
strcpy
strdup
strlen
strncasecmp
strncat
strncmp
strncpy
strnlen
strpbrk
strrchr
strstr
strtol
strtoll
strtoul
strtoull
tan
tolower
toupper
vfprint
vsnprintf
vsprintf
write
 


  Back to Top       Previous  Next