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: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 87128dbb45ac
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: b3a77ad4d185
Choose a head ref
  • 4 commits
  • 4 files changed
  • 1 contributor

Commits on Jul 26, 2016

  1. Copy the full SHA
    d12a90f View commit details

Commits on Jul 28, 2016

  1. Revert "Singleton classes can't have subclasses."

    While singleton classes cannot have subclasses, modules can have singleton
    classes and the inline cache invalidation critically depends on those
    singleton classes being reachable from the module.
    
    This reverts commit 20938ee.
    brixen committed Jul 28, 2016
    Copy the full SHA
    f84e28d View commit details
  2. Copy the full SHA
    b30a3ae View commit details
  3. Copy the full SHA
    b3a77ad View commit details
Showing with 54 additions and 25 deletions.
  1. +2 −2 gems_list.txt
  2. +0 −3 machine/builtin/module.cpp
  3. +51 −19 machine/memory/header.hpp
  4. +1 −1 machine/test/test_memory_header.hpp
4 changes: 2 additions & 2 deletions gems_list.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
bundler-1.12.5.gem
bundler-1.11.2.gem
daedalus-core-0.5.0.gem
ffi2-generators-0.1.1.gem
json-1.8.3.gem
@@ -14,7 +14,7 @@ rubinius-bridge-2.2.gem
rubinius-code-3.0.gem
rubinius-compiler-3.5.gem
rubinius-coverage-2.1.gem
rubinius-debugger-2.4.gem
rubinius-debugger-2.5.gem
rubinius-developer_tools-2.0.0.gem
rubinius-instructions-3.0.gem
rubinius-melbourne-3.8.gem
3 changes: 0 additions & 3 deletions machine/builtin/module.cpp
Original file line number Diff line number Diff line change
@@ -490,13 +490,10 @@ namespace rubinius {
}

Object* Module::track_subclass(STATE, Module* mod) {
if(try_as<SingletonClass>(mod)) return cNil;

if(hierarchy_subclasses()->nil_p()) {
hierarchy_subclasses(state, Array::create(state, 4));
}
hierarchy_subclasses()->append(state, WeakRef::create(state, mod));

return cNil;
}

70 changes: 51 additions & 19 deletions machine/memory/header.hpp
Original file line number Diff line number Diff line change
@@ -18,9 +18,8 @@

namespace rubinius {

/* We use a variable length OOP tag system:
* The tag represents 1 to 3 bits which uniquely
* identify a data type.
/* We use a variable length pointer tag system: The tag represents 1 to 3 bits
* which uniquely identify a data type.
*
* 1 == rest is a fixnum
* 00 == rest is an object reference
@@ -31,17 +30,17 @@ namespace rubinius {
* updated in the configure script.
*/

#define TAG_REF 0x0
#define TAG_REF 0x0L
#define TAG_REF_MASK 3
#define TAG_REF_WIDTH 2

#define TAG_FIXNUM 0x1
#define TAG_FIXNUM 0x1L
#define TAG_FIXNUM_SHIFT 1
#define TAG_FIXNUM_MASK 1

#define TAG_BOOL 0x2
#define TAG_BOOL 0x2L

#define TAG_SYMBOL 0x6
#define TAG_SYMBOL 0x6L
#define TAG_SYMBOL_SHIFT 3
#define TAG_SYMBOL_MASK 7

@@ -319,9 +318,9 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);
#define RBX_MEMORY_TAINTED_BIT (1L << 36)
#define RBX_MEMORY_TAINTED_MASK (1L << 36)

#define RBX_MEMORY_TAINTED_P(f) RBX_MEMORY_GET_BIT(TAINTED,f)
#define RBX_MEMORY_SET_TAINTED(f) RBX_MEMORY_SET_BIT(TAINTED,f)
#define RBX_MEMORY_UNSET_TAINTED(f) RBX_MEMORY_UNSET_BIT(TAINTED,f)
#define RBX_MEMORY_TAINTED_P(f) RBX_MEMORY_GET_BIT(TAINTED,f)
#define RBX_MEMORY_SET_TAINTED(f) RBX_MEMORY_SET_BIT(TAINTED,f)
#define RBX_MEMORY_UNSET_TAINTED(f) RBX_MEMORY_UNSET_BIT(TAINTED,f)

#define RBX_MEMORY_BIAS_LOCKED_BIT (1L << 37)
#define RBX_MEMORY_BIAS_LOCKED_MASK (1L << 37)
@@ -394,13 +393,34 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);
public:
std::atomic<MemoryFlags> header;

static void initialize(STATE, MemoryHeader* obj) {
obj->header.store(0L);
enum MemoryRegion {
eFirstRegion = 0,
eSecondRegion,
eThirdRegion,
eLargeRegion,
};

static void initialize(
MemoryHeader* obj, int thread_id, MemoryRegion region, object_type type)
{
MemoryFlags flags = 0;

/* When an object is created, its three fundamental fields are:
* 1. thread ID
* 2. memory region
* 3. type ID
*/
RBX_MEMORY_SET_THREAD_ID(flags, thread_id);
RBX_MEMORY_SET_REGION(flags, region);
RBX_MEMORY_SET_TYPE_ID(flags, type);

obj->header.store(flags);
}

InflatedHeaderNg* inflated_header() const {
return const_cast<InflatedHeaderNg*>(
reinterpret_cast<const InflatedHeaderNg*>(RBX_MEMORY_HEADER_PTR(header.load())));
reinterpret_cast<const InflatedHeaderNg*>(
RBX_MEMORY_HEADER_PTR(header.load())));
}

bool forwarded_p() const {
@@ -419,12 +439,22 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);
return RBX_MEMORY_GET_THREAD_ID(header.load());
}

int region() const {
MemoryRegion region() const {
if(inflated_p()) {
return RBX_MEMORY_GET_REGION(inflated_header()->flags);
return static_cast<MemoryRegion>(
RBX_MEMORY_GET_REGION(inflated_header()->flags));
}

return RBX_MEMORY_GET_REGION(header.load());
return static_cast<MemoryRegion>(RBX_MEMORY_GET_REGION(header.load()));
}

void region(MemoryRegion region) {
if(inflated_p()) {
inflated_header()->flags =
RBX_MEMORY_SET_REGION(inflated_header()->flags, region);
} else {
header.store(RBX_MEMORY_SET_REGION(header.load(), region));
}
}

bool marked_p(unsigned int mark) const {
@@ -437,7 +467,7 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);

void mark(unsigned int mark) {
if(inflated_p()) {
RBX_MEMORY_SET_MARKED(inflated_header()->flags, mark);
RBX_MEMORY_SET_MARKED(inflated_header()->flags, mark);
} else {
header.store(RBX_MEMORY_SET_MARKED(header.load(), mark));
}
@@ -659,8 +689,10 @@ Object* const cUndef = reinterpret_cast<Object*>(0x22L);

~DataHeader() = delete;

static void initialize(STATE, DataHeader* obj) {
MemoryHeader::initialize(state, obj);
static void initialize(
MemoryHeader* obj, int thread_id, MemoryRegion region, object_type type)
{
MemoryHeader::initialize(obj, thread_id, region, type);
}

static size_t align(size_t bytes) {
2 changes: 1 addition & 1 deletion machine/test/test_memory_header.hpp
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ class TestMemoryHeader : public CxxTest::TestSuite, public VMTest {
MemoryHeader h;

void setUp() {
MemoryHeader::initialize(state, &h);
MemoryHeader::initialize(&h, 0, MemoryHeader::eFirstRegion, InvalidType);
}

void test_memory_flag_is_64bit_machine_word() {