Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read property 'tokens' of undefined #17

Closed
amorri40 opened this issue Jun 3, 2011 · 6 comments
Closed

TypeError: Cannot read property 'tokens' of undefined #17

amorri40 opened this issue Jun 3, 2011 · 6 comments
Assignees

Comments

@amorri40
Copy link

amorri40 commented Jun 3, 2011

I get this output in the Javascript file:
// Processing item for llvm line 33124
intertyper.js:617: TypeError: Cannot read property 'tokens' of undefined
item.params = parseParamTokens(item.tokens[3].item.tokens);
^
TypeError: Cannot read property 'tokens' of undefined
at Object.processItem (intertyper.js:617:57)
at Object.process (framework.js:155:26)
at framework.js:104:25
at Array.forEach (native)
at Object.solve (framework.js:92:27)
at intertyper (intertyper.js:809:20)
at JSify (jsifier.js:33:30)
at /home/name/Dev/emscripten/src/compiler.js:79:1

This was the output at line 33124 in the .ll file:
invoke void bitcast (void (%"struct.std::__1::string", i32) @Z8toStringj to void (%"struct.std::basic_string<char,std::char_traits,std::allocator >", i32)_)(%"struct.std::basic_string<char,std::char_traits,std::allocator >"* noalias sret %3, i32 %99)
to label %invcont33 unwind label %lpad106

Here is the .ll file that was generated (plus the source file I think it may be caused by):
http://ge.tt/8wHRkn4

@ghost ghost assigned kripken Jun 4, 2011
@kripken
Copy link
Member

kripken commented Jun 4, 2011

I have a patch for this, just waiting on automatic tests to finish before I push.

With the patch this .ll file will compile, however, it has i36 in it (36-bit integers). This will probably cause problems, since I have tested primarily on 32 bit systems, and the code relies on JS bit operations in some cases, which are 32-bit.

Perhaps the original code has a compilation #define that can tell it not to use 36-bit numbers, which are not platform independent?

@amorri40
Copy link
Author

amorri40 commented Jun 4, 2011

Thanks for creating the patch.
I am struggling to find where the code uses the 36bit numbers, sadly it doesn't contain a define to switch them off so I will have to find the problems manually, is there anything I could search for in the source which could make this easier?
I found that using the compiler option: "-I/home/name/Dev/emscripten/tests/libcxx/include" increased the number of i36 in the .ll file, does that mean some of them are in the c++ library?

@kripken
Copy link
Member

kripken commented Jun 4, 2011

Fixed in acaee42

@kripken kripken closed this as completed Jun 4, 2011
@kripken
Copy link
Member

kripken commented Jun 4, 2011

It's possible the C++ library is responsible for some, yeah.

What OS are you on?

@amorri40
Copy link
Author

amorri40 commented Jun 5, 2011

My OS is Ubuntu 11.04 (through a virtual machine).
The patch works great and produces the javascript, so I guess my next step is trying to find out how to compile a stdc++ lib along with the game in order to remove errors such as:
ReferenceError: __ZNSt3__112basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEE6__initEPKcj is not defined

@kripken
Copy link
Member

kripken commented Jun 5, 2011

Basically you would compile a libc++ just like any other big project. The wiki has a page on compiling projects. See also tests/runner.py which has examples of building projects (bullet, openjpeg, zlib).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants