@@ -33,7 +33,6 @@ CtrlEngine::~CtrlEngine()
33
33
{
34
34
}
35
35
36
-
37
36
void *CtrlEngine::vm_new (QString klass, QVector<QVariant> uargs)
38
37
{
39
38
// 处理流程,
@@ -68,7 +67,7 @@ void *CtrlEngine::vm_new(QString klass, QVector<QVariant> uargs)
68
67
QString modname = QString (" qtmod%1" ).arg (mce->mangle_symbol (mfe->getASTContext (), ctor_decl));
69
68
llvm::Module *qtmod = NULL ;
70
69
71
- if (mman->contains (modname)) {
70
+ if (mman->has (modname)) {
72
71
qtmod = mman->get (modname);
73
72
} else {
74
73
// auto mod = mce->conv_ctor(mfe->getASTContext(), ctor_decl);
@@ -122,10 +121,14 @@ void *CtrlEngine::vm_new(QString klass, QVector<QVariant> uargs)
122
121
// QString lamsym = oe.bind(mod, "_ZN7QStringC2Ev", kthis, uargs, dargs);
123
122
QString lamsym = oe.bind (qtmod, symname, klass, uargs, dargs, mtdargs, false , kthis);
124
123
// qDebug()<<lamsym;
124
+
125
+ llvm::Module *remod = this ->process_dargs (dargs);
126
+ DUMP_IR (remod);
125
127
126
- llvm::Module *remod = oe.bind (qtmod, klass, uargs, dargs, mtdargs, false , kthis);
128
+ oe.bind (qtmod, remod , klass, uargs, dargs, mtdargs, false , kthis);
127
129
TEMP_DEBUG ();
128
- DUMP_IR (remod);
130
+ DUMP_IR (remod);
131
+
129
132
CodeUnit *cu = new CodeUnit (qtmod, remod);
130
133
// QString lamsym = QString::fromStdString(remod->getName().str());
131
134
@@ -146,6 +149,36 @@ void *CtrlEngine::vm_new(QString klass, QVector<QVariant> uargs)
146
149
return kthis;
147
150
}
148
151
152
+ llvm::Module* CtrlEngine::process_dargs (QVector<QVariant> &dargs)
153
+ {
154
+ // 默认参数编译成IR
155
+ clang::FunctionDecl *jmt_decl = mfe->find_free_function (" __jit_main_tmpl" );
156
+ qDebug ()<<jmt_decl;
157
+ // jmt_decl->dumpColor();
158
+ DUMP_COLOR (jmt_decl);
159
+
160
+ if (true ) {
161
+ llvm::Module *remod = mce->conv_dargs (mfe->getASTUnit (), jmt_decl, dargs);
162
+ // DUMP_IR(remod);
163
+ return remod;
164
+
165
+ /*
166
+ int cnter = -1;
167
+ for (auto &v: dargs) {
168
+ cnter ++;
169
+ // qDebug()<<v<<v.type()<<(int)v.type()<<v.userType();
170
+ int t = (int)v.type();
171
+ if (v.type() != QMetaType::User) continue;
172
+ if (v.userType() != EvalType::id) continue;
173
+ mce->gen_darg(mod, v, cnter, jmt_decl);
174
+ EvalType r = v.value<EvalType>();
175
+ qDebug()<<v<<r.ve<<r.vv;
176
+ }
177
+ */
178
+ }
179
+ return NULL ;
180
+ }
181
+
149
182
bool CtrlEngine::vm_delete (void *kthis, QString klass)
150
183
{
151
184
// 处理流程,
@@ -167,7 +200,7 @@ bool CtrlEngine::vm_delete(void *kthis, QString klass)
167
200
QString modname = QString (" qtmod%1" ).arg (mce->mangle_symbol (mfe->getASTContext (), dtor_decl));
168
201
llvm::Module *qtmod = NULL ;
169
202
170
- if (mman->contains (modname)) {
203
+ if (mman->has (modname)) {
171
204
qtmod = mman->get (modname);
172
205
} else {
173
206
auto mod = mce->conv_dtor (mfe->getASTUnit (), dtor_decl);
@@ -358,7 +391,7 @@ QVariant CtrlEngine::vm_call(void *kthis, QString klass, QString method, QVector
358
391
QString modname = QString (" qtmod%1" ).arg (mce->mangle_symbol (mfe->getASTContext (), mth_decl));
359
392
llvm::Module *qtmod = NULL ;
360
393
361
- if (mman->contains (modname)) {
394
+ if (mman->has (modname)) {
362
395
qtmod = mman->get (modname);
363
396
} else {
364
397
// auto mod = mce->conv_method(mfe->getASTContext(), mth_decl);
@@ -401,7 +434,7 @@ QVariant CtrlEngine::vm_call(void *kthis, QString klass, QString method, QVector
401
434
QString lamsym = oe.bind (qtmod, symname, klass, uargs, dargs, mtdargs, mth_decl->isStatic (), kthis);
402
435
qDebug ()<<lamsym;
403
436
404
- llvm::Module *remod = oe.bind (qtmod, klass, uargs, dargs, mtdargs, mth_decl->isStatic (), kthis);
437
+ llvm::Module *remod = NULL ; // oe.bind(qtmod, klass, uargs, dargs, mtdargs, mth_decl->isStatic(), kthis);
405
438
DUMP_IR (remod);
406
439
CodeUnit *cu = new CodeUnit (qtmod, remod);
407
440
@@ -439,7 +472,7 @@ QVariant CtrlEngine::vm_static_call(QString klass, QString method, QVector<QVari
439
472
QString modname = QString (" qtmod%1" ).arg (mce->mangle_symbol (mfe->getASTContext (), mth_decl));
440
473
llvm::Module *qtmod = NULL ;
441
474
442
- if (mman->contains (modname)) {
475
+ if (mman->has (modname)) {
443
476
qtmod = mman->get (modname);
444
477
} else {
445
478
// auto mod = mce->conv_method(mfe->getASTContext(), mth_decl);
@@ -456,7 +489,7 @@ QVariant CtrlEngine::vm_static_call(QString klass, QString method, QVector<QVari
456
489
QString lamsym = oe.bind (qtmod, symname, klass, uargs, dargs, mtdargs, mth_decl->isStatic (), NULL );
457
490
qDebug ()<<lamsym;
458
491
459
- llvm::Module *remod = oe.bind (qtmod, klass, uargs, dargs, mtdargs, mth_decl->isStatic (), NULL );
492
+ llvm::Module *remod = NULL ; // oe.bind(qtmod, klass, uargs, dargs, mtdargs, mth_decl->isStatic(), NULL);
460
493
DUMP_IR (remod);
461
494
CodeUnit *cu = new CodeUnit (qtmod, remod);
462
495
@@ -527,7 +560,7 @@ QString CtrlEngine::vm_qdebug(void *kthis, QString klass)
527
560
QString modname = QString (" qtmod%1" ).arg (mce->mangle_symbol (mfe->getASTContext (), fun_decl));
528
561
llvm::Module *qtmod = NULL ;
529
562
530
- if (mman->contains (modname)) {
563
+ if (mman->has (modname)) {
531
564
qtmod = mman->get (modname);
532
565
} else {
533
566
auto mod = mce->conv_function2 (mfe->getASTUnit (), fun_decl);
@@ -542,7 +575,7 @@ QString CtrlEngine::vm_qdebug(void *kthis, QString klass)
542
575
QString lamsym = oe.bind (qtmod, symname, klass, uargs, dargs, mtdargs, false , NULL );
543
576
qDebug ()<<lamsym;
544
577
545
- llvm::Module *remod = oe.bind (qtmod, klass, uargs, dargs, mtdargs, false , NULL );
578
+ llvm::Module *remod = NULL ; // oe.bind(qtmod, klass, uargs, dargs, mtdargs, false, NULL);
546
579
DUMP_IR (remod);
547
580
CodeUnit *cu = new CodeUnit (qtmod, remod);
548
581
0 commit comments