Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -43,9 +43,11 @@
import com.oracle.truffle.api.frame.VirtualFrame;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;

import jnr.constants.platform.Errno;
import jnr.constants.platform.Fcntl;
import jnr.ffi.Pointer;

import org.jruby.truffle.nodes.RubyGuards;
import org.jruby.truffle.nodes.dispatch.CallDispatchHeadNode;
import org.jruby.truffle.nodes.dispatch.DispatchHeadNodeFactory;
@@ -511,6 +513,7 @@ public AcceptNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@SuppressWarnings("restriction")
@TruffleBoundary
@Specialization
public int accept(DynamicObject io) {
Original file line number Diff line number Diff line change
@@ -15,7 +15,9 @@
import com.oracle.truffle.api.dsl.Specialization;
import com.oracle.truffle.api.object.DynamicObject;
import com.oracle.truffle.api.source.SourceSection;

import jnr.ffi.Pointer;

import org.jcodings.specific.UTF8Encoding;
import org.jruby.RubyString;
import org.jruby.truffle.nodes.core.PointerGuards;
@@ -60,6 +62,7 @@ public DynamicObject malloc(DynamicObject pointerClass, int size) {
return malloc(pointerClass, (long) size);
}

@SuppressWarnings("restriction")
@Specialization
public DynamicObject malloc(DynamicObject pointerClass, long size) {
return PointerNodes.createPointer(pointerClass, getMemoryManager().newPointer(UnsafeHolder.U.allocateMemory(size)));
@@ -74,6 +77,7 @@ public PointerFreePrimitiveNode(RubyContext context, SourceSection sourceSection
super(context, sourceSection);
}

@SuppressWarnings("restriction")
@Specialization
public DynamicObject free(DynamicObject pointer) {
UnsafeHolder.U.freeMemory(Layouts.POINTER.getPointer(pointer).address());

0 comments on commit 024d2c5

Please sign in to comment.