Skip to content

Commit 6943b96

Browse files
committed
Vector hashes updated to match changes. Hashes can now be shown by running SOM++ with --hashes flag
1 parent c54b1e2 commit 6943b96

File tree

4 files changed

+23
-14
lines changed

4 files changed

+23
-14
lines changed

src/primitives/Vector.cpp

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -106,21 +106,22 @@ _Vector::_Vector() {
106106
return;
107107
}
108108

109-
// These bytecode hashes may need to be updated occationally
109+
// These bytecode hashes may need to be updated occasionally
110110
// If they need to be updated, the corresponding primitive implementations
111111
// likely need to be adapted, too.
112-
113-
Add("at:", false, &vecAt, 1078057473, &vecAtAWFY, 3362920797);
114-
Add("at:put:", false, &vecAtPut, 1078057473, &vecAtPutAWFY, 3362920797);
115-
116-
Add("first", &vecFirst, false, 1725815466);
117-
Add("last", &vecLast, false, 1725815466);
118-
Add("append:", &vecAppend, false, 318093777);
119-
Add("remove", &removeLast, false, 1725815466);
120-
Add("remove:", &removeObject, false, 3449745100);
121-
Add("size", &vecSize, false, 198675311);
122-
Add("capacity", &capacity, false, 4108221081);
123-
Add("asArray", &asArray, false, 3449745100);
124-
Add("removeFirst", &removeFirst, false, 1725815466);
112+
// In order to print out hashes use the --hashes flag when executing SOM++
113+
114+
Add("at:", false, &vecAt, 315201797, &vecAtAWFY, 3362920797);
115+
Add("at:put:", false, &vecAtPut, 315201797, &vecAtPutAWFY, 3362920797);
116+
117+
Add("first", &vecFirst, false, 781539645);
118+
Add("last", &vecLast, false, 997610644);
119+
Add("append:", &vecAppend, false, 3383122912);
120+
Add("remove", &removeLast, false, 146838394);
121+
Add("remove:", &removeObject, false, 3385671007);
122+
Add("size", &vecSize, false, 582059043);
123+
Add("capacity", &capacity, false, 1600305580);
124+
Add("asArray", &asArray, false, 2100819204);
125+
Add("removeFirst", &removeFirst, false, 2083891304);
125126
Add("removeAll", &removeAll, false, 1510429688);
126127
};

src/vm/Universe.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ map<GCSymbol*, gc_oop_t> Universe::globals;
8383
map<uint8_t, GCClass*> Universe::blockClassesByNoOfArgs;
8484
vector<std::string> Universe::classPath;
8585
size_t Universe::heapSize;
86+
bool PRINT_HASHES = false;
8687

8788
void Universe::Start(int32_t argc, char** argv) {
8889
BasicInit();
@@ -211,6 +212,8 @@ vector<std::string> Universe::handleArguments(int32_t argc, char** argv) {
211212
} else if ((strncmp(argv[i], "-h", 2) == 0) ||
212213
(strncmp(argv[i], "--help", 6) == 0)) {
213214
printUsageAndExit(argv[0]);
215+
} else if ((strncmp(argv[i], "--hashes", 8)) == 0) {
216+
PRINT_HASHES = true;
214217
} else {
215218
vector<std::string> extPathTokens = vector<std::string>(2);
216219
std::string const tmpString = std::string(argv[i]);

src/vmobjects/VMClass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,9 @@ PrimInstallResult VMClass::InstallPrimitive(VMInvokable* invokable,
108108
hashMismatch = true;
109109
} else {
110110
seenHash = method->GetBytecodeHash();
111+
if (PRINT_HASHES) {
112+
cout << "Method: "<< method->GetSignature()->AsDebugString() << " has hash: " << seenHash << endl;
113+
}
111114
if (seenHash == bytecodeHash) {
112115
result = PrimInstallResult::INSTALLED_REPLACED;
113116
} else {

src/vmobjects/VMClass.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,5 @@ class VMClass : public VMObject {
9797
GCArray* instanceInvokables;
9898
GCObject* superClass;
9999
};
100+
101+
extern bool PRINT_HASHES;

0 commit comments

Comments
 (0)