Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
41 lines (32 loc) · 843 Bytes

File metadata and controls

41 lines (32 loc) · 843 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#pragma once
#include "../gc.h"
#include "../hashmap.h"
#include "../value.h"
#include "class.h"
#include "string.h"
struct Value;
struct Object {
GcObject obj;
// in case of a gc, the gc ensures that the class
// is garbage collected after the object, so we can
// safely access its numSlots in all cases without
// storing it explicitly
// gc functions
void mark() {
const Class *c = obj.getClass();
for(int i = 0; i < c->numSlots; i++) {
Gc::mark(slots(i));
}
}
inline Value *slots() const { return (Value *)(this + 1); }
inline Value &slots(int idx) const {
Value *v = (Value *)(this + 1);
return v[idx];
}
// we don't need to free anything here
void release() {}
#ifdef DEBUG_GC
void depend() { Gc::depend(obj.getClass()); }
const String *gc_repr() { return obj.getClass()->name; }
#endif
};
Morty Proxy This is a proxified and sanitized view of the page, visit original site.