Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

NIL_REFERENCES: Added mechanism to cut (nil) references during commit #286

Merged
merged 3 commits into from

3 participants

@matthias-springer
Collaborator

Note: This only works with a modified GemStone version (HPI-GSS matthias/nil-references).

This is different from db_instances_transient. Transient instances are committed but their instance variables are set to nil. Classes that are marked as db_nil_references and their instances are not committed at all. References are replaced by nil.

class C
end

C.maglev_nil_references true
c = C.new
Maglev::PERSISTENT_ROOT[1] = [[c]]
Maglev.commit_transaction

Maglev::PERSISTENT_ROOT[1]
=> [[nil]]
c
=> #<C:0x8fb0801>
@timfel
Owner

@matthias-springer once you've got the changes into the VM maglev master, @pbm can push new builds and you merge this?

@matthias-springer
Collaborator

I already merged the pull request in HPI-GSS (master-1.9). We can merge this pull request once we've got a new VM build (otherwise Travis will fail).

@knub knub merged commit bfd6f03 into master-1.9
@knub knub deleted the matthias/nil-references branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 14, 2013
  1. @matthias-springer

    NIL_REFERENCES: Added mechanism to cut (nil) references to marked cla…

    matthias-springer authored
    …sses (and their instances) during commit.
  2. @matthias-springer
Commits on May 3, 2013
  1. @knub
This page is out of date. Refresh to see the latest.
Showing with 26 additions and 0 deletions.
  1. +10 −0 src/kernel/bootstrap/Module.rb
  2. +16 −0 src/smalltalk/ruby/Module_ruby.gs
View
10 src/kernel/bootstrap/Module.rb
@@ -3,6 +3,15 @@ class Module
# See also delta/Module.rb
primitive_nobridge '__instvar_get', 'rubyInstvarAt:'
+
+ primitive_nobridge '__maglev_nil_references', '_nilReferences:'
+
+ def maglev_nil_references(switch=true)
+ raise ArgumentError, "A module/class cannot be persistable and marked as nil_references at the same time." if switch and self.maglev_persistable?
+ __maglev_nil_references(switch)
+ end
+
+ primitive 'maglev_nil_references?', '_nilReferences'
def __isBehavior
true
@@ -465,6 +474,7 @@ def remove_class_variable(name)
# <tt>Class#maglev_persistable_instances</tt> for controlling whether
# instances of the class are persistable.
def maglev_persistable(methodsPersistable = false)
+ raise ArgumentError, "A module/class cannot be persistable and marked as nil_references at the same time." if self.maglev_nil_references?
methodsPersistable = (methodsPersistable == true)
self.__set_persistable(methodsPersistable)
end
View
16 src/smalltalk/ruby/Module_ruby.gs
@@ -637,4 +637,20 @@ name
].
^ name
%
+method:
+_nilReferences: aBool
+
+self _validatePrivilege ifTrue:[
+ aBool ifTrue:[
+ format := format bitOr: GC_DB_NIL_REFERENCES_MASK.
+ ] ifFalse:[
+ format := format bitAnd: (GC_DB_NIL_REFERENCES_MASK bitInvert)
+ ].
+ self _refreshClassCache: false .
+].
+%
+method:
+_nilReferences
+ ^ (format bitAnd: GC_DB_NIL_REFERENCES_MASK) ~~ 0
+%
Something went wrong with that request. Please try again.