src/Spaces-inl.h
changeset 91 5f4402180204
parent 86 32ad0523b309
     1.1 --- a/src/Spaces-inl.h	Wed Jul 25 00:16:52 2012 -0700
     1.2 +++ b/src/Spaces-inl.h	Wed Jul 25 00:48:08 2012 -0700
     1.3 @@ -19,6 +19,8 @@
     1.4  #ifndef _include_jitcraft_spaces_inl_h_
     1.5  #define _include_jitcraft_spaces_inl_h_
     1.6  
     1.7 +#include "Objects.h"
     1.8 +
     1.9  namespace ke {
    1.10  
    1.11  inline Address
    1.12 @@ -54,6 +56,23 @@
    1.13      return addr;
    1.14  }
    1.15  
    1.16 +template <typename SizeEvaluator> inline Object *
    1.17 +ChunkObjectIteratorBase<SizeEvaluator>::next()
    1.18 +{
    1.19 +    while (current_ && current_ != top_) {
    1.20 +        Object *obj = reinterpret_cast<Object *>(current_);
    1.21 +        size_t size = evaluator_(obj, obj->map());
    1.22 +        current_ += size;
    1.23 +        if (current_ == chunk_->end()) {
    1.24 +            chunk_ = chunk_->next();
    1.25 +            current_ = chunk_ ? chunk_->first() : NULL;
    1.26 +        }
    1.27 +        if (obj->is(MapKind_FreeRegion))
    1.28 +            continue;
    1.29 +    }
    1.30 +    return NULL;
    1.31 +}
    1.32 +
    1.33  }
    1.34  
    1.35  #endif // _include_jitcraft_spaces_inl_h_