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: dfa380c920fb
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 74ef8bfb5090
Choose a head ref

Commits on Jul 24, 2016

  1. Copy the full SHA
    9e15f92 View commit details
  2. Copy the full SHA
    af270e0 View commit details
  3. [Truffle] rb_sym2str

    chrisseaton committed Jul 24, 2016
    Copy the full SHA
    6461017 View commit details
  4. [Truffle] RSTRING_GETMEM

    chrisseaton committed Jul 24, 2016
    Copy the full SHA
    9486caa View commit details
  5. [Truffle] UNREACHABLE

    chrisseaton committed Jul 24, 2016
    Copy the full SHA
    8c9873a View commit details
  6. [Truffle] rb_eNotImpError

    chrisseaton committed Jul 24, 2016
    3
    Copy the full SHA
    774537f View commit details
  7. Copy the full SHA
    2d4cdd6 View commit details
  8. Copy the full SHA
    718e22c View commit details
  9. Copy the full SHA
    147bfe6 View commit details
  10. Copy the full SHA
    54284b3 View commit details
  11. Copy the full SHA
    23dad3f View commit details
  12. Copy the full SHA
    271694c View commit details

Commits on Jul 25, 2016

  1. [Truffe] Figured out how to work around the _ thing in function point…

    …er types - but where was it coming from in MRI?
    chrisseaton committed Jul 25, 2016
    2
    Copy the full SHA
    30d4c34 View commit details
  2. [Truffle] ULONG2NUM

    chrisseaton committed Jul 25, 2016
    Copy the full SHA
    7857971 View commit details
  3. Copy the full SHA
    0bd1bd6 View commit details
  4. [Truffle] rb_obj_dup

    chrisseaton committed Jul 25, 2016
    Copy the full SHA
    202b205 View commit details
  5. Copy the full SHA
    26d25c8 View commit details
  6. [Truffle] NUM2ULONG

    chrisseaton committed Jul 25, 2016
    Copy the full SHA
    166c30c View commit details
  7. [Truffle] NUM2DBL

    chrisseaton committed Jul 25, 2016
    Copy the full SHA
    bfae26e View commit details
  8. [Truffle] rb_obj_freeze

    chrisseaton committed Jul 25, 2016
    1
    Copy the full SHA
    f4dfc2e View commit details
  9. Copy the full SHA
    7d9c245 View commit details
  10. [Truffle] Qundef

    chrisseaton committed Jul 25, 2016
    Copy the full SHA
    d75e809 View commit details
  11. [Truffle] rb_str_split

    chrisseaton committed Jul 25, 2016
    Copy the full SHA
    be593ef View commit details
  12. Copy the full SHA
    74ef8bf View commit details
71 changes: 57 additions & 14 deletions lib/ruby/truffle/cext/ruby.h
Original file line number Diff line number Diff line change
@@ -47,22 +47,26 @@ extern "C" {
// Macros

#define NORETURN(X) __attribute__((__noreturn__)) X
#define UNREACHABLE ((void)0)
#define _(x) x

// Basic types

typedef void *ID;
typedef void *VALUE;
typedef uint64_t VALUE;
typedef VALUE ID;

// Helpers

NORETURN(VALUE rb_f_notimplement(int args_count, const VALUE *args, VALUE object));

// Memory

#define xmalloc malloc
#define xfree free
#define xmalloc malloc
#define xfree free
#define ruby_xfree free

#define ALLOC_N(type, n) malloc(sizeof(type) * n)
#define ALLOC_N(type, n) ((type *)malloc(sizeof(type) * (n)))
#define ALLOCA_N(type, n) ((type *)alloca(sizeof(type) * (n)))

void *rb_alloc_tmp_buffer(volatile VALUE *buffer_pointer, long length);
void *rb_alloc_tmp_buffer2(volatile VALUE *buffer_pointer, long count, size_t size);
@@ -147,21 +151,25 @@ bool RB_TYPE_P(VALUE value, int type);
void rb_check_type(VALUE value, int type);
#define Check_Type(v,t) rb_check_type((VALUE)(v), (t))

VALUE rb_obj_is_instance_of(VALUE object, VALUE ruby_class);
VALUE rb_obj_is_kind_of(VALUE object, VALUE ruby_class);

void rb_check_frozen(VALUE object);
void rb_check_safe_obj(VALUE object);

bool SYMBOL_P(VALUE value);

// Constants

VALUE rb_jt_Qfalse(void);
VALUE rb_jt_Qtrue(void);
VALUE rb_jt_Qnil(void);
VALUE rb_jt_get_Qundef(void);
VALUE rb_jt_get_Qfalse(void);
VALUE rb_jt_get_Qtrue(void);
VALUE rb_jt_get_Qnil(void);

#define Qfalse rb_jt_Qfalse()
#define Qtrue rb_jt_Qtrue()
#define Qnil rb_jt_Qnil()
#define Qundef rb_jt_get_Qundef()
#define Qfalse rb_jt_get_Qfalse()
#define Qtrue rb_jt_get_Qtrue()
#define Qnil rb_jt_get_Qnil()

VALUE rb_jt_get_cObject(void);
VALUE rb_jt_get_cArray(void);
@@ -170,6 +178,8 @@ VALUE rb_jt_get_mKernel(void);
VALUE rb_jt_get_cProc(void);
VALUE rb_jt_get_cTime(void);
VALUE rb_jt_get_mEnumerable(void);
VALUE rb_jt_get_mWaitReadable(void);
VALUE rb_jt_get_mWaitWritable(void);

#define rb_cObject rb_jt_get_cObject()
#define rb_cArray rb_jt_get_cArray()
@@ -178,6 +188,8 @@ VALUE rb_jt_get_mEnumerable(void);
#define rb_cProc rb_jt_get_cProc()
#define rb_cTime rb_jt_get_cTime()
#define rb_mEnumerable rb_jt_get_mEnumerable()
#define rb_mWaitReadable rb_jt_get_mWaitReadable()
#define rb_mWaitWritable rb_jt_get_mWaitWritable()

VALUE rb_jt_get_eException(void);
VALUE rb_jt_get_eRuntimeError(void);
@@ -186,6 +198,7 @@ VALUE rb_jt_get_eNoMemError(void);
VALUE rb_jt_get_eTypeError(void);
VALUE rb_jt_get_eArgError(void);
VALUE rb_jt_get_eRangeError(void);
VALUE rb_jt_get_eNotImpError(void);

#define rb_eException rb_jt_get_eException()
#define rb_eRuntimeError rb_jt_get_eRuntimeError()
@@ -194,6 +207,7 @@ VALUE rb_jt_get_eRangeError(void);
#define rb_eTypeError rb_jt_get_eTypeError()
#define rb_eArgError rb_jt_get_eArgError()
#define rb_eRangeError rb_jt_get_eRangeError()
#define rb_eNotImpError rb_jt_get_eNotImpError()

// Conversions

@@ -202,6 +216,8 @@ VALUE CHR2FIX(char ch);
int NUM2INT(VALUE value);
unsigned int NUM2UINT(VALUE value);
long NUM2LONG(VALUE value);
unsigned long NUM2ULONG(VALUE value);
double NUM2DBL(VALUE value);

int FIX2INT(VALUE value);
unsigned int FIX2UINT(VALUE value);
@@ -212,6 +228,7 @@ VALUE INT2FIX(long value);
VALUE UINT2NUM(unsigned int value);

VALUE LONG2NUM(long value);
VALUE ULONG2NUM(long value);
VALUE LONG2FIX(long value);

int rb_fix2int(VALUE value);
@@ -237,6 +254,11 @@ int RTEST(VALUE value);

VALUE rb_require(const char *feature);

// Object

VALUE rb_obj_dup(VALUE object);
VALUE rb_obj_freeze(VALUE object);

// Integer

VALUE rb_Integer(VALUE value);
@@ -306,12 +328,15 @@ VALUE rb_str_new_frozen(VALUE value);
#define rb_str_new4(value) rb_str_new_frozen(value)
VALUE rb_String(VALUE value);
VALUE rb_str_resize(VALUE string, long length);
#define RSTRING_GETMEM(string, data_pointer, length_pointer) ((data_pointer) = RSTRING_PTR(string), (length_pointer) = rb_str_len(string))
VALUE rb_str_split(VALUE string, const char *split);

// Symbol

ID rb_intern(const char *string);
ID rb_intern2(const char *string, long length);
#define rb_intern_const(str) rb_intern2((str), strlen(str))
VALUE rb_sym2str(VALUE string);

// Array

@@ -375,7 +400,7 @@ int rb_scan_args(int argc, VALUE *argv, const char *format, ...);

int rb_respond_to(VALUE object, ID name);

#define rb_funcall(object, name, ...) truffle_invoke(RUBY_CEXT, "rb_funcall", object, name, __VA_ARGS__)
#define rb_funcall(object, name, ...) truffle_invoke(RUBY_CEXT, "rb_funcall", (void *)object, name, __VA_ARGS__)
VALUE rb_funcallv(VALUE object, ID name, int args_count, const VALUE *args);
VALUE rb_funcallv_public(VALUE object, ID name, int args_count, const VALUE *args);
#define rb_funcall2 rb_funcallv
@@ -509,6 +534,13 @@ VALUE rb_gc_disable();

// Threads

typedef void *(*gvl_call)(void *);
typedef void rb_unblock_function_t(void *);

void *rb_thread_call_with_gvl(gvl_call function, void *data1);
void *rb_thread_call_without_gvl(gvl_call function, void *data1, rb_unblock_function_t *unblock_function, void *data2);
void *rb_thread_call_without_gvl2(gvl_call function, void *data1, rb_unblock_function_t *unblock_function, void *data2);

typedef void *rb_nativethread_id_t;
typedef void *rb_nativethread_lock_t;

@@ -530,14 +562,15 @@ void rb_io_check_writable(rb_io_t *io);
void rb_io_check_readable(rb_io_t *io);

int rb_cloexec_dup(int oldfd);
void rb_fd_fix_cloexec(int fd);

int rb_jt_io_handle(VALUE file);

#define GetOpenFile(file, pointer) ((pointer)->fd = rb_jt_io_handle(file))

// Data

void* DATA_PTR(VALUE value);
#define DATA_PTR(value) *((volatile int*) 0)

// Typed data

@@ -553,7 +586,7 @@ struct rb_data_type_struct {
} function;
const rb_data_type_t *parent;
void *data;
int flags;
VALUE flags;
};

#define RUBY_TYPED_FREE_IMMEDIATELY 1
@@ -562,6 +595,16 @@ VALUE rb_data_typed_object_wrap(VALUE ruby_class, void *data, const rb_data_type

#define TypedData_Wrap_Struct(ruby_class, data_type, data) rb_data_typed_object_wrap((ruby_class), (data), (data_type))

VALUE rb_data_typed_object_zalloc(VALUE ruby_class, size_t size, const rb_data_type_t *data_type);

#define TypedData_Make_Struct0(result, ruby_class, type, size, data_type, sval) \
VALUE result = rb_data_typed_object_zalloc(ruby_class, size, data_type); \
(void)((sval) = (type *)DATA_PTR(result));

VALUE rb_data_typed_object_make(VALUE ruby_class, const rb_data_type_t *type, void **data_pointer, size_t size);

#define TypedData_Make_Struct(ruby_class, type, data_type, sval) rb_data_typed_object_make((ruby_class), (data_type), (void **)&(sval), sizeof(type))

void *rb_check_typeddata(VALUE value, const rb_data_type_t *data_type);

#define TypedData_Get_Struct(value, type, data_type, variable) ((variable) = (type *)rb_check_typeddata((value), (data_type)))
Loading