[vmkit-commits] [vmkit] r200689 - Prepare the reading of the code attributes.
Gael Thomas
gael.thomas at lip6.fr
Mon Feb 3 04:32:59 PST 2014
Author: gthomas
Date: Mon Feb 3 06:32:58 2014
New Revision: 200689
URL: http://llvm.org/viewvc/llvm-project?rev=200689&view=rev
Log:
Prepare the reading of the code attributes.
Modified:
vmkit/branches/mcjit/Makefile.rules
vmkit/branches/mcjit/include/j3/j3class.h
vmkit/branches/mcjit/include/j3/j3method.h
vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
Modified: vmkit/branches/mcjit/Makefile.rules
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/Makefile.rules?rev=200689&r1=200688&r2=200689&view=diff
==============================================================================
--- vmkit/branches/mcjit/Makefile.rules (original)
+++ vmkit/branches/mcjit/Makefile.rules Mon Feb 3 06:32:58 2014
@@ -130,7 +130,7 @@ check::
###############################################################################
# Build system managment
###############################################################################
-SELF=$(PROJ_SRC_ROOT)/Makefile.rules $(PROJ_OBJ_ROOT)/Makefile.config $(PROJ_SRC_CWD)/Makefile
+#SELF=$(PROJ_SRC_ROOT)/Makefile.rules $(PROJ_OBJ_ROOT)/Makefile.config $(PROJ_SRC_CWD)/Makefile
$(PROJ_SRC_ROOT)/configure: $(PROJ_SRC_ROOT)/autoconf/configure.ac
$(Echo) "Rebootstraping project"
Modified: vmkit/branches/mcjit/include/j3/j3class.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3class.h?rev=200689&r1=200688&r2=200689&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3class.h (original)
+++ vmkit/branches/mcjit/include/j3/j3class.h Mon Feb 3 06:32:58 2014
@@ -211,7 +211,6 @@ namespace j3 {
J3ObjectHandle* _protectionDomain;
const char* _source;
- J3Attributes* readAttributes(J3Reader* reader);
void readClassBytes(J3Field* hiddenFields, uint32_t nbHiddenFields);
void check(uint16_t idx, uint32_t id=-1);
@@ -231,6 +230,10 @@ namespace j3 {
public:
J3Class(J3ClassLoader* loader, const vmkit::Name* name, J3ClassBytes* bytes, J3ObjectHandle* protectionDomain, const char* source);
+ J3Attributes* readAttributes(J3Reader* reader);
+
+ J3Attributes* attributes() { return _attributes; }
+
void compileAll();
void aotSnapshot(llvm::Linker* linker);
Modified: vmkit/branches/mcjit/include/j3/j3method.h
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/include/j3/j3method.h?rev=200689&r1=200688&r2=200689&view=diff
==============================================================================
--- vmkit/branches/mcjit/include/j3/j3method.h (original)
+++ vmkit/branches/mcjit/include/j3/j3method.h Mon Feb 3 06:32:58 2014
@@ -35,6 +35,7 @@ namespace j3 {
const vmkit::Name* _name;
J3Signature* _signature;
J3Attributes* _attributes;
+ J3Attributes* _codeAttributes;
uint32_t _index;
uint32_t _slot;
llvm::Function* _llvmFunction;
@@ -77,6 +78,9 @@ namespace j3 {
uint32_t index();
+ void setCodeAttributes(J3Attributes* attributes) { _codeAttributes = attributes; }
+ J3Attributes* codeAttributes() const { return _codeAttributes; }
+
J3Attributes* attributes() const { return _attributes; }
uint16_t access() const { return _access; }
J3Class* cl() const { return _cl; }
Modified: vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc?rev=200689&r1=200688&r2=200689&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc (original)
+++ vmkit/branches/mcjit/lib/j3/openjdk/j3openjdk.cc Mon Feb 3 06:32:58 2014
@@ -8,6 +8,7 @@
#include "j3/j3field.h"
#include "j3/j3utf16.h"
#include "j3/j3reader.h"
+#include "j3/j3attribute.h"
#include "jvm.h"
#include <dlfcn.h>
@@ -413,30 +414,30 @@ static jobject translateStackTrace(jobje
J3ObjectHandle* element = J3ObjectHandle::doNewObject(vm->stackTraceElementClass);
addStackElement(orig, buf, max, cur, element);
- const vmkit::Name* cn = m->cl()->name();
- uint32_t length = cn->length()+6;
- uint32_t lastToken = 0;
- char buf[length];
-
- for(uint32_t i=0; i<cn->length(); i++) {
- if(cn->cStr()[i] == '/') {
- buf[i] = '.';
- lastToken = i+1;
- } else
- buf[i] = cn->cStr()[i];
+ J3Attribute* sourceAttr = m->cl()->attributes()->lookup(vm->sourceFileAttribute);
+ const vmkit::Name* sourceFile = 0;
+ if(sourceAttr) {
+ J3Reader reader(m->cl()->bytes());
+ reader.seek(sourceAttr->offset(), reader.SeekSet);
+ reader.readU4();
+ sourceFile = m->cl()->nameAt(reader.readU2());
}
- buf[cn->length()] = 0;
- J3ObjectHandle* className = vm->utfToString(buf);
+ uint32_t lineNumber = -1;
+ J3Attribute* lineAttr = m->cl()->attributes()->lookup(vm->lineNumberTableAttribute);
- snprintf(buf, length, "%s.java", cn->cStr());
+ if(lineAttr) {
+ fprintf(stderr, " find line attribute...\n");
+ //sf->sourceIndex(j));
+ abort();
+ }
vm->stackTraceElementClassInit
->invokeSpecial(element,
- className,
- m->name() == vm->initName ? vm->utfToString(buf+lastToken) : vm->nameToString(m->name()),
- vm->utfToString(buf),
- sf->sourceIndex(j));
+ vm->nameToString(m->cl()->name()),
+ vm->nameToString(m->name()),
+ sourceFile ? vm->nameToString(sourceFile) : 0,
+ lineNumber);
}
}
} else if(!simplify) {
Modified: vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc
URL: http://llvm.org/viewvc/llvm-project/vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc?rev=200689&r1=200688&r2=200689&view=diff
==============================================================================
--- vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc (original)
+++ vmkit/branches/mcjit/lib/j3/vm/j3codegen.cc Mon Feb 3 06:32:58 2014
@@ -1774,6 +1774,7 @@ void J3CodeGen::generateJava() {
reader.seek(codeLength, reader.SeekCur);
exceptions.read(&reader, codeLength);
+ //method->setCodeAttributes(cl->readAttributes(&reader));
pendingBranchs[topPendingBranchs++] = codeReader->tell();
More information about the vmkit-commits
mailing list