aboutsummaryrefslogtreecommitdiff
path: root/src/jsifier.js
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2011-09-06 20:40:20 -0700
committerAlon Zakai <alonzakai@gmail.com>2011-09-06 20:40:20 -0700
commita70b811afca7ea85792e72f72d7211fa3b5e731b (patch)
treeead77c81207e4cf83ab2b1fd3c8b4ee00eb0fc79 /src/jsifier.js
parenta085c0e4a991901174b2110b0bcbd84960c426bf (diff)
vtable customization in bindings generator, +misc infra improvements to help test it
Diffstat (limited to 'src/jsifier.js')
-rw-r--r--src/jsifier.js5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/jsifier.js b/src/jsifier.js
index 330597bf..c19eda3a 100644
--- a/src/jsifier.js
+++ b/src/jsifier.js
@@ -235,6 +235,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 + ';';
}
@@ -857,6 +861,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));