Skip to content
Snippets Groups Projects
Commit f141a124 authored by Lukas Stadler's avatar Lukas Stadler
Browse files

make JNR RFFI compilation final

parent e7a61c0a
Branches
No related tags found
No related merge requests found
......@@ -22,6 +22,8 @@
*/
package com.oracle.truffle.r.runtime.ffi.jnr;
import com.oracle.truffle.api.CompilerDirectives;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.r.runtime.RPlatform;
import com.oracle.truffle.r.runtime.context.RContext;
import com.oracle.truffle.r.runtime.context.RContext.ContextState;
......@@ -90,111 +92,122 @@ public class JNR_RFFIFactory extends RFFIFactory implements RFFI {
return this;
}
private BaseRFFI baseRFFI;
@CompilationFinal private BaseRFFI baseRFFI;
@Override
public BaseRFFI getBaseRFFI() {
if (baseRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
baseRFFI = new JNR_Base();
}
return baseRFFI;
}
private LapackRFFI lapackRFFI;
@CompilationFinal private LapackRFFI lapackRFFI;
@Override
public LapackRFFI getLapackRFFI() {
if (lapackRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
lapackRFFI = new JNR_Lapack();
}
return lapackRFFI;
}
private RApplRFFI rApplRFFI;
@CompilationFinal private RApplRFFI rApplRFFI;
@Override
public RApplRFFI getRApplRFFI() {
if (rApplRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
rApplRFFI = new JNR_RAppl();
}
return rApplRFFI;
}
private StatsRFFI statsRFFI;
@CompilationFinal private StatsRFFI statsRFFI;
@Override
public StatsRFFI getStatsRFFI() {
if (statsRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
statsRFFI = new JNR_Stats();
}
return statsRFFI;
}
private ToolsRFFI toolsRFFI;
@CompilationFinal private ToolsRFFI toolsRFFI;
@Override
public ToolsRFFI getToolsRFFI() {
if (toolsRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
toolsRFFI = new Generic_Tools();
}
return toolsRFFI;
}
private GridRFFI gridRFFI;
@CompilationFinal private GridRFFI gridRFFI;
@Override
public GridRFFI getGridRFFI() {
if (gridRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
gridRFFI = new Generic_Grid();
}
return gridRFFI;
}
private UserRngRFFI userRngRFFI;
@CompilationFinal private UserRngRFFI userRngRFFI;
@Override
public UserRngRFFI getUserRngRFFI() {
if (userRngRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
userRngRFFI = new JNR_UserRng();
}
return userRngRFFI;
}
private CRFFI cRFFI;
@CompilationFinal private CRFFI cRFFI;
@Override
public CRFFI getCRFFI() {
if (cRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
cRFFI = new CRFFI_JNR_Invoke();
}
return cRFFI;
}
private CallRFFI callRFFI;
@CompilationFinal private CallRFFI callRFFI;
@Override
public CallRFFI getCallRFFI() {
if (callRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
callRFFI = new JNI_CallRFFI();
}
return callRFFI;
}
private ZipRFFI zipRFFI;
@CompilationFinal private ZipRFFI zipRFFI;
@Override
public ZipRFFI getZipRFFI() {
if (zipRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
zipRFFI = new JNR_Zip();
}
return zipRFFI;
}
private PCRERFFI pcreRFFI;
@CompilationFinal private PCRERFFI pcreRFFI;
@Override
public PCRERFFI getPCRERFFI() {
if (pcreRFFI == null) {
CompilerDirectives.transferToInterpreterAndInvalidate();
pcreRFFI = new JNR_PCRE();
}
return pcreRFFI;
......
......@@ -22,6 +22,7 @@
*/
package com.oracle.truffle.r.runtime.ffi;
import com.oracle.truffle.api.CompilerDirectives.CompilationFinal;
import com.oracle.truffle.r.runtime.Utils;
import com.oracle.truffle.r.runtime.context.RContext;
import com.oracle.truffle.r.runtime.context.RContext.ContextState;
......@@ -36,7 +37,7 @@ import com.oracle.truffle.r.runtime.context.RContext.ContextState;
*/
public abstract class RFFIFactory {
protected static RFFI theRFFI;
@CompilationFinal protected static RFFI theRFFI;
public static void setRFFIFactory(RFFIFactory factory) {
RFFIContextStateFactory.registerFactory(factory);
......@@ -52,7 +53,7 @@ public abstract class RFFIFactory {
* Initialize the factory instance. This method will be called immediately after the factory
* instance is created allowing any additional initialization that could not be done in the
* constructor.
*
*
* @param runtime {@code true} if the initialization is being done at runtime. An AOT system may
* call this twice, once with {@code false} whern an image is being bilt and once
* when starting up.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment