Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7ea78bb0825a
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5f4dfa80783d
Choose a head ref
  • 3 commits
  • 4 files changed
  • 2 contributors

Commits on Nov 11, 2016

  1. [Truffle] Add support for Solaris/SPARC.

    Stefan Anzinger authored and eregon committed Nov 11, 2016
    Copy the full SHA
    02b501d View commit details
  2. [Truffle] Assert against null-pointer in PointerReadPointerPrimitiveN…

    …ode.
    Stefan Anzinger authored and eregon committed Nov 11, 2016
    Copy the full SHA
    7650748 View commit details
  3. [Truffle] Extract constant.

    eregon committed Nov 11, 2016
    Copy the full SHA
    5f4dfa8 View commit details
Original file line number Diff line number Diff line change
@@ -204,7 +204,9 @@ public PointerReadPointerPrimitiveNode(RubyContext context, SourceSection source

@Specialization
public DynamicObject readPointer(DynamicObject pointer) {
Pointer readPointer = Layouts.POINTER.getPointer(pointer).getPointer(0);
Pointer ptr = Layouts.POINTER.getPointer(pointer);
assert ptr.address() != 0 : "Attempt to dereference a null pointer";
Pointer readPointer = ptr.getPointer(0);

if (readPointer == null) {
readPointer = NULL_POINTER;
Original file line number Diff line number Diff line change
@@ -15,20 +15,27 @@
import org.jruby.truffle.platform.darwin.DarwinPlatform;
import org.jruby.truffle.platform.java.JavaPlatform;
import org.jruby.truffle.platform.linux.LinuxPlatform;
import org.jruby.truffle.platform.solaris.SolarisPlatform;

public abstract class NativePlatformFactory {

private static final Platform.OS_TYPE OS = Platform.getPlatform().getOS();

public static NativePlatform createPlatform(RubyContext context) {
if (!TruffleOptions.AOT &&
(context.getOptions().PLATFORM_USE_JAVA || (Platform.getPlatform().getOS() == Platform.OS_TYPE.WINDOWS))) {
(context.getOptions().PLATFORM_USE_JAVA || (OS == Platform.OS_TYPE.WINDOWS))) {
return new JavaPlatform(context);
}

if (Platform.getPlatform().getOS() == Platform.OS_TYPE.LINUX) {
if (OS == Platform.OS_TYPE.LINUX) {
return new LinuxPlatform(context);
}

if (Platform.getPlatform().getOS() == Platform.OS_TYPE.DARWIN) {
if (OS == Platform.OS_TYPE.SOLARIS) {
return new SolarisPlatform(context);
}

if (OS == Platform.OS_TYPE.DARWIN) {
return new DarwinPlatform(context);
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
/*
* Copyright (c) 2016 Oracle and/or its affiliates. All rights reserved. This
* code is released under a tri EPL/GPL/LGPL license. You can use it,
* redistribute it and/or modify it under the terms of the:
*
* Eclipse Public License version 1.0
* GNU General Public License version 2
* GNU Lesser General Public License version 2.1
*/
package org.jruby.truffle.platform.solaris;

import org.jruby.truffle.RubyContext;
import org.jruby.truffle.core.queue.ArrayBlockingQueueLocksConditions;
import org.jruby.truffle.core.queue.LinkedBlockingQueueLocksConditions;
import org.jruby.truffle.platform.DefaultRubiniusConfiguration;
import org.jruby.truffle.platform.NativePlatform;
import org.jruby.truffle.platform.ProcessName;
import org.jruby.truffle.platform.RubiniusConfiguration;
import org.jruby.truffle.platform.java.JavaProcessName;
import org.jruby.truffle.platform.openjdk.OpenJDKArrayBlockingQueueLocksConditions;
import org.jruby.truffle.platform.openjdk.OpenJDKLinkedBlockingQueueLocksConditions;
import org.jruby.truffle.platform.posix.ClockGetTime;
import org.jruby.truffle.platform.posix.JNRTrufflePosix;
import org.jruby.truffle.platform.posix.Sockets;
import org.jruby.truffle.platform.posix.TrufflePosix;
import org.jruby.truffle.platform.posix.TrufflePosixHandler;
import org.jruby.truffle.platform.signal.SignalManager;
import org.jruby.truffle.platform.sunmisc.SunMiscSignalManager;

import jnr.ffi.LibraryLoader;
import jnr.ffi.Runtime;
import jnr.ffi.provider.MemoryManager;
import jnr.posix.POSIX;
import jnr.posix.POSIXFactory;

public class SolarisPlatform implements NativePlatform {

private final TrufflePosix posix;
private final MemoryManager memoryManager;
private final SignalManager signalManager;
private final ProcessName processName;
private final Sockets sockets;
private final ClockGetTime clockGetTime;
private final RubiniusConfiguration rubiniusConfiguration;

public SolarisPlatform(RubyContext context) {
POSIX _posix = POSIXFactory.getNativePOSIX(new TrufflePosixHandler(context));
posix = new JNRTrufflePosix(_posix);
memoryManager = Runtime.getSystemRuntime().getMemoryManager();
signalManager = new SunMiscSignalManager();
processName = new JavaProcessName();
sockets = LibraryLoader.create(Sockets.class).library("c").load();
clockGetTime = LibraryLoader.create(ClockGetTime.class).library("c").library("rt").load();
rubiniusConfiguration = new RubiniusConfiguration();
DefaultRubiniusConfiguration.load(rubiniusConfiguration, context);
SolarisSparcV9RubiniusConfiguration.load(rubiniusConfiguration, context);
}

@Override
public TrufflePosix getPosix() {
return posix;
}

@Override
public MemoryManager getMemoryManager() {
return memoryManager;
}

@Override
public SignalManager getSignalManager() {
return signalManager;
}

@Override
public ProcessName getProcessName() {
return processName;
}

@Override
public Sockets getSockets() {
return sockets;
}

@Override
public ClockGetTime getClockGetTime() {
return clockGetTime;
}

@Override
public RubiniusConfiguration getRubiniusConfiguration() {
return rubiniusConfiguration;
}

@Override
public <T> ArrayBlockingQueueLocksConditions<T> createArrayBlockingQueueLocksConditions(int capacity) {
return new OpenJDKArrayBlockingQueueLocksConditions<>(capacity);
}

@Override
public <T> LinkedBlockingQueueLocksConditions<T> createLinkedBlockingQueueLocksConditions() {
return new OpenJDKLinkedBlockingQueueLocksConditions<>();
}

}
Loading