fix openjdk-src build with JDK 8

This commit is contained in:
Joel Dice 2016-12-04 19:02:30 -07:00
parent 8b469195de
commit a4d9037ae4
2 changed files with 21 additions and 3 deletions

View File

@ -523,6 +523,9 @@ class MyClasspath : public Classpath {
GcJobject* blockerLock = makeJobject(t);
thread->setBlockerLock(t, blockerLock);
#if HAVE_ThreadName_Ljava_lang_String_
GcString* name = vm::makeString(t, "Thread-%p", thread);
#else
const unsigned BufferSize = 256;
char buffer[BufferSize];
unsigned length = vm::snprintf(buffer, BufferSize, "Thread-%p", thread);
@ -530,6 +533,7 @@ class MyClasspath : public Classpath {
for (unsigned i = 0; i < length; ++i) {
name->body()[i] = buffer[i];
}
#endif
thread->setName(t, name);
return thread;

View File

@ -19,6 +19,7 @@
#include <vector>
#include <set>
#include <sstream>
#include <algorithm>
#include "avian/constants.h"
#include "avian/finder.h"
@ -908,8 +909,6 @@ std::string cppFieldType(Module& module, Field* f)
void writeAccessor(Output* out, Class* cl, Field* f)
{
std::string typeName = f->typeName;
out->write("const unsigned ");
out->write(capitalize(cl->name));
out->write(capitalize(f->name));
@ -920,7 +919,22 @@ void writeAccessor(Output* out, Class* cl, Field* f)
out->write("#define HAVE_");
out->write(capitalize(cl->name));
out->write(capitalize(f->name));
out->write(" 1\n\n");
out->write(" 1\n");
if (! f->javaSpec.empty()) {
std::string s = f->javaSpec;
std::replace(s.begin(), s.end(), '/', '_');
std::replace(s.begin(), s.end(), '$', '_');
std::replace(s.begin(), s.end(), ';', '_');
std::replace(s.begin(), s.end(), '[', '_');
out->write("#define HAVE_");
out->write(capitalize(cl->name));
out->write(capitalize(f->name));
out->write("_");
out->write(s);
out->write(" 1\n\n");
}
}
void writeAccessors(Output* out, Module& module)