aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-08 17:44:10 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-08 17:44:10 -0700
commita286d7cfc87f70d2e3c4701074d32d9284b00ede (patch)
treee057dae0bf9b8468ed5bbe207b7c8bcf7bb4fa76 /src
parent541ea2f893c17470342f303fca8d9169c7f48ce9 (diff)
parenta70b811afca7ea85792e72f72d7211fa3b5e731b (diff)
Merge branch 'master' into llvm-svn
Diffstat (limited to 'src')
-rw-r--r--src/jsifier.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 3c2340ce..aa1e3c60 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -237,6 +237,10 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
constant = makePointer(constant, null, BUILD_AS_SHARED_LIB ? 'ALLOC_NORMAL' : 'ALLOC_STATIC', item.type);
var js = item.ident + '=' + constant + ';';
+ // Special case: class vtables. We make sure they are null-terminated, to allow easy runtime operations
+ if (item.ident.substr(0, 5) == '__ZTV') {
+ js += '\n' + makePointer('[0]', null, BUILD_AS_SHARED_LIB ? 'ALLOC_NORMAL' : 'ALLOC_STATIC', ['void*']) + ';';
+ }
if (item.ident in EXPORTED_GLOBALS) {
js += '\nModule["' + item.ident + '"] = ' + item.ident + ';';
}
@@ -903,6 +907,7 @@ function JSify(data, functionsOnly, givenFunctions, givenGlobalVariables) {
var preFile = BUILD_AS_SHARED_LIB ? 'preamble_sharedlib.js' : 'preamble.js';
var pre = processMacros(preprocess(read(preFile).replace('{{RUNTIME}}', getRuntime()), CONSTANTS));
print(pre);
+ print('Runtime.QUANTUM_SIZE = ' + QUANTUM_SIZE);
if (RUNTIME_TYPE_INFO) {
Types.cleanForRuntime();
print('Runtime.typeInfo = ' + JSON.stringify(Types.types));