diff --git a/src/Main.cpp b/src/Main.cpp index dc351161..ad9a89dd 100644 --- a/src/Main.cpp +++ b/src/Main.cpp @@ -67,5 +67,5 @@ int main(int argc, char** argv) { Universe::Start(argc, argv); - Universe::Quit(ERR_SUCCESS); + Quit(ERR_SUCCESS); } diff --git a/src/compiler/Lexer.cpp b/src/compiler/Lexer.cpp index e1bebcf7..1a359d35 100644 --- a/src/compiler/Lexer.cpp +++ b/src/compiler/Lexer.cpp @@ -33,7 +33,7 @@ #include #include "../misc/defs.h" -#include "../vm/Universe.h" +#include "../vm/Print.h" Lexer::Lexer(istream& file) : infile(file), peekDone(false) {} @@ -322,7 +322,7 @@ Symbol Lexer::Peek() { const LexerState old = state; if (peekDone) { - Universe::ErrorExit("Cannot Peek twice!\n"); + ErrorExit("Cannot Peek twice!\n"); } GetSym(); const Symbol nextSym = state.sym; diff --git a/src/compiler/MethodGenerationContext.cpp b/src/compiler/MethodGenerationContext.cpp index 0602190e..e61311ec 100644 --- a/src/compiler/MethodGenerationContext.cpp +++ b/src/compiler/MethodGenerationContext.cpp @@ -38,6 +38,7 @@ #include "../interpreter/bytecodes.h" #include "../misc/VectorUtil.h" #include "../vm/Globals.h" +#include "../vm/Print.h" #include "../vm/Universe.h" #include "../vmobjects/ObjectFormats.h" #include "../vmobjects/VMMethod.h" @@ -147,7 +148,7 @@ VMTrivialMethod* MethodGenerationContext::assembleLiteralReturn( } } - GetUniverse()->ErrorExit( + ErrorExit( "Unexpected situation when trying to create trivial method that " "returns a literal"); } @@ -159,7 +160,7 @@ VMTrivialMethod* MethodGenerationContext::assembleGlobalReturn() { } if (literals.size() != 1) { - GetUniverse()->ErrorExit( + ErrorExit( "Unexpected situation when trying to create trivial method that " "reads a global. New Bytecode?"); } @@ -228,7 +229,7 @@ VMTrivialMethod* MethodGenerationContext::assembleFieldSetter() { break; } default: { - GetUniverse()->ErrorExit("Unexpected bytecode"); + ErrorExit("Unexpected bytecode"); } } @@ -246,7 +247,7 @@ VMTrivialMethod* MethodGenerationContext::assembleFieldSetter() { break; } default: { - GetUniverse()->ErrorExit("Unexpected bytecode"); + ErrorExit("Unexpected bytecode"); } } @@ -708,7 +709,7 @@ uint8_t MethodGenerationContext::GetInlinedLocalIdx(const Variable* var) const { "Unexpected issue trying to find an inlined variable. %s could not " "be found.", qualifiedName.data()); - Universe::ErrorExit(msg); + ErrorExit(msg); } void MethodGenerationContext::checkJumpOffset(size_t jumpOffset, @@ -718,7 +719,7 @@ void MethodGenerationContext::checkJumpOffset(size_t jumpOffset, snprintf(msg, 100, "The jumpOffset for the %s bytecode is out of range: %zu\n", Bytecode::GetBytecodeName(bytecode), jumpOffset); - Universe::ErrorExit(msg); + ErrorExit(msg); } } @@ -786,7 +787,7 @@ size_t MethodGenerationContext::getOffsetOfLastBytecode(size_t indexFromEnd) { for (size_t i = 0; i < indexFromEnd + 1; i += 1) { uint8_t actual = last4Bytecodes.at(NUM_LAST_BYTECODES - 1 - i); if (actual == BC_INVALID) { - GetUniverse()->ErrorExit("The requested bytecode is invalid"); + ErrorExit("The requested bytecode is invalid"); } bcOffset -= Bytecode::GetBytecodeLength(actual); diff --git a/src/compiler/Parser.cpp b/src/compiler/Parser.cpp index bd57dd7a..31942642 100644 --- a/src/compiler/Parser.cpp +++ b/src/compiler/Parser.cpp @@ -908,7 +908,7 @@ __attribute__((noreturn)) void Parser::parseError(const char* msg, ReplacePattern(msgWithMeta, "%(found)s", foundStr); ErrorPrint(msgWithMeta); - GetUniverse()->Quit(ERR_FAIL); + Quit(ERR_FAIL); } __attribute__((noreturn)) void Parser::parseError(const char* msg, diff --git a/src/interpreter/Interpreter.cpp b/src/interpreter/Interpreter.cpp index 6c32cf9f..47f1fb49 100644 --- a/src/interpreter/Interpreter.cpp +++ b/src/interpreter/Interpreter.cpp @@ -36,6 +36,7 @@ #include "../misc/defs.h" #include "../vm/Globals.h" #include "../vm/IsValidObject.h" +#include "../vm/Print.h" #include "../vm/Universe.h" #include "../vmobjects/IntegerBox.h" #include "../vmobjects/ObjectFormats.h" @@ -237,7 +238,7 @@ void Interpreter::doPushFieldWithIndex(uint8_t fieldIndex) { if (unlikely(IS_TAGGED(self))) { o = nullptr; - Universe()->ErrorExit("Integers do not have fields!"); + ErrorExit("Integers do not have fields!"); } else { o = ((VMObject*)self)->GetField(fieldIndex); } @@ -320,7 +321,7 @@ void Interpreter::doPopFieldWithIndex(uint8_t fieldIndex) { vm_oop_t o = GetFrame()->Pop(); if (unlikely(IS_TAGGED(self))) { - GetUniverse()->ErrorExit("Integers do not have fields that can be set"); + ErrorExit("Integers do not have fields that can be set"); } else { ((VMObject*)self)->SetField(fieldIndex, o); } @@ -436,7 +437,7 @@ void Interpreter::doInc() { double d = static_cast(val)->GetEmbeddedDouble(); val = GetUniverse()->NewDouble(d + 1.0); } else { - GetUniverse()->ErrorExit("unsupported"); + ErrorExit("unsupported"); } GetFrame()->SetTop(store_root(val)); diff --git a/src/memory/CopyingHeap.cpp b/src/memory/CopyingHeap.cpp index e3eb1568..d494045e 100644 --- a/src/memory/CopyingHeap.cpp +++ b/src/memory/CopyingHeap.cpp @@ -7,7 +7,6 @@ #include "../misc/defs.h" #include "../vm/Print.h" -#include "../vm/Universe.h" #include "../vmobjects/AbstractObject.h" #include "CopyingCollector.h" #include "Heap.h" @@ -52,7 +51,7 @@ void CopyingHeap::switchBuffers(bool increaseMemory) { currentBuffer = malloc(newSize); if (currentBuffer == nullptr) { - Universe::ErrorExit("unable to allocate heap memory"); + ErrorExit("unable to allocate heap memory"); } currentBufferEnd = (void*)((size_t)currentBuffer + newSize); @@ -91,7 +90,7 @@ void CopyingHeap::invalidateOldBuffer() { oldBuffer = malloc(currentBufSize); if (oldBuffer == nullptr) { - Universe::ErrorExit("unable to allocate heap memory"); + ErrorExit("unable to allocate heap memory"); } oldBufferEnd = (void*)((size_t)oldBuffer + currentBufSize); @@ -103,7 +102,7 @@ AbstractVMObject* CopyingHeap::AllocateObject(size_t size) { nextFreePosition = (void*)((size_t)nextFreePosition + size); if (nextFreePosition > currentBufferEnd) { ErrorPrint("\nFailed to allocate " + to_string(size) + " Bytes.\n"); - Universe::Quit(-1); + Quit(-1); } // let's see if we have to trigger the GC diff --git a/src/memory/DebugCopyingHeap.cpp b/src/memory/DebugCopyingHeap.cpp index cc837fbe..f2a8cc89 100644 --- a/src/memory/DebugCopyingHeap.cpp +++ b/src/memory/DebugCopyingHeap.cpp @@ -7,7 +7,6 @@ #include #include "../vm/Print.h" -#include "../vm/Universe.h" #include "../vmobjects/AbstractObject.h" void DebugCopyingHeap::switchBuffers(bool increaseMemory) { @@ -57,7 +56,7 @@ AbstractVMObject* DebugCopyingHeap::AllocateObject(size_t size) { if (currentHeapUsage > currentHeapSize) { ErrorPrint("\nFailed to allocate " + to_string(size) + " Bytes.\n"); - Universe::Quit(-1); + Quit(-1); } // let's see if we have to trigger the GC diff --git a/src/memory/GenerationalHeap.cpp b/src/memory/GenerationalHeap.cpp index 450a66b2..a1a622d1 100644 --- a/src/memory/GenerationalHeap.cpp +++ b/src/memory/GenerationalHeap.cpp @@ -6,7 +6,6 @@ #include #include "../vm/Print.h" -#include "../vm/Universe.h" #include "../vmobjects/AbstractObject.h" #include "../vmobjects/ObjectFormats.h" #include "../vmobjects/VMObjectBase.h" @@ -39,7 +38,7 @@ AbstractVMObject* GenerationalHeap::AllocateNurseryObject(size_t size) { if ((size_t)nextFreePosition > nursery_end) { ErrorPrint("\nFailed to allocate " + to_string(size) + " Bytes in nursery.\n"); - GetUniverse()->Quit(-1); + Quit(-1); } // let's see if we have to trigger the GC if (nextFreePosition > collectionLimit) { @@ -52,7 +51,7 @@ AbstractVMObject* GenerationalHeap::AllocateMatureObject(size_t size) { AbstractVMObject* newObject = (AbstractVMObject*)malloc(size); if (newObject == nullptr) { ErrorPrint("\nFailed to allocate " + to_string(size) + " Bytes.\n"); - GetUniverse()->Quit(-1); + Quit(-1); } allocatedObjects->push_back(newObject); matureObjectsSize += size; diff --git a/src/memory/MarkSweepHeap.cpp b/src/memory/MarkSweepHeap.cpp index 34c7bb89..c8f4f663 100644 --- a/src/memory/MarkSweepHeap.cpp +++ b/src/memory/MarkSweepHeap.cpp @@ -7,7 +7,6 @@ #include "../memory/Heap.h" #include "../vm/Print.h" -#include "../vm/Universe.h" #include "../vmobjects/AbstractObject.h" #include "MarkSweepCollector.h" @@ -23,7 +22,7 @@ AbstractVMObject* MarkSweepHeap::AllocateObject(size_t size) { AbstractVMObject* newObject = (AbstractVMObject*)malloc(size); if (newObject == nullptr) { ErrorPrint("\nFailed to allocate " + to_string(size) + " Bytes.\n"); - Universe::Quit(-1); + Quit(-1); } spcAlloc += size; memset((void*)newObject, 0, size); diff --git a/src/primitives/Double.cpp b/src/primitives/Double.cpp index 5eee511b..2bf96a41 100644 --- a/src/primitives/Double.cpp +++ b/src/primitives/Double.cpp @@ -34,6 +34,7 @@ #include "../primitivesCore/PrimitiveContainer.h" #include "../vm/Globals.h" +#include "../vm/Print.h" #include "../vm/Universe.h" #include "../vmobjects/ObjectFormats.h" #include "../vmobjects/VMDouble.h" @@ -56,8 +57,7 @@ double coerceDouble(vm_oop_t x) { } else if (cl == load_ptr(integerClass)) { return (double)static_cast(x)->GetEmbeddedInteger(); } else { - GetUniverse()->ErrorExit( - "Attempt to apply Double operation to non-number."); + ErrorExit("Attempt to apply Double operation to non-number."); } return 0.0f; diff --git a/src/primitives/System.cpp b/src/primitives/System.cpp index 6f3e9f37..10e63040 100644 --- a/src/primitives/System.cpp +++ b/src/primitives/System.cpp @@ -91,7 +91,7 @@ static vm_oop_t sysLoad_(vm_oop_t, vm_oop_t rightObj) { static vm_oop_t sysExit_(vm_oop_t, vm_oop_t err) { long err_no = INT_VAL(err); - GetUniverse()->Quit(err_no); + Quit(err_no); } static vm_oop_t sysPrintString_(vm_oop_t leftObj, vm_oop_t rightObj) { diff --git a/src/vm/Print.cpp b/src/vm/Print.cpp index 7d693c43..1376608c 100644 --- a/src/vm/Print.cpp +++ b/src/vm/Print.cpp @@ -1,20 +1,50 @@ #include "Print.h" +#include #include #include +#include #include "../misc/defs.h" +#include "LogAllocation.h" +#include "Universe.h" using namespace std; static mutex output_mutex; -void Print(StdString str) { +void Print(std::string str) { lock_guard lock(output_mutex); cout << str << flush; } -void ErrorPrint(StdString str) { +void ErrorPrint(std::string str) { lock_guard lock(output_mutex); cerr << str << flush; } + +void Print(const char* str) { + lock_guard lock(output_mutex); + cout << str << flush; +} + +void ErrorPrint(const char* str) { + lock_guard lock(output_mutex); + cerr << str << flush; +} + +__attribute__((noreturn)) __attribute__((noinline)) void ErrorExit( + const char* err) { + ErrorPrint("Runtime error: " + StdString(err) + "\n"); + Quit(ERR_FAIL); +} + +__attribute__((noreturn)) __attribute__((noinline)) void Quit(long err) { + ErrorPrint("Time spent in GC: [" + + to_string(Timer::GCTimer->GetTotalTime()) + "] msec\n"); + + Universe::Shutdown(); + + OutputAllocationLogFile(); + exit((int)err); +} diff --git a/src/vm/Print.h b/src/vm/Print.h index ce0278ca..34bdafdf 100644 --- a/src/vm/Print.h +++ b/src/vm/Print.h @@ -1,6 +1,11 @@ #pragma once -#include "../misc/defs.h" +#include -void Print(StdString str); -void ErrorPrint(StdString str); +void Print(std::string str); +void Print(const char* str); +void ErrorPrint(std::string str); +void ErrorPrint(const char* str); + +__attribute__((noreturn)) __attribute__((noinline)) void Quit(long); +__attribute__((noreturn)) __attribute__((noinline)) void ErrorExit(const char*); diff --git a/src/vm/Shell.cpp b/src/vm/Shell.cpp index 5d6d1f43..6e6020bf 100644 --- a/src/vm/Shell.cpp +++ b/src/vm/Shell.cpp @@ -37,6 +37,7 @@ #include "../vmobjects/VMInvokable.h" #include "../vmobjects/VMMethod.h" #include "Globals.h" +#include "Print.h" #include "Symbols.h" #include "Universe.h" @@ -65,7 +66,7 @@ void Shell::Start(Interpreter* interp) { #define QUIT_CMD_L 11 + 1 if (bootstrapMethod == nullptr) { - GetUniverse()->ErrorExit("Shell needs bootstrap method!"); + ErrorExit("Shell needs bootstrap method!"); } // the statement to evaluate char inbuf[INPUT_MAX_SIZE]; diff --git a/src/vm/Universe.cpp b/src/vm/Universe.cpp index a28d9c53..1ea44ca5 100644 --- a/src/vm/Universe.cpp +++ b/src/vm/Universe.cpp @@ -92,7 +92,7 @@ void Universe::BasicInit() { theUniverse = new Universe(); } -__attribute__((noreturn)) void Universe::Quit(long err) { +void Universe::Shutdown() { ErrorPrint("Time spent in GC: [" + to_string(Timer::GCTimer->GetTotalTime()) + "] msec\n"); #ifdef GENERATE_INTEGER_HISTOGRAM @@ -136,18 +136,9 @@ __attribute__((noreturn)) void Universe::Quit(long err) { } #endif - OutputAllocationLogFile(); - if (theUniverse) { delete (theUniverse); } - - exit((int)err); -} - -__attribute__((noreturn)) void Universe::ErrorExit(const char* err) { - ErrorPrint("Runtime error: " + StdString(err) + "\n"); - Quit(ERR_FAIL); } vector Universe::handleArguments(long argc, char** argv) { @@ -619,7 +610,7 @@ void Universe::LoadSystemClass(VMClass* systemClass) { if (!result) { ErrorPrint("Can't load system class: " + s + "\n"); - Universe::Quit(ERR_FAIL); + Quit(ERR_FAIL); } if (result->HasPrimitives() || result->GetClass()->HasPrimitives()) { diff --git a/src/vm/Universe.h b/src/vm/Universe.h index 363b7094..ecc7e82f 100644 --- a/src/vm/Universe.h +++ b/src/vm/Universe.h @@ -34,6 +34,7 @@ #include "../misc/Timer.h" #include "../misc/defs.h" #include "../vmobjects/ObjectFormats.h" +#include "Print.h" class SourcecodeCompiler; @@ -49,8 +50,6 @@ class Universe { // static methods static void Start(long argc, char** argv); static void BasicInit(); - __attribute__((noreturn)) static void Quit(long); - __attribute__((noreturn)) static void ErrorExit(const char*); vm_oop_t interpret(StdString className, StdString methodName); @@ -114,6 +113,8 @@ class Universe { #endif // + static void Shutdown(); + private: vm_oop_t interpretMethod(VMObject* receiver, VMInvokable* initialize, VMArray* argumentsArray); @@ -144,8 +145,7 @@ class Universe { inline Universe* GetUniverse() __attribute__((always_inline)); Universe* GetUniverse() { if (DEBUG && Universe::theUniverse == nullptr) { - Universe::ErrorExit( - "Trying to access uninitialized Universe, exiting."); + ErrorExit("Trying to access uninitialized Universe, exiting."); } return Universe::theUniverse; } diff --git a/src/vmobjects/VMArray.cpp b/src/vmobjects/VMArray.cpp index f7e11ced..9460b20c 100644 --- a/src/vmobjects/VMArray.cpp +++ b/src/vmobjects/VMArray.cpp @@ -33,6 +33,7 @@ #include "../memory/Heap.h" #include "../misc/defs.h" +#include "../vm/Print.h" #include "../vm/Universe.h" #include "../vmobjects/ObjectFormats.h" #include "../vmobjects/VMObject.h" @@ -49,20 +50,20 @@ VMArray::VMArray(size_t arraySize, size_t additionalBytes) vm_oop_t VMArray::GetIndexableField(size_t idx) const { if (unlikely(idx > GetNumberOfIndexableFields())) { - Universe::ErrorExit(("Array index out of bounds: Accessing " + - to_string(idx) + ", but array size is only " + - to_string(GetNumberOfIndexableFields()) + "\n") - .c_str()); + ErrorExit(("Array index out of bounds: Accessing " + to_string(idx) + + ", but array size is only " + + to_string(GetNumberOfIndexableFields()) + "\n") + .c_str()); } return GetField(idx); } void VMArray::SetIndexableField(size_t idx, vm_oop_t value) { if (unlikely(idx > GetNumberOfIndexableFields())) { - Universe::ErrorExit(("Array index out of bounds: Accessing " + - to_string(idx) + ", but array size is only " + - to_string(GetNumberOfIndexableFields()) + "\n") - .c_str()); + ErrorExit(("Array index out of bounds: Accessing " + to_string(idx) + + ", but array size is only " + + to_string(GetNumberOfIndexableFields()) + "\n") + .c_str()); } SetField(idx, value); } diff --git a/src/vmobjects/VMClass.cpp b/src/vmobjects/VMClass.cpp index c6f38e0c..7f082461 100644 --- a/src/vmobjects/VMClass.cpp +++ b/src/vmobjects/VMClass.cpp @@ -35,7 +35,7 @@ #include "../primitivesCore/PrimitiveLoader.h" #include "../vm/Globals.h" #include "../vm/IsValidObject.h" -#include "../vm/Universe.h" +#include "../vm/Print.h" #include "ObjectFormats.h" #include "VMArray.h" #include "VMInvokable.h" @@ -65,8 +65,7 @@ VMClass::VMClass(size_t numberOfFields, size_t additionalBytes) bool VMClass::AddInstanceInvokable(VMInvokable* ptr) { if (ptr == nullptr) { - GetUniverse()->ErrorExit( - "Error: trying to add non-invokable to invokables array"); + ErrorExit("Error: trying to add non-invokable to invokables array"); return false; } // Check whether an invokable with the same signature exists and replace it @@ -82,7 +81,7 @@ bool VMClass::AddInstanceInvokable(VMInvokable* ptr) { return false; } } else { - GetUniverse()->ErrorExit( + ErrorExit( "Invokables array corrupted. " "Either NULL pointer added or pointer to non-invokable."); return false; diff --git a/src/vmobjects/VMEvaluationPrimitive.cpp b/src/vmobjects/VMEvaluationPrimitive.cpp index 4b9b7675..d41ad9e1 100644 --- a/src/vmobjects/VMEvaluationPrimitive.cpp +++ b/src/vmobjects/VMEvaluationPrimitive.cpp @@ -34,6 +34,7 @@ #include "../memory/Heap.h" #include "../misc/defs.h" #include "../primitivesCore/Routine.h" +#include "../vm/Print.h" #include "../vm/Symbols.h" #include "../vm/Universe.h" // NOLINT(misc-include-cleaner) it's required to make the types complete #include "ObjectFormats.h" @@ -118,7 +119,7 @@ bool VMEvaluationPrimitive::IsMarkedInvalid() const { } void VMEvaluationPrimitive::InlineInto(MethodGenerationContext&, bool) { - GetUniverse()->ErrorExit( + ErrorExit( "VMEvaluationPrimitive::InlineInto is not supported, and should not be " "reached"); } diff --git a/src/vmobjects/VMInvokable.cpp b/src/vmobjects/VMInvokable.cpp index bb2b79c9..eee8bf08 100644 --- a/src/vmobjects/VMInvokable.cpp +++ b/src/vmobjects/VMInvokable.cpp @@ -28,7 +28,7 @@ #include -#include "../vm/Universe.h" +#include "../vm/Print.h" #include "ObjectFormats.h" #include "VMClass.h" #include "VMSymbol.h" @@ -57,6 +57,5 @@ void VMInvokable::SetHolder(VMClass* hld) { } const Variable* VMInvokable::GetArgument(size_t, size_t) { - GetUniverse()->ErrorExit( - "VMInvokable::GetArgument not supported on anything VMMethod"); + ErrorExit("VMInvokable::GetArgument not supported on anything VMMethod"); } diff --git a/src/vmobjects/VMMethod.cpp b/src/vmobjects/VMMethod.cpp index 0fc4ec3f..2d2952e8 100644 --- a/src/vmobjects/VMMethod.cpp +++ b/src/vmobjects/VMMethod.cpp @@ -42,6 +42,7 @@ #include "../memory/Heap.h" #include "../misc/defs.h" #include "../vm/Globals.h" +#include "../vm/Print.h" #include "../vm/Universe.h" // NOLINT(misc-include-cleaner) it's required to make the types complete #include "ObjectFormats.h" #include "Signature.h" @@ -439,7 +440,7 @@ void VMMethod::inlineInto(MethodGenerationContext& mgenc) { "inlineInto: Found %s bytecode, but it's not expected in a " "block method", Bytecode::GetBytecodeName(bytecode)); - Universe::ErrorExit(msg); + ErrorExit(msg); break; } default: { @@ -449,7 +450,7 @@ void VMMethod::inlineInto(MethodGenerationContext& mgenc) { "not yet " "supported.", Bytecode::GetBytecodeName(bytecode)); - Universe::ErrorExit(msg); + ErrorExit(msg); break; } } @@ -605,7 +606,7 @@ void VMMethod::AdaptAfterOuterInlined( "AdaptAfterOuterInlined: Found %s bytecode, but it's not " "expected in a block method", Bytecode::GetBytecodeName(bytecode)); - Universe::ErrorExit(msg); + ErrorExit(msg); } default: { @@ -615,7 +616,7 @@ void VMMethod::AdaptAfterOuterInlined( "not yet " "support it.", Bytecode::GetBytecodeName(bytecode)); - Universe::ErrorExit(msg); + ErrorExit(msg); } } diff --git a/src/vmobjects/VMPrimitive.cpp b/src/vmobjects/VMPrimitive.cpp index 81b82728..d2b0498a 100644 --- a/src/vmobjects/VMPrimitive.cpp +++ b/src/vmobjects/VMPrimitive.cpp @@ -34,7 +34,6 @@ #include "../primitivesCore/Routine.h" #include "../vm/Globals.h" // NOLINT (misc-include-cleaner) #include "../vm/Print.h" -#include "../vm/Universe.h" #include "ObjectFormats.h" #include "VMClass.h" #include "VMFrame.h" @@ -65,7 +64,7 @@ void VMPrimitive::EmptyRoutine(Interpreter*, VMFrame*) { } void VMPrimitive::InlineInto(MethodGenerationContext&, bool) { - GetUniverse()->ErrorExit( + ErrorExit( "VMPrimitive::InlineInto is not supported, and should not be reached"); } diff --git a/src/vmobjects/VMSafePrimitive.cpp b/src/vmobjects/VMSafePrimitive.cpp index 32092819..4f38d6f8 100644 --- a/src/vmobjects/VMSafePrimitive.cpp +++ b/src/vmobjects/VMSafePrimitive.cpp @@ -6,7 +6,7 @@ #include "../memory/Heap.h" #include "../misc/defs.h" #include "../primitivesCore/Primitives.h" -#include "../vm/Universe.h" +#include "../vm/Print.h" #include "AbstractObject.h" #include "ObjectFormats.h" #include "VMClass.h" @@ -81,6 +81,6 @@ AbstractVMObject* VMSafeTernaryPrimitive::CloneForMovingGC() const { } void VMSafePrimitive::InlineInto(MethodGenerationContext&, bool) { - GetUniverse()->ErrorExit( + ErrorExit( "VMPrimitive::InlineInto is not supported, and should not be reached"); } diff --git a/src/vmobjects/VMTrivialMethod.cpp b/src/vmobjects/VMTrivialMethod.cpp index 6aee2bef..566f5613 100644 --- a/src/vmobjects/VMTrivialMethod.cpp +++ b/src/vmobjects/VMTrivialMethod.cpp @@ -11,6 +11,7 @@ #include "../memory/Heap.h" #include "../misc/defs.h" #include "../vm/LogAllocation.h" +#include "../vm/Print.h" #include "../vm/Universe.h" #include "AbstractObject.h" #include "ObjectFormats.h" @@ -122,7 +123,7 @@ VMFrame* VMGetter::Invoke(Interpreter*, VMFrame* frame) { vm_oop_t result; if (unlikely(IS_TAGGED(self))) { result = nullptr; - Universe()->ErrorExit("Integers do not have fields!"); + ErrorExit("Integers do not have fields!"); } else { result = ((VMObject*)self)->GetField(fieldIndex); } @@ -166,7 +167,7 @@ VMFrame* VMSetter::Invoke(Interpreter*, VMFrame* frame) { assert(value != nullptr); if (unlikely(IS_TAGGED(self))) { - Universe()->ErrorExit("Integers do not have fields!"); + ErrorExit("Integers do not have fields!"); } else { ((VMObject*)self)->SetField(fieldIndex, value); } @@ -175,8 +176,7 @@ VMFrame* VMSetter::Invoke(Interpreter*, VMFrame* frame) { } void VMSetter::InlineInto(MethodGenerationContext& mgenc, bool) { - GetUniverse()->ErrorExit( - "We don't currently support blocks for trivial setters"); + ErrorExit("We don't currently support blocks for trivial setters"); } AbstractVMObject* VMSetter::CloneForMovingGC() const {