Skip to content
  • Ivo Anjo's avatar
    Make javartm usage safe on non-rtm cpus · 127555c6
    Ivo Anjo authored
    One of the use cases of javartm is that any app may use it, and use the Transaction.RTM_AVAILABLE
    flag to trigger execution with javartm, or to decide how to fallback onto something else.
    
    Nevertheless, if the application ignored the RTM_AVAILABLE flag and mistakenly invoked the javartm
    functions, it would result in a VM segfault.
    
    To avoid this, the native code part of javartm has been split into three libraries. The first is
    libtestrtmsupport.so, that only includes the code that checks for rtm usage.
    After checking for rtm support, the code decides if either libjavartm-dummy.so or libjavartm.so
    are loaded; libjavartm-dummy.so just includes dummy implementations of the native code functions
    that throw exceptions whenever they are used.
    
    This way, older machines can never trigger the execution of rtm instructions on older machines,
    making javartm usage safe.
    127555c6