From afdab27e022c0f5e9ea371051d302d75905832a1 Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Mon, 20 Jul 2009 14:32:25 -0600 Subject: [PATCH] backport GC safety fixes from gnu branch --- src/compile.cpp | 4 +++- src/machine.cpp | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/compile.cpp b/src/compile.cpp index ee41dd9cb7..48ab0aebeb 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -5984,9 +5984,11 @@ class MyProcessor: public Processor { virtual void initVtable(Thread* t, object c) { + PROTECT(t, c); for (int i = classLength(t, c) - 1; i >= 0; --i) { - classVtable(t, c, i) = reinterpret_cast + void* thunk = reinterpret_cast (virtualThunk(static_cast(t), i)); + classVtable(t, c, i) = thunk; } } diff --git a/src/machine.cpp b/src/machine.cpp index 9b8ddb7c38..574b5ffd99 100644 --- a/src/machine.cpp +++ b/src/machine.cpp @@ -2439,6 +2439,8 @@ parseClass(Thread* t, const uint8_t* data, unsigned size) classLoader(t, class_), vtableLength); + PROTECT(t, real); + t->m->processor->initVtable(t, real); updateClassTables(t, real, class_);